@d9-network/ink 0.0.7 → 0.1.0
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/index.cjs +24 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +16 -1
- package/dist/index.d.mts +16 -1
- package/dist/index.mjs +20 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -7,6 +7,22 @@ let _polkadot_api_substrate_bindings = require("@polkadot-api/substrate-bindings
|
|
|
7
7
|
let _noble_hashes_blake2_js = require("@noble/hashes/blake2.js");
|
|
8
8
|
let rxjs = require("rxjs");
|
|
9
9
|
|
|
10
|
+
//#region src/constants.ts
|
|
11
|
+
/**
|
|
12
|
+
* D9 Network constants
|
|
13
|
+
*/
|
|
14
|
+
/** D9 SS58 address prefix */
|
|
15
|
+
const D9_SS58_PREFIX = 9;
|
|
16
|
+
/** D9 token decimals */
|
|
17
|
+
const D9_DECIMALS = 2;
|
|
18
|
+
/** D9 token symbol */
|
|
19
|
+
const D9_SYMBOL = "D9";
|
|
20
|
+
/** USDT token decimals */
|
|
21
|
+
const USDT_DECIMALS = 2;
|
|
22
|
+
/** USDT token symbol */
|
|
23
|
+
const USDT_SYMBOL = "USDT";
|
|
24
|
+
|
|
25
|
+
//#endregion
|
|
10
26
|
//#region src/encode.ts
|
|
11
27
|
/**
|
|
12
28
|
* Encode a contract call for ContractsApi_call state_call.
|
|
@@ -275,7 +291,7 @@ function buildPrimitiveCodec$1(primitive) {
|
|
|
275
291
|
* Build codec for special types based on path
|
|
276
292
|
*/
|
|
277
293
|
function buildSpecialTypeCodec$1(path, typeEntry, types, cache) {
|
|
278
|
-
if (path.join("::").includes("AccountId")) return (0, _polkadot_api_substrate_bindings.AccountId)();
|
|
294
|
+
if (path.join("::").includes("AccountId")) return (0, _polkadot_api_substrate_bindings.AccountId)(D9_SS58_PREFIX);
|
|
279
295
|
if (path[0] === "Option") {
|
|
280
296
|
const params = typeEntry.type.params;
|
|
281
297
|
if (params && params.length > 0 && params[0]?.type !== void 0) return (0, _polkadot_api_substrate_bindings.Option)(buildCodecFromType(params[0].type, types, cache));
|
|
@@ -556,7 +572,7 @@ var ContractEventParser = class {
|
|
|
556
572
|
return null;
|
|
557
573
|
}
|
|
558
574
|
try {
|
|
559
|
-
const decodedData = decoder(data);
|
|
575
|
+
const decodedData = decoder(data.slice(1));
|
|
560
576
|
return {
|
|
561
577
|
type: eventLabel,
|
|
562
578
|
value: decodedData,
|
|
@@ -1567,7 +1583,7 @@ function buildPrimitiveCodec(primitive) {
|
|
|
1567
1583
|
}
|
|
1568
1584
|
}
|
|
1569
1585
|
function buildSpecialTypeCodec(path, typeEntry, types, cache) {
|
|
1570
|
-
if (path.join("::").includes("AccountId")) return (0, _polkadot_api_substrate_bindings.AccountId)();
|
|
1586
|
+
if (path.join("::").includes("AccountId")) return (0, _polkadot_api_substrate_bindings.AccountId)(D9_SS58_PREFIX);
|
|
1571
1587
|
if (path[0] === "Option") {
|
|
1572
1588
|
const params = typeEntry.type.params;
|
|
1573
1589
|
if (params && params.length > 0 && params[0]?.type !== void 0) return (0, _polkadot_api_substrate_bindings.Option)(buildCodecFromTypeInternal(params[0].type, types, cache));
|
|
@@ -1969,6 +1985,9 @@ exports.ContractCallParser = ContractCallParser;
|
|
|
1969
1985
|
exports.ContractError = ContractError;
|
|
1970
1986
|
exports.ContractEventParser = ContractEventParser;
|
|
1971
1987
|
exports.ContractExecutionError = ContractExecutionError;
|
|
1988
|
+
exports.D9_DECIMALS = D9_DECIMALS;
|
|
1989
|
+
exports.D9_SS58_PREFIX = D9_SS58_PREFIX;
|
|
1990
|
+
exports.D9_SYMBOL = D9_SYMBOL;
|
|
1972
1991
|
exports.DecodeError = DecodeError;
|
|
1973
1992
|
exports.EncodeError = EncodeError;
|
|
1974
1993
|
exports.InkCodecs = InkCodecs;
|
|
@@ -1978,6 +1997,8 @@ exports.NetworkError = NetworkError;
|
|
|
1978
1997
|
exports.SignerError = SignerError;
|
|
1979
1998
|
exports.TimeoutError = TimeoutError;
|
|
1980
1999
|
exports.TransactionError = TransactionError;
|
|
2000
|
+
exports.USDT_DECIMALS = USDT_DECIMALS;
|
|
2001
|
+
exports.USDT_SYMBOL = USDT_SYMBOL;
|
|
1981
2002
|
exports.applyGasMargin = applyGasMargin;
|
|
1982
2003
|
exports.buildAllEventDecoders = buildAllEventDecoders;
|
|
1983
2004
|
exports.buildAllMessageDecoders = buildAllMessageDecoders;
|