@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.d.cts CHANGED
@@ -5,6 +5,21 @@ import { Bytes } from "@subsquid/scale-codec";
5
5
  import * as _polkadot_api_substrate_bindings0 from "@polkadot-api/substrate-bindings";
6
6
  import { Codec } from "@polkadot-api/substrate-bindings";
7
7
 
8
+ //#region src/constants.d.ts
9
+ /**
10
+ * D9 Network constants
11
+ */
12
+ /** D9 SS58 address prefix */
13
+ declare const D9_SS58_PREFIX = 9;
14
+ /** D9 token decimals */
15
+ declare const D9_DECIMALS = 2;
16
+ /** D9 token symbol */
17
+ declare const D9_SYMBOL = "D9";
18
+ /** USDT token decimals */
19
+ declare const USDT_DECIMALS = 2;
20
+ /** USDT token symbol */
21
+ declare const USDT_SYMBOL = "USDT";
22
+ //#endregion
8
23
  //#region src/errors.d.ts
9
24
  /**
10
25
  * Structured error types for contract operations.
@@ -1555,5 +1570,5 @@ declare function compareGasWeight(a: GasWeight, b: GasWeight): -1 | 0 | 1;
1555
1570
  */
1556
1571
  declare function gasExceedsLimit(gas: GasWeight, limit: GasWeight): boolean;
1557
1572
  //#endregion
1558
- export { AbortedError, type BlockHeader, type CallFilterOptions, ContractCallParser, type ContractCallResult, ContractError, type ContractErrorType, ContractEventParser, ContractExecutionError, type ContractMessageBuilder, type ContractStorage, type CreateContractOptions, type CreateD9InkSdkOptions, type D9InkContract, type D9InkContractFromDescriptor, type D9InkSdk, type D9InkSdkOptions, type D9InkSdkWithRpc, DecodeError, type DecodedContractEvent, EncodeError, EstimatedCost, type EventFilterOptions, type EventSubscriptionOptions, type ExtractEnumDef, type ExtractEventLabels, type ExtractMessageLabels, FormattedGasInfo, type GasInfo, GasWeight, type InferEvents, type InferMessages, InkCodecs, type KnownRpcMethod, LangError, type MessageAttributes, type MessageInfo, MetadataError, NetworkError, type QueryOptions, type QueryResult, type QuerySuccessValue, type RawContractCall, type RawContractEvent, type ResponseDecoder, type RpcParams, type RpcReturn, type RuntimeVersion, type SendOptions, type SendableTransaction, SignerError, type StorageChangeSet, type StorageDepositInfo, type SubstrateRpcMethods, type SystemHealth, TimeoutError, TransactionError, type TxResult, type TypedCallFilterOptions, type TypedContractCall, type TypedContractEvent, type TypedEventFilterOptions, type TypedMessage, type TypedRpcRequest, applyGasMargin, buildAllEventDecoders, buildAllMessageDecoders, buildEventDecoder, buildMessageDecoder, compareGasWeight, createAsciiEventTopic, createCodecRegistry, createContractEventStream, createD9InkContract, createD9InkSdk, createMessageBuilder, createNativeTransferStream, createPSP22TransferStream, createTypedRpc, decodeContractCallResult, decodeInkValue, decodeResult, encodeCall, encodeContractCall, encodeContractCallWithLimits, estimateTransactionCost, formatGasInfo, gasExceedsLimit, getEventSignature, isCallType, isContractError, isErrorType, isEventType, isLangError, unwrapInkResult };
1573
+ export { AbortedError, type BlockHeader, type CallFilterOptions, ContractCallParser, type ContractCallResult, ContractError, type ContractErrorType, ContractEventParser, ContractExecutionError, type ContractMessageBuilder, type ContractStorage, type CreateContractOptions, type CreateD9InkSdkOptions, type D9InkContract, type D9InkContractFromDescriptor, type D9InkSdk, type D9InkSdkOptions, type D9InkSdkWithRpc, D9_DECIMALS, D9_SS58_PREFIX, D9_SYMBOL, DecodeError, type DecodedContractEvent, EncodeError, EstimatedCost, type EventFilterOptions, type EventSubscriptionOptions, type ExtractEnumDef, type ExtractEventLabels, type ExtractMessageLabels, FormattedGasInfo, type GasInfo, GasWeight, type InferEvents, type InferMessages, InkCodecs, type KnownRpcMethod, LangError, type MessageAttributes, type MessageInfo, MetadataError, NetworkError, type QueryOptions, type QueryResult, type QuerySuccessValue, type RawContractCall, type RawContractEvent, type ResponseDecoder, type RpcParams, type RpcReturn, type RuntimeVersion, type SendOptions, type SendableTransaction, SignerError, type StorageChangeSet, type StorageDepositInfo, type SubstrateRpcMethods, type SystemHealth, TimeoutError, TransactionError, type TxResult, type TypedCallFilterOptions, type TypedContractCall, type TypedContractEvent, type TypedEventFilterOptions, type TypedMessage, type TypedRpcRequest, USDT_DECIMALS, USDT_SYMBOL, applyGasMargin, buildAllEventDecoders, buildAllMessageDecoders, buildEventDecoder, buildMessageDecoder, compareGasWeight, createAsciiEventTopic, createCodecRegistry, createContractEventStream, createD9InkContract, createD9InkSdk, createMessageBuilder, createNativeTransferStream, createPSP22TransferStream, createTypedRpc, decodeContractCallResult, decodeInkValue, decodeResult, encodeCall, encodeContractCall, encodeContractCallWithLimits, estimateTransactionCost, formatGasInfo, gasExceedsLimit, getEventSignature, isCallType, isContractError, isErrorType, isEventType, isLangError, unwrapInkResult };
1559
1574
  //# sourceMappingURL=index.d.cts.map
package/dist/index.d.mts CHANGED
@@ -5,6 +5,21 @@ import * as _polkadot_api_substrate_bindings0 from "@polkadot-api/substrate-bind
5
5
  import { Codec } from "@polkadot-api/substrate-bindings";
6
6
  import { Observable } from "rxjs";
7
7
 
8
+ //#region src/constants.d.ts
9
+ /**
10
+ * D9 Network constants
11
+ */
12
+ /** D9 SS58 address prefix */
13
+ declare const D9_SS58_PREFIX = 9;
14
+ /** D9 token decimals */
15
+ declare const D9_DECIMALS = 2;
16
+ /** D9 token symbol */
17
+ declare const D9_SYMBOL = "D9";
18
+ /** USDT token decimals */
19
+ declare const USDT_DECIMALS = 2;
20
+ /** USDT token symbol */
21
+ declare const USDT_SYMBOL = "USDT";
22
+ //#endregion
8
23
  //#region src/errors.d.ts
9
24
  /**
10
25
  * Structured error types for contract operations.
@@ -1555,5 +1570,5 @@ declare function compareGasWeight(a: GasWeight, b: GasWeight): -1 | 0 | 1;
1555
1570
  */
1556
1571
  declare function gasExceedsLimit(gas: GasWeight, limit: GasWeight): boolean;
1557
1572
  //#endregion
1558
- export { AbortedError, type BlockHeader, type CallFilterOptions, ContractCallParser, type ContractCallResult, ContractError, type ContractErrorType, ContractEventParser, ContractExecutionError, type ContractMessageBuilder, type ContractStorage, type CreateContractOptions, type CreateD9InkSdkOptions, type D9InkContract, type D9InkContractFromDescriptor, type D9InkSdk, type D9InkSdkOptions, type D9InkSdkWithRpc, DecodeError, type DecodedContractEvent, EncodeError, EstimatedCost, type EventFilterOptions, type EventSubscriptionOptions, type ExtractEnumDef, type ExtractEventLabels, type ExtractMessageLabels, FormattedGasInfo, type GasInfo, GasWeight, type InferEvents, type InferMessages, InkCodecs, type KnownRpcMethod, LangError, type MessageAttributes, type MessageInfo, MetadataError, NetworkError, type QueryOptions, type QueryResult, type QuerySuccessValue, type RawContractCall, type RawContractEvent, type ResponseDecoder, type RpcParams, type RpcReturn, type RuntimeVersion, type SendOptions, type SendableTransaction, SignerError, type StorageChangeSet, type StorageDepositInfo, type SubstrateRpcMethods, type SystemHealth, TimeoutError, TransactionError, type TxResult, type TypedCallFilterOptions, type TypedContractCall, type TypedContractEvent, type TypedEventFilterOptions, type TypedMessage, type TypedRpcRequest, applyGasMargin, buildAllEventDecoders, buildAllMessageDecoders, buildEventDecoder, buildMessageDecoder, compareGasWeight, createAsciiEventTopic, createCodecRegistry, createContractEventStream, createD9InkContract, createD9InkSdk, createMessageBuilder, createNativeTransferStream, createPSP22TransferStream, createTypedRpc, decodeContractCallResult, decodeInkValue, decodeResult, encodeCall, encodeContractCall, encodeContractCallWithLimits, estimateTransactionCost, formatGasInfo, gasExceedsLimit, getEventSignature, isCallType, isContractError, isErrorType, isEventType, isLangError, unwrapInkResult };
1573
+ export { AbortedError, type BlockHeader, type CallFilterOptions, ContractCallParser, type ContractCallResult, ContractError, type ContractErrorType, ContractEventParser, ContractExecutionError, type ContractMessageBuilder, type ContractStorage, type CreateContractOptions, type CreateD9InkSdkOptions, type D9InkContract, type D9InkContractFromDescriptor, type D9InkSdk, type D9InkSdkOptions, type D9InkSdkWithRpc, D9_DECIMALS, D9_SS58_PREFIX, D9_SYMBOL, DecodeError, type DecodedContractEvent, EncodeError, EstimatedCost, type EventFilterOptions, type EventSubscriptionOptions, type ExtractEnumDef, type ExtractEventLabels, type ExtractMessageLabels, FormattedGasInfo, type GasInfo, GasWeight, type InferEvents, type InferMessages, InkCodecs, type KnownRpcMethod, LangError, type MessageAttributes, type MessageInfo, MetadataError, NetworkError, type QueryOptions, type QueryResult, type QuerySuccessValue, type RawContractCall, type RawContractEvent, type ResponseDecoder, type RpcParams, type RpcReturn, type RuntimeVersion, type SendOptions, type SendableTransaction, SignerError, type StorageChangeSet, type StorageDepositInfo, type SubstrateRpcMethods, type SystemHealth, TimeoutError, TransactionError, type TxResult, type TypedCallFilterOptions, type TypedContractCall, type TypedContractEvent, type TypedEventFilterOptions, type TypedMessage, type TypedRpcRequest, USDT_DECIMALS, USDT_SYMBOL, applyGasMargin, buildAllEventDecoders, buildAllMessageDecoders, buildEventDecoder, buildMessageDecoder, compareGasWeight, createAsciiEventTopic, createCodecRegistry, createContractEventStream, createD9InkContract, createD9InkSdk, createMessageBuilder, createNativeTransferStream, createPSP22TransferStream, createTypedRpc, decodeContractCallResult, decodeInkValue, decodeResult, encodeCall, encodeContractCall, encodeContractCallWithLimits, estimateTransactionCost, formatGasInfo, gasExceedsLimit, getEventSignature, isCallType, isContractError, isErrorType, isEventType, isLangError, unwrapInkResult };
1559
1574
  //# sourceMappingURL=index.d.mts.map
package/dist/index.mjs CHANGED
@@ -7,6 +7,22 @@ import { AccountId, Bytes as Bytes$1, Option, Struct, Tuple, Variant, Vector, _v
7
7
  import { blake2b } from "@noble/hashes/blake2.js";
8
8
  import { catchError, filter, from, map, mergeMap, of, share } from "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 AccountId();
294
+ if (path.join("::").includes("AccountId")) return 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 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 AccountId();
1586
+ if (path.join("::").includes("AccountId")) return 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 Option(buildCodecFromTypeInternal(params[0].type, types, cache));
@@ -1964,5 +1980,5 @@ function gasExceedsLimit(gas, limit) {
1964
1980
  }
1965
1981
 
1966
1982
  //#endregion
1967
- export { AbortedError, ContractCallParser, ContractError, ContractEventParser, ContractExecutionError, DecodeError, EncodeError, InkCodecs, LangError, MetadataError, NetworkError, SignerError, TimeoutError, TransactionError, applyGasMargin, buildAllEventDecoders, buildAllMessageDecoders, buildEventDecoder, buildMessageDecoder, compareGasWeight, createAsciiEventTopic, createCodecRegistry, createContractEventStream, createD9InkContract, createD9InkSdk, createMessageBuilder, createNativeTransferStream, createPSP22TransferStream, createTypedRpc, decodeContractCallResult, decodeInkValue, decodeResult, encodeCall, encodeContractCall, encodeContractCallWithLimits, estimateTransactionCost, formatGasInfo, gasExceedsLimit, getEventSignature, isCallType, isContractError, isErrorType, isEventType, isLangError, unwrapInkResult };
1983
+ export { AbortedError, ContractCallParser, ContractError, ContractEventParser, ContractExecutionError, D9_DECIMALS, D9_SS58_PREFIX, D9_SYMBOL, DecodeError, EncodeError, InkCodecs, LangError, MetadataError, NetworkError, SignerError, TimeoutError, TransactionError, USDT_DECIMALS, USDT_SYMBOL, applyGasMargin, buildAllEventDecoders, buildAllMessageDecoders, buildEventDecoder, buildMessageDecoder, compareGasWeight, createAsciiEventTopic, createCodecRegistry, createContractEventStream, createD9InkContract, createD9InkSdk, createMessageBuilder, createNativeTransferStream, createPSP22TransferStream, createTypedRpc, decodeContractCallResult, decodeInkValue, decodeResult, encodeCall, encodeContractCall, encodeContractCallWithLimits, estimateTransactionCost, formatGasInfo, gasExceedsLimit, getEventSignature, isCallType, isContractError, isErrorType, isEventType, isLangError, unwrapInkResult };
1968
1984
  //# sourceMappingURL=index.mjs.map