Skip to content

Instantly share code, notes, and snippets.

GET /transaction/_doc/_search
{
"query": {
"bool": {
"must": [
{
"match": {
"data.assetName": {
"query": "assetName",
"fuzziness": 3
GET /asset/_doc/_search
{
"query": {
"bool": {
"must": [{"term": { "address": {"value": "address"}}}]
}
},
"size": 0,
"aggs": {
"asset_bucket": {
const parcel = sdk.core.createChangeShardStateParcel({
transactions: [mintTx]
});
await sdk.rpc.chain.sendParcel(parcel, {
account: "cccqzn9jjm3j6qg69smd7cn0eup4w7z2yu9myd6c4d7",
passphrase: "satoshi",
});
const keyStore = await sdk.key.createMemoryKeyStore();
const p2pkh = await sdk.key.createP2PKH({
keyStore
});
const gilyoungAddress = await p2pkh.createAddress();
const mintTx = sdk.core.createAssetMintTransaction({
scheme: luckySonCard,
recipient: gilyoungAddress
});
const luckySonCard = sdk.core.createAssetScheme({
shardId: 0,
metadata: JSON.stringify({
name: "Lucky Son Card",
description: "Son Heung-min (born 8 July 1992) is a South Korean professional footballer who plays as a winger or a forward for Premier League club Tottenham Hotspur and the South Korea national team. Son finished his development at Hamburger SV, where he made his debut in the German Bundesliga in 2010. In 2013, he moved to Bayer Leverkusen for a club record €10 million, and played for the club in the UEFA Europa League and UEFA Champions League. Two years later, he signed for Tottenham for £22 million, becoming the most expensive Asian player in history.[4] While at Tottenham, he became the top Asian goalscorer in Premier League history.",
icon_url: "https://image.ibb.co/d4wF5p/son.png",
}),
amount: 1,
registrar: null,
});
var parcel = sdk.core.createChangeShardStateParcel({ transactions: [assetMintTransaction] });
sdk.rpc.chain.sendParcel(parcel, {
account: "cccqzn9jjm3j6qg69smd7cn0eup4w7z2yu9myd6c4d7",
passphrase: "satoshi"
}).then(function (parcelHash) {
return sdk.rpc.chain.getParcelInvoice(parcelHash, {
timeout: 120 * 1000
});
}).then(function (invoice) {
console.log(invoice); // [{ success: true }]
const gameOwner = "ccaqqqap7lazh5g84jsfxccp686jakdy0z9v4chrq4vz8pj4nl9lzvf7rs2rnmc0"
const mintTx = sdk.core.createAssetMintTransaction({
scheme: wowTokenScheme,
recipient: gameOwner
});
const wowTokenScheme = sdk.core.createAssetScheme({
shardId: 0,
metadata: JSON.stringify({
name: "Wow Token",
description: "플레이어들은 게임 내 상점에서 WoW 토큰을 구입하고, 경매장에서 이를 지정된 시세의 골드로 교환할 수 있습니다. 플레이어가 경매장에서 WoW 토큰을 교환하면 귀속 아이템이 되며, 이를 사용하여 30일의 게임 시간을 등록할 수 있습니다.",
icon_url: "https://i2.wp.com/www.constantwarfare.com/wp-content/uploads/2015/04/wowtokenforgold.jpg?w=316",
}),
amount: 10000,
registrar: "cccqzn9jjm3j6qg69smd7cn0eup4w7z2yu9myd6c4d7",
});
p2pkh.createAddress().then(function (address) {
console.log(address.toString()); //ccaqqqap7lazh5g84jsfxccp686jakdy0z9v4chrq4vz8pj4nl9lzvf7rs2rnmc0
}).catch(console.error);
var keyStore = sdk.key.createMemoryKeyStore();
var p2pkh = sdk.key.createP2PKH({ keyStore });