phantasma-sdk-ts 0.2.0-rc.4 → 0.2.0-rc.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core/types/Carbon/Blockchain/Modules/TokenHelper.d.ts +5 -0
- package/dist/core/types/Carbon/Blockchain/Modules/TokenHelper.d.ts.map +1 -0
- package/dist/core/types/Carbon/Blockchain/Modules/TokenHelper.js +16 -0
- package/dist/core/types/Carbon/Blockchain/Modules/index.d.ts +1 -0
- package/dist/core/types/Carbon/Blockchain/Modules/index.d.ts.map +1 -1
- package/dist/core/types/Carbon/Blockchain/Modules/index.js +1 -0
- package/dist/core/types/Carbon/Blockchain/TxHelpers/MintNonFungibleTxHelper.d.ts +1 -0
- package/dist/core/types/Carbon/Blockchain/TxHelpers/MintNonFungibleTxHelper.d.ts.map +1 -1
- package/dist/core/types/Carbon/Blockchain/TxHelpers/MintNonFungibleTxHelper.js +13 -0
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TokenHelper.d.ts","sourceRoot":"","sources":["../../../../../../src/core/types/Carbon/Blockchain/Modules/TokenHelper.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAExC,qBAAa,WAAW;IACtB,MAAM,CAAC,aAAa,CAAC,aAAa,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO;CAWzE"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TokenHelper = void 0;
|
|
4
|
+
const CarbonSerialization_1 = require("../../../CarbonSerialization");
|
|
5
|
+
const Bytes32_1 = require("../../Bytes32");
|
|
6
|
+
class TokenHelper {
|
|
7
|
+
static getNftAddress(carbonTokenId, instanceId) {
|
|
8
|
+
const w = new CarbonSerialization_1.CarbonBinaryWriter();
|
|
9
|
+
w.write(new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]) // Carbon NFT ID prefix
|
|
10
|
+
);
|
|
11
|
+
w.write8u(carbonTokenId);
|
|
12
|
+
w.write8u(instanceId);
|
|
13
|
+
return new Bytes32_1.Bytes32(w.toUint8Array());
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
exports.TokenHelper = TokenHelper;
|
|
@@ -2,6 +2,7 @@ export * from "./Builders";
|
|
|
2
2
|
export * from "./SeriesInfo";
|
|
3
3
|
export * from "./StandardMeta";
|
|
4
4
|
export * from "./TokenContract_Methods";
|
|
5
|
+
export * from "./TokenHelper";
|
|
5
6
|
export * from "./TokenInfo";
|
|
6
7
|
export * from "./TokenSchemas";
|
|
7
8
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/core/types/Carbon/Blockchain/Modules/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA;AAC1B,cAAc,cAAc,CAAA;AAC5B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,yBAAyB,CAAA;AACvC,cAAc,aAAa,CAAA;AAC3B,cAAc,gBAAgB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/core/types/Carbon/Blockchain/Modules/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA;AAC1B,cAAc,cAAc,CAAA;AAC5B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,yBAAyB,CAAA;AACvC,cAAc,eAAe,CAAA;AAC7B,cAAc,aAAa,CAAA;AAC3B,cAAc,gBAAgB,CAAA"}
|
|
@@ -18,5 +18,6 @@ __exportStar(require("./Builders"), exports);
|
|
|
18
18
|
__exportStar(require("./SeriesInfo"), exports);
|
|
19
19
|
__exportStar(require("./StandardMeta"), exports);
|
|
20
20
|
__exportStar(require("./TokenContract_Methods"), exports);
|
|
21
|
+
__exportStar(require("./TokenHelper"), exports);
|
|
21
22
|
__exportStar(require("./TokenInfo"), exports);
|
|
22
23
|
__exportStar(require("./TokenSchemas"), exports);
|
|
@@ -6,5 +6,6 @@ export declare class MintNonFungibleTxHelper {
|
|
|
6
6
|
static buildTx(carbonTokenId: bigint, carbonSeriesId: number, senderPublicKey: Bytes32, receiverPublicKey: Bytes32, rom: Uint8Array, ram: Uint8Array, feeOptions?: MintNftFeeOptions, maxData?: bigint, expiry?: bigint): TxMsg;
|
|
7
7
|
static buildTxAndSign(tokenId: bigint, seriesId: number, signer: PhantasmaKeys, receiverPublicKey: Bytes32, rom: Uint8Array, ram: Uint8Array, feeOptions?: MintNftFeeOptions, maxData?: bigint, expiry?: bigint): Uint8Array;
|
|
8
8
|
static buildTxAndSignHex(tokenId: bigint, seriesId: number, signer: PhantasmaKeys, receiverPublicKey: Bytes32, rom: Uint8Array, ram: Uint8Array | null | undefined, feeOptions?: MintNftFeeOptions, maxData?: bigint, expiry?: bigint): string;
|
|
9
|
+
static parseResult(carbonTokenId: bigint, resultHex: string): Bytes32[];
|
|
9
10
|
}
|
|
10
11
|
//# sourceMappingURL=MintNonFungibleTxHelper.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MintNonFungibleTxHelper.d.ts","sourceRoot":"","sources":["../../../../../../src/core/types/Carbon/Blockchain/TxHelpers/MintNonFungibleTxHelper.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"MintNonFungibleTxHelper.d.ts","sourceRoot":"","sources":["../../../../../../src/core/types/Carbon/Blockchain/TxHelpers/MintNonFungibleTxHelper.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAKxC,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAEjC,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAEjD,qBAAa,uBAAuB;IAElC,MAAM,CAAC,OAAO,CACZ,aAAa,EAAE,MAAM,EACrB,cAAc,EAAE,MAAM,EACtB,eAAe,EAAE,OAAO,EACxB,iBAAiB,EAAE,OAAO,EAC1B,GAAG,EAAE,UAAU,EACf,GAAG,EAAE,UAAU,EACf,UAAU,CAAC,EAAE,iBAAiB,EAC9B,OAAO,CAAC,EAAE,MAAM,EAChB,MAAM,CAAC,EAAE,MAAM,GACd,KAAK;IAyBR,MAAM,CAAC,cAAc,CACnB,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,aAAa,EACrB,iBAAiB,EAAE,OAAO,EAC1B,GAAG,EAAE,UAAU,EACf,GAAG,EAAE,UAAU,EACf,UAAU,CAAC,EAAE,iBAAiB,EAC9B,OAAO,CAAC,EAAE,MAAM,EAChB,MAAM,CAAC,EAAE,MAAM,GACd,UAAU;IAiBb,MAAM,CAAC,iBAAiB,CACtB,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,aAAa,EACrB,iBAAiB,EAAE,OAAO,EAC1B,GAAG,EAAE,UAAU,EACf,GAAG,EAAE,UAAU,GAAG,IAAI,GAAG,SAAS,EAClC,UAAU,CAAC,EAAE,iBAAiB,EAC9B,OAAO,CAAC,EAAE,MAAM,EAChB,MAAM,CAAC,EAAE,MAAM,GACd,MAAM;IAeT,MAAM,CAAC,WAAW,CAAC,aAAa,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,EAAE;CAexE"}
|
|
@@ -2,10 +2,12 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.MintNonFungibleTxHelper = void 0;
|
|
4
4
|
const utils_1 = require("../../../../utils");
|
|
5
|
+
const CarbonSerialization_1 = require("../../../CarbonSerialization");
|
|
5
6
|
const Bytes32_1 = require("../../Bytes32");
|
|
6
7
|
const SmallString_1 = require("../../SmallString");
|
|
7
8
|
const TxTypes_1 = require("../../TxTypes");
|
|
8
9
|
const TxMsgSigner_1 = require("../Extensions/TxMsgSigner");
|
|
10
|
+
const TokenHelper_1 = require("../Modules/TokenHelper");
|
|
9
11
|
const TxMsg_1 = require("../TxMsg");
|
|
10
12
|
const TxMsgMintNonFungible_1 = require("../TxMsgMintNonFungible");
|
|
11
13
|
const FeeOptions_1 = require("./FeeOptions");
|
|
@@ -41,5 +43,16 @@ class MintNonFungibleTxHelper {
|
|
|
41
43
|
const bytes = this.buildTxAndSign(tokenId, seriesId, signer, receiverPublicKey, rom, ram, feeOptions, maxData, expiry);
|
|
42
44
|
return (0, utils_1.bytesToHex)(bytes);
|
|
43
45
|
}
|
|
46
|
+
static parseResult(carbonTokenId, resultHex) {
|
|
47
|
+
const result = [];
|
|
48
|
+
const r = new CarbonSerialization_1.CarbonBinaryReader((0, utils_1.hexToBytes)(resultHex));
|
|
49
|
+
const count = r.read4u();
|
|
50
|
+
for (let i = 0; i < count; i++) {
|
|
51
|
+
const instanceId = r.read8u();
|
|
52
|
+
const carbonNftId = TokenHelper_1.TokenHelper.getNftAddress(carbonTokenId, instanceId);
|
|
53
|
+
result.push(carbonNftId);
|
|
54
|
+
}
|
|
55
|
+
return result;
|
|
56
|
+
}
|
|
44
57
|
}
|
|
45
58
|
exports.MintNonFungibleTxHelper = MintNonFungibleTxHelper;
|