@gala-chain/gala-core-sdk 1.2.1 → 1.3.0-rc.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
@@ -96,6 +96,24 @@ type InvalidTokenReferenceReason = (typeof INVALID_TOKEN_REFERENCE_REASONS)[numb
96
96
  export declare const INVALID_NFT_INPUT_REASONS: readonly ['not_a_string', 'empty', 'bad_characters', 'not_a_positive_whole_number', 'above_mint_limit', 'bad_public_key', 'bad_authorities', 'bad_collection_name'];
97
97
  /** One member of {@link INVALID_NFT_INPUT_REASONS}. */
98
98
  type InvalidNftInputReason = (typeof INVALID_NFT_INPUT_REASONS)[number];
99
+ /**
100
+ * Why a signed DTO's expiry is refused (`INVALID_DTO_EXPIRES_AT.params.reason`). A token for the
101
+ * app to map to its own text.
102
+ *
103
+ * - `not_a_safe_integer`: not a JS number that is a safe integer (`NaN`, `Infinity`, a fraction, a
104
+ * string, a bigint, a value beyond `Number.MAX_SAFE_INTEGER`).
105
+ * - `not_positive`: `0` or below. The chain reads a falsy `dtoExpiresAt` as "no expiry", so `0`
106
+ * is never signed as one.
107
+ * - `expired`: the deadline is not after the builder's clock (a wallet builder refuses to sign a
108
+ * DTO the chain would already refuse or refuse within the same millisecond).
109
+ * - `expiry_window`: the deadline is more than the wallet builder's window ahead of its clock, or
110
+ * an `expiresInMs` outside that window.
111
+ * - `bad_shape`: a wallet builder expiry that is not exactly one of `{ dtoExpiresAt }` or
112
+ * `{ expiresInMs, nowMs }` (never guessed between them).
113
+ */
114
+ export declare const INVALID_DTO_EXPIRES_AT_REASONS: readonly ['not_a_safe_integer', 'not_positive', 'expired', 'expiry_window', 'bad_shape'];
115
+ /** One member of {@link INVALID_DTO_EXPIRES_AT_REASONS}. */
116
+ type InvalidDtoExpiresAtReason = (typeof INVALID_DTO_EXPIRES_AT_REASONS)[number];
99
117
  /**
100
118
  * The `GatewayWrites` options that are refused when missing or of the wrong type
101
119
  * (`INVALID_WRITES_OPTION.params.option`). `walletAddress`, `requestTimeoutMs` and
@@ -621,6 +639,21 @@ export declare const GALA_ERROR_CATALOG: {
621
639
  readonly value: 'string';
622
640
  };
623
641
  };
642
+ readonly INVALID_DTO_EXPIRES_AT: {
643
+ readonly phase: 'pre_send';
644
+ readonly template: 'Invalid {field}: {reason}.';
645
+ readonly params: {
646
+ readonly field: 'string';
647
+ readonly reason: readonly ["not_a_safe_integer", "not_positive", "expired", "expiry_window", "bad_shape"];
648
+ };
649
+ };
650
+ readonly INVALID_CONTRACT_PATH: {
651
+ readonly phase: 'pre_send';
652
+ readonly template: 'Invalid {field}: it names no contract this SDK knows a dtoOperation for; nothing was signed.';
653
+ readonly params: {
654
+ readonly field: 'string';
655
+ };
656
+ };
624
657
  readonly INVALID_LOCK_NAME: {
625
658
  readonly phase: 'pre_send';
626
659
  readonly template: 'The lock name must be a string (got a {valueType}).';
@@ -1022,6 +1055,8 @@ export declare const GALA_ERROR_PHASE_BY_CODE: {
1022
1055
  readonly INVALID_TOKEN_REFERENCE: 'pre_send';
1023
1056
  readonly INVALID_TOKEN_BATCH: 'pre_send';
1024
1057
  readonly INVALID_LOCK_EXPIRES: 'pre_send';
1058
+ readonly INVALID_DTO_EXPIRES_AT: 'pre_send';
1059
+ readonly INVALID_CONTRACT_PATH: 'pre_send';
1025
1060
  readonly INVALID_LOCK_NAME: 'pre_send';
1026
1061
  readonly INVALID_NFT_INPUT: 'pre_send';
1027
1062
  readonly NO_TOKEN_NAME_RESOLVER: 'pre_send';
@@ -1898,6 +1933,15 @@ export declare const CHAIN_METHOD_OPERATIONS: {
1898
1933
  };
1899
1934
  /** An API path of a GalaChain contract (`asset/token-contract`, `asset/dex-contract`, ...). */
1900
1935
  type ChainContractPath = keyof typeof CHAIN_CONTRACT_OPERATION_PREFIXES;
1936
+ /**
1937
+ * `value` as a {@link ChainContractPath}: a string naming a contract in the operation table (an
1938
+ * own key, so `toString` or a polluted prototype never counts). Checked before anything is built
1939
+ * or signed.
1940
+ *
1941
+ * @throws GalaSDKError `INVALID_CONTRACT_PATH` (`params.field` = `field`; the value is never
1942
+ * echoed).
1943
+ */
1944
+ export declare function checkContractPath(value: unknown, field: string): ChainContractPath;
1901
1945
  /**
1902
1946
  * The `dtoOperation` of `method` on the contract served at `contractPath`: the chain's own
1903
1947
  * (`CHAIN_METHOD_OPERATIONS`) where it deviates from the platform table, else the table's prefix plus `:<method>`.
@@ -2610,8 +2654,8 @@ interface TokenQuantityInput {
2610
2654
  tokenName?: string | undefined;
2611
2655
  /**
2612
2656
  * The amount in WHOLE tokens, as the decimal string the chain is to receive (`"1.5"` is one and a
2613
- * half tokens). It is signed exactly as written: never scaled to base units, never re-formatted
2614
- * (`"1.50"` stays `"1.50"`).
2657
+ * half tokens). Never scaled to base units; signed in the chain's canonical spelling
2658
+ * (`BigNumber#toFixed()`: `"1.50"` is signed `"1.5"`), the only one the chain's DTO classes accept.
2615
2659
  */
2616
2660
  quantity: string;
2617
2661
  }
@@ -2623,8 +2667,21 @@ interface WriteKeyInput {
2623
2667
  */
2624
2668
  uniqueKey?: string | undefined;
2625
2669
  }
2670
+ /** The optional signed expiry of a transfer. */
2671
+ interface DtoExpiresAtInput {
2672
+ /**
2673
+ * When the chain stops accepting this signed DTO, in epoch MILLISECONDS: a safe integer above
2674
+ * zero (`INVALID_DTO_EXPIRES_AT` otherwise). It is part of the signed bytes, so it cannot be
2675
+ * removed or changed without invalidating the signature; the chain refuses the DTO once
2676
+ * `dtoExpiresAt < Date.now()` on its own clock. Omitted: no field, and the DTO is byte-for-byte
2677
+ * what it was before this option existed (the chain then applies no expiry). The SDK signs the
2678
+ * value as given and applies no window: a wallet derives it from its quote (`expiresAtMs`)
2679
+ * through `@gala-games/wallet-core`'s `buildTransferTokenDto`, which bounds it to 60 s.
2680
+ */
2681
+ dtoExpiresAt?: number | undefined;
2682
+ }
2626
2683
  /** `transferGala`: GALA (`GALA|Unit|none|none`, instance `"0"`) to a recipient. */
2627
- interface TransferGalaInput extends WriteKeyInput {
2684
+ interface TransferGalaInput extends WriteKeyInput, DtoExpiresAtInput {
2628
2685
  /**
2629
2686
  * The recipient: an Ethereum account (`eth|<40 hex>`, `0x<40 hex>` or `<40 hex>`, any casing
2630
2687
  * but a wrong EIP-55 checksum; always sent as `eth|<checksummed>`), or a `client|` alias (sent
@@ -2636,7 +2693,7 @@ interface TransferGalaInput extends WriteKeyInput {
2636
2693
  quantity: string;
2637
2694
  }
2638
2695
  /** `transferToken`: one token to a recipient. */
2639
- interface TransferTokenInput extends TokenQuantityInput, WriteKeyInput {
2696
+ interface TransferTokenInput extends TokenQuantityInput, WriteKeyInput, DtoExpiresAtInput {
2640
2697
  /** The recipient (see {@link TransferGalaInput.to}). */
2641
2698
  to: string;
2642
2699
  }
@@ -2846,7 +2903,7 @@ type NftFeeRequest = ({
2846
2903
  * the quantity, the `uniqueKey`, the batch), so a refused input costs no signature and no request.
2847
2904
  * The DTO is plain JSON with exactly the chain's fields; the signer signs it as it is (nothing,
2848
2905
  * least of all a signer hint, is added) and the body sent is what the signer returned. Quantities
2849
- * are whole tokens and are signed exactly as written.
2906
+ * are whole tokens, signed in the chain's canonical spelling (`writeQuantity`: `"1.50"` as `"1.5"`).
2850
2907
  *
2851
2908
  * @example
2852
2909
  * ```ts
@@ -2873,9 +2930,12 @@ export declare class GatewayWrites {
2873
2930
  /**
2874
2931
  * Transfer GALA (`GALA|Unit|none|none`, instance `"0"`) to `to`.
2875
2932
  *
2933
+ * `input.dtoExpiresAt` (optional, epoch ms) is signed into the DTO when given; see
2934
+ * `DtoExpiresAtInput.dtoExpiresAt`.
2935
+ *
2876
2936
  * @throws GalaSDKError pre-send: `INVALID_WALLET_ADDRESS`, `INVALID_QUANTITY`,
2877
- * `INVALID_UNIQUE_KEY`, `SIGNING_FAILED`; in flight: `GATEWAY_WRITE_OUTCOME_UNKNOWN` (check
2878
- * `error.uniqueKey`; never resend under a fresh key);
2937
+ * `INVALID_DTO_EXPIRES_AT`, `INVALID_UNIQUE_KEY`, `SIGNING_FAILED`; in flight:
2938
+ * `GATEWAY_WRITE_OUTCOME_UNKNOWN` (check `error.uniqueKey`; never resend under a fresh key);
2879
2939
  * post-send: `GATEWAY_WRITE_REJECTED`, `GATEWAY_HTTP_ERROR`, `GATEWAY_RESPONSE_INVALID`.
2880
2940
  */
2881
2941
  transferGala(input: TransferGalaInput): Promise<GatewayWriteReceipt>;
@@ -2989,6 +3049,39 @@ export declare function galaChainUserRef(value: unknown, field: string): string;
2989
3049
  /** GALA's class key: what `transferGala` moves. */
2990
3050
  export declare const GALA_TOKEN_CLASS_KEY: Readonly<GalaChainTokenClassKey>;
2991
3051
  //#endregion
3052
+ //#region src/writes/dto_expiry.d.ts
3053
+ /**
3054
+ * A signed DTO's `dtoExpiresAt`, checked: a JS number that is a safe integer of epoch
3055
+ * MILLISECONDS, greater than zero. Returned unchanged, so the signed value is the one given.
3056
+ *
3057
+ * Chain semantics (`@GalaTransaction`, before authorization): the chain refuses the DTO with
3058
+ * `ExpiredError` when `dto.dtoExpiresAt && dto.dtoExpiresAt < Date.now()` (its own clock, strict
3059
+ * less-than: a DTO is still accepted in the millisecond it expires). A falsy value is no expiry at
3060
+ * all, so `0` is refused here rather than signed as one. A DTO without the field stays valid on
3061
+ * chain: the field is optional and additive.
3062
+ *
3063
+ * This checks the field only; it applies no window against a clock (the wallet builder in
3064
+ * `@gala-games/wallet-core` adds the 60 s quote window and refuses an expired deadline).
3065
+ *
3066
+ * @throws GalaSDKError `INVALID_DTO_EXPIRES_AT` (`reason` `not_a_safe_integer` or `not_positive`,
3067
+ * `field` = `field`).
3068
+ */
3069
+ export declare function checkDtoExpiresAt(value: unknown, field?: string): number;
3070
+ //#endregion
3071
+ //#region src/writes/token_ref.d.ts
3072
+ /**
3073
+ * The quantity of a write: whole tokens as a plain decimal string greater than zero (never scaled
3074
+ * to base units), returned in the chain's canonical spelling, `new BigNumber(value).toFixed()`.
3075
+ * The chain's DTO classes (`@BigNumberProperty` + `IsBigNumber`) refuse every other spelling of
3076
+ * the same number, so `"1.50"` is signed as `"1.5"`, `"5.0"` as `"5"` and `"01"` as `"1"`: the
3077
+ * amount the caller passed, in the bytes the chain can execute. A JS number is refused: it may
3078
+ * already have lost digits (`0.1 + 0.2`), and the chain receives strings.
3079
+ *
3080
+ * @throws GalaSDKError `INVALID_QUANTITY` (`params.value` is `[redacted]`: the input is never
3081
+ * echoed).
3082
+ */
3083
+ export declare function writeQuantity(value: unknown, field: string): string;
3084
+ //#endregion
2992
3085
  //#region src/reads/types.d.ts
2993
3086
  /**
2994
3087
  * The contract methods `GatewayReads` calls, as a closed set: the token-contract reads, and
@@ -3489,5 +3582,5 @@ export declare function walletDeclineCode(value: unknown): number | string | und
3489
3582
  */
3490
3583
  export declare const GALA_CORE_SDK_VERSION: string;
3491
3584
  //#endregion
3492
- export type { AllPagesOptions, BalancesFilter, BridgeAmountProblem, BridgeDepositStep, BridgeNetwork, BridgeOutStep, BurnTokensInput, ChainContractPath, ClaimNftCollectionInput, ClaimNftCollectionReceipt, CreateNftCollectionInput, CreateNftCollectionReceipt, EIP712DomainValue, EIP712Types, ErrorParamsOf, EstimateNftFeesParams, FailureOutcome, FailureView, FetchNftTokenClassesParams, GalaChainEnv, GalaChainEnvironmentConfig, GalaChainNftCollectionAuthorization, GalaChainPage, GalaChainPublicKey, GalaChainTokenBalance, GalaChainTokenBalanceSummary, GalaChainTokenClass, GalaChainTokenDetails, GalaChainTokenHold, GalaChainTokenInstanceKey, GalaErrorCatalogEntry, GalaErrorCode, GalaErrorParamKind, GalaErrorParams, GalaErrorPhase, GalaErrorShape, GatewayReadMethod, GatewayReadsOption, GatewayReadsOptions, GatewayWriteMethod, GatewayWriteOutcomeUnknownReason, GatewayWriteReceipt, GatewayWritesOption, GatewayWritesOptions, GeneratedWallet, InvalidNftInputReason, InvalidPrivateKeyReason, InvalidTokenReferenceReason, LockTokensInput, MintNftInput, MintNftReceipt, NftBalance, NftCollectionAuthorization, NftFeeBreakdown, NftFeeEstimate, NftFeeQuote, NftFeeReceipt, NftFeeRequest, NftTokenClassInput, NftTokenClassWithSupply, NftWriteMethod, PageInput, PageRequestField, PersonalSignChainDtoPayload, PrivateKeyInput, PublicKeyResult, RequestHeaderParts, RequestKind, SigningFailureReason, TokenBalanceInput, TokenClassKeyInput, TokenClassesFilter, TokenNameResolver, TokenQuantityInput, TransferGalaInput, TransferTokenInput, TypedDataPayload, UnlockTokensInput, WalletConnectionFailureReason, WalletInputProblem, WalletInputValidation, WalletNotConnectedReason, WalletProviderConfigMissing, WrapDirection, WrapRefusalReason, WriteKeyInput, WriteReceipt };
3585
+ export type { AllPagesOptions, BalancesFilter, BridgeAmountProblem, BridgeDepositStep, BridgeNetwork, BridgeOutStep, BurnTokensInput, ChainContractPath, ClaimNftCollectionInput, ClaimNftCollectionReceipt, CreateNftCollectionInput, CreateNftCollectionReceipt, DtoExpiresAtInput, EIP712DomainValue, EIP712Types, ErrorParamsOf, EstimateNftFeesParams, FailureOutcome, FailureView, FetchNftTokenClassesParams, GalaChainEnv, GalaChainEnvironmentConfig, GalaChainNftCollectionAuthorization, GalaChainPage, GalaChainPublicKey, GalaChainTokenBalance, GalaChainTokenBalanceSummary, GalaChainTokenClass, GalaChainTokenDetails, GalaChainTokenHold, GalaChainTokenInstanceKey, GalaErrorCatalogEntry, GalaErrorCode, GalaErrorParamKind, GalaErrorParams, GalaErrorPhase, GalaErrorShape, GatewayReadMethod, GatewayReadsOption, GatewayReadsOptions, GatewayWriteMethod, GatewayWriteOutcomeUnknownReason, GatewayWriteReceipt, GatewayWritesOption, GatewayWritesOptions, GeneratedWallet, InvalidDtoExpiresAtReason, InvalidNftInputReason, InvalidPrivateKeyReason, InvalidTokenReferenceReason, LockTokensInput, MintNftInput, MintNftReceipt, NftBalance, NftCollectionAuthorization, NftFeeBreakdown, NftFeeEstimate, NftFeeQuote, NftFeeReceipt, NftFeeRequest, NftTokenClassInput, NftTokenClassWithSupply, NftWriteMethod, PageInput, PageRequestField, PersonalSignChainDtoPayload, PrivateKeyInput, PublicKeyResult, RequestHeaderParts, RequestKind, SigningFailureReason, TokenBalanceInput, TokenClassKeyInput, TokenClassesFilter, TokenNameResolver, TokenQuantityInput, TransferGalaInput, TransferTokenInput, TypedDataPayload, UnlockTokensInput, WalletConnectionFailureReason, WalletInputProblem, WalletInputValidation, WalletNotConnectedReason, WalletProviderConfigMissing, WrapDirection, WrapRefusalReason, WriteKeyInput, WriteReceipt };
3493
3586
  //# sourceMappingURL=index.d.cts.map
package/dist/index.d.ts CHANGED
@@ -96,6 +96,24 @@ type InvalidTokenReferenceReason = (typeof INVALID_TOKEN_REFERENCE_REASONS)[numb
96
96
  export declare const INVALID_NFT_INPUT_REASONS: readonly ['not_a_string', 'empty', 'bad_characters', 'not_a_positive_whole_number', 'above_mint_limit', 'bad_public_key', 'bad_authorities', 'bad_collection_name'];
97
97
  /** One member of {@link INVALID_NFT_INPUT_REASONS}. */
98
98
  type InvalidNftInputReason = (typeof INVALID_NFT_INPUT_REASONS)[number];
99
+ /**
100
+ * Why a signed DTO's expiry is refused (`INVALID_DTO_EXPIRES_AT.params.reason`). A token for the
101
+ * app to map to its own text.
102
+ *
103
+ * - `not_a_safe_integer`: not a JS number that is a safe integer (`NaN`, `Infinity`, a fraction, a
104
+ * string, a bigint, a value beyond `Number.MAX_SAFE_INTEGER`).
105
+ * - `not_positive`: `0` or below. The chain reads a falsy `dtoExpiresAt` as "no expiry", so `0`
106
+ * is never signed as one.
107
+ * - `expired`: the deadline is not after the builder's clock (a wallet builder refuses to sign a
108
+ * DTO the chain would already refuse or refuse within the same millisecond).
109
+ * - `expiry_window`: the deadline is more than the wallet builder's window ahead of its clock, or
110
+ * an `expiresInMs` outside that window.
111
+ * - `bad_shape`: a wallet builder expiry that is not exactly one of `{ dtoExpiresAt }` or
112
+ * `{ expiresInMs, nowMs }` (never guessed between them).
113
+ */
114
+ export declare const INVALID_DTO_EXPIRES_AT_REASONS: readonly ['not_a_safe_integer', 'not_positive', 'expired', 'expiry_window', 'bad_shape'];
115
+ /** One member of {@link INVALID_DTO_EXPIRES_AT_REASONS}. */
116
+ type InvalidDtoExpiresAtReason = (typeof INVALID_DTO_EXPIRES_AT_REASONS)[number];
99
117
  /**
100
118
  * The `GatewayWrites` options that are refused when missing or of the wrong type
101
119
  * (`INVALID_WRITES_OPTION.params.option`). `walletAddress`, `requestTimeoutMs` and
@@ -621,6 +639,21 @@ export declare const GALA_ERROR_CATALOG: {
621
639
  readonly value: 'string';
622
640
  };
623
641
  };
642
+ readonly INVALID_DTO_EXPIRES_AT: {
643
+ readonly phase: 'pre_send';
644
+ readonly template: 'Invalid {field}: {reason}.';
645
+ readonly params: {
646
+ readonly field: 'string';
647
+ readonly reason: readonly ["not_a_safe_integer", "not_positive", "expired", "expiry_window", "bad_shape"];
648
+ };
649
+ };
650
+ readonly INVALID_CONTRACT_PATH: {
651
+ readonly phase: 'pre_send';
652
+ readonly template: 'Invalid {field}: it names no contract this SDK knows a dtoOperation for; nothing was signed.';
653
+ readonly params: {
654
+ readonly field: 'string';
655
+ };
656
+ };
624
657
  readonly INVALID_LOCK_NAME: {
625
658
  readonly phase: 'pre_send';
626
659
  readonly template: 'The lock name must be a string (got a {valueType}).';
@@ -1022,6 +1055,8 @@ export declare const GALA_ERROR_PHASE_BY_CODE: {
1022
1055
  readonly INVALID_TOKEN_REFERENCE: 'pre_send';
1023
1056
  readonly INVALID_TOKEN_BATCH: 'pre_send';
1024
1057
  readonly INVALID_LOCK_EXPIRES: 'pre_send';
1058
+ readonly INVALID_DTO_EXPIRES_AT: 'pre_send';
1059
+ readonly INVALID_CONTRACT_PATH: 'pre_send';
1025
1060
  readonly INVALID_LOCK_NAME: 'pre_send';
1026
1061
  readonly INVALID_NFT_INPUT: 'pre_send';
1027
1062
  readonly NO_TOKEN_NAME_RESOLVER: 'pre_send';
@@ -1898,6 +1933,15 @@ export declare const CHAIN_METHOD_OPERATIONS: {
1898
1933
  };
1899
1934
  /** An API path of a GalaChain contract (`asset/token-contract`, `asset/dex-contract`, ...). */
1900
1935
  type ChainContractPath = keyof typeof CHAIN_CONTRACT_OPERATION_PREFIXES;
1936
+ /**
1937
+ * `value` as a {@link ChainContractPath}: a string naming a contract in the operation table (an
1938
+ * own key, so `toString` or a polluted prototype never counts). Checked before anything is built
1939
+ * or signed.
1940
+ *
1941
+ * @throws GalaSDKError `INVALID_CONTRACT_PATH` (`params.field` = `field`; the value is never
1942
+ * echoed).
1943
+ */
1944
+ export declare function checkContractPath(value: unknown, field: string): ChainContractPath;
1901
1945
  /**
1902
1946
  * The `dtoOperation` of `method` on the contract served at `contractPath`: the chain's own
1903
1947
  * (`CHAIN_METHOD_OPERATIONS`) where it deviates from the platform table, else the table's prefix plus `:<method>`.
@@ -2610,8 +2654,8 @@ interface TokenQuantityInput {
2610
2654
  tokenName?: string | undefined;
2611
2655
  /**
2612
2656
  * The amount in WHOLE tokens, as the decimal string the chain is to receive (`"1.5"` is one and a
2613
- * half tokens). It is signed exactly as written: never scaled to base units, never re-formatted
2614
- * (`"1.50"` stays `"1.50"`).
2657
+ * half tokens). Never scaled to base units; signed in the chain's canonical spelling
2658
+ * (`BigNumber#toFixed()`: `"1.50"` is signed `"1.5"`), the only one the chain's DTO classes accept.
2615
2659
  */
2616
2660
  quantity: string;
2617
2661
  }
@@ -2623,8 +2667,21 @@ interface WriteKeyInput {
2623
2667
  */
2624
2668
  uniqueKey?: string | undefined;
2625
2669
  }
2670
+ /** The optional signed expiry of a transfer. */
2671
+ interface DtoExpiresAtInput {
2672
+ /**
2673
+ * When the chain stops accepting this signed DTO, in epoch MILLISECONDS: a safe integer above
2674
+ * zero (`INVALID_DTO_EXPIRES_AT` otherwise). It is part of the signed bytes, so it cannot be
2675
+ * removed or changed without invalidating the signature; the chain refuses the DTO once
2676
+ * `dtoExpiresAt < Date.now()` on its own clock. Omitted: no field, and the DTO is byte-for-byte
2677
+ * what it was before this option existed (the chain then applies no expiry). The SDK signs the
2678
+ * value as given and applies no window: a wallet derives it from its quote (`expiresAtMs`)
2679
+ * through `@gala-games/wallet-core`'s `buildTransferTokenDto`, which bounds it to 60 s.
2680
+ */
2681
+ dtoExpiresAt?: number | undefined;
2682
+ }
2626
2683
  /** `transferGala`: GALA (`GALA|Unit|none|none`, instance `"0"`) to a recipient. */
2627
- interface TransferGalaInput extends WriteKeyInput {
2684
+ interface TransferGalaInput extends WriteKeyInput, DtoExpiresAtInput {
2628
2685
  /**
2629
2686
  * The recipient: an Ethereum account (`eth|<40 hex>`, `0x<40 hex>` or `<40 hex>`, any casing
2630
2687
  * but a wrong EIP-55 checksum; always sent as `eth|<checksummed>`), or a `client|` alias (sent
@@ -2636,7 +2693,7 @@ interface TransferGalaInput extends WriteKeyInput {
2636
2693
  quantity: string;
2637
2694
  }
2638
2695
  /** `transferToken`: one token to a recipient. */
2639
- interface TransferTokenInput extends TokenQuantityInput, WriteKeyInput {
2696
+ interface TransferTokenInput extends TokenQuantityInput, WriteKeyInput, DtoExpiresAtInput {
2640
2697
  /** The recipient (see {@link TransferGalaInput.to}). */
2641
2698
  to: string;
2642
2699
  }
@@ -2846,7 +2903,7 @@ type NftFeeRequest = ({
2846
2903
  * the quantity, the `uniqueKey`, the batch), so a refused input costs no signature and no request.
2847
2904
  * The DTO is plain JSON with exactly the chain's fields; the signer signs it as it is (nothing,
2848
2905
  * least of all a signer hint, is added) and the body sent is what the signer returned. Quantities
2849
- * are whole tokens and are signed exactly as written.
2906
+ * are whole tokens, signed in the chain's canonical spelling (`writeQuantity`: `"1.50"` as `"1.5"`).
2850
2907
  *
2851
2908
  * @example
2852
2909
  * ```ts
@@ -2873,9 +2930,12 @@ export declare class GatewayWrites {
2873
2930
  /**
2874
2931
  * Transfer GALA (`GALA|Unit|none|none`, instance `"0"`) to `to`.
2875
2932
  *
2933
+ * `input.dtoExpiresAt` (optional, epoch ms) is signed into the DTO when given; see
2934
+ * `DtoExpiresAtInput.dtoExpiresAt`.
2935
+ *
2876
2936
  * @throws GalaSDKError pre-send: `INVALID_WALLET_ADDRESS`, `INVALID_QUANTITY`,
2877
- * `INVALID_UNIQUE_KEY`, `SIGNING_FAILED`; in flight: `GATEWAY_WRITE_OUTCOME_UNKNOWN` (check
2878
- * `error.uniqueKey`; never resend under a fresh key);
2937
+ * `INVALID_DTO_EXPIRES_AT`, `INVALID_UNIQUE_KEY`, `SIGNING_FAILED`; in flight:
2938
+ * `GATEWAY_WRITE_OUTCOME_UNKNOWN` (check `error.uniqueKey`; never resend under a fresh key);
2879
2939
  * post-send: `GATEWAY_WRITE_REJECTED`, `GATEWAY_HTTP_ERROR`, `GATEWAY_RESPONSE_INVALID`.
2880
2940
  */
2881
2941
  transferGala(input: TransferGalaInput): Promise<GatewayWriteReceipt>;
@@ -2989,6 +3049,39 @@ export declare function galaChainUserRef(value: unknown, field: string): string;
2989
3049
  /** GALA's class key: what `transferGala` moves. */
2990
3050
  export declare const GALA_TOKEN_CLASS_KEY: Readonly<GalaChainTokenClassKey>;
2991
3051
  //#endregion
3052
+ //#region src/writes/dto_expiry.d.ts
3053
+ /**
3054
+ * A signed DTO's `dtoExpiresAt`, checked: a JS number that is a safe integer of epoch
3055
+ * MILLISECONDS, greater than zero. Returned unchanged, so the signed value is the one given.
3056
+ *
3057
+ * Chain semantics (`@GalaTransaction`, before authorization): the chain refuses the DTO with
3058
+ * `ExpiredError` when `dto.dtoExpiresAt && dto.dtoExpiresAt < Date.now()` (its own clock, strict
3059
+ * less-than: a DTO is still accepted in the millisecond it expires). A falsy value is no expiry at
3060
+ * all, so `0` is refused here rather than signed as one. A DTO without the field stays valid on
3061
+ * chain: the field is optional and additive.
3062
+ *
3063
+ * This checks the field only; it applies no window against a clock (the wallet builder in
3064
+ * `@gala-games/wallet-core` adds the 60 s quote window and refuses an expired deadline).
3065
+ *
3066
+ * @throws GalaSDKError `INVALID_DTO_EXPIRES_AT` (`reason` `not_a_safe_integer` or `not_positive`,
3067
+ * `field` = `field`).
3068
+ */
3069
+ export declare function checkDtoExpiresAt(value: unknown, field?: string): number;
3070
+ //#endregion
3071
+ //#region src/writes/token_ref.d.ts
3072
+ /**
3073
+ * The quantity of a write: whole tokens as a plain decimal string greater than zero (never scaled
3074
+ * to base units), returned in the chain's canonical spelling, `new BigNumber(value).toFixed()`.
3075
+ * The chain's DTO classes (`@BigNumberProperty` + `IsBigNumber`) refuse every other spelling of
3076
+ * the same number, so `"1.50"` is signed as `"1.5"`, `"5.0"` as `"5"` and `"01"` as `"1"`: the
3077
+ * amount the caller passed, in the bytes the chain can execute. A JS number is refused: it may
3078
+ * already have lost digits (`0.1 + 0.2`), and the chain receives strings.
3079
+ *
3080
+ * @throws GalaSDKError `INVALID_QUANTITY` (`params.value` is `[redacted]`: the input is never
3081
+ * echoed).
3082
+ */
3083
+ export declare function writeQuantity(value: unknown, field: string): string;
3084
+ //#endregion
2992
3085
  //#region src/reads/types.d.ts
2993
3086
  /**
2994
3087
  * The contract methods `GatewayReads` calls, as a closed set: the token-contract reads, and
@@ -3489,5 +3582,5 @@ export declare function walletDeclineCode(value: unknown): number | string | und
3489
3582
  */
3490
3583
  export declare const GALA_CORE_SDK_VERSION: string;
3491
3584
  //#endregion
3492
- export type { AllPagesOptions, BalancesFilter, BridgeAmountProblem, BridgeDepositStep, BridgeNetwork, BridgeOutStep, BurnTokensInput, ChainContractPath, ClaimNftCollectionInput, ClaimNftCollectionReceipt, CreateNftCollectionInput, CreateNftCollectionReceipt, EIP712DomainValue, EIP712Types, ErrorParamsOf, EstimateNftFeesParams, FailureOutcome, FailureView, FetchNftTokenClassesParams, GalaChainEnv, GalaChainEnvironmentConfig, GalaChainNftCollectionAuthorization, GalaChainPage, GalaChainPublicKey, GalaChainTokenBalance, GalaChainTokenBalanceSummary, GalaChainTokenClass, GalaChainTokenDetails, GalaChainTokenHold, GalaChainTokenInstanceKey, GalaErrorCatalogEntry, GalaErrorCode, GalaErrorParamKind, GalaErrorParams, GalaErrorPhase, GalaErrorShape, GatewayReadMethod, GatewayReadsOption, GatewayReadsOptions, GatewayWriteMethod, GatewayWriteOutcomeUnknownReason, GatewayWriteReceipt, GatewayWritesOption, GatewayWritesOptions, GeneratedWallet, InvalidNftInputReason, InvalidPrivateKeyReason, InvalidTokenReferenceReason, LockTokensInput, MintNftInput, MintNftReceipt, NftBalance, NftCollectionAuthorization, NftFeeBreakdown, NftFeeEstimate, NftFeeQuote, NftFeeReceipt, NftFeeRequest, NftTokenClassInput, NftTokenClassWithSupply, NftWriteMethod, PageInput, PageRequestField, PersonalSignChainDtoPayload, PrivateKeyInput, PublicKeyResult, RequestHeaderParts, RequestKind, SigningFailureReason, TokenBalanceInput, TokenClassKeyInput, TokenClassesFilter, TokenNameResolver, TokenQuantityInput, TransferGalaInput, TransferTokenInput, TypedDataPayload, UnlockTokensInput, WalletConnectionFailureReason, WalletInputProblem, WalletInputValidation, WalletNotConnectedReason, WalletProviderConfigMissing, WrapDirection, WrapRefusalReason, WriteKeyInput, WriteReceipt };
3585
+ export type { AllPagesOptions, BalancesFilter, BridgeAmountProblem, BridgeDepositStep, BridgeNetwork, BridgeOutStep, BurnTokensInput, ChainContractPath, ClaimNftCollectionInput, ClaimNftCollectionReceipt, CreateNftCollectionInput, CreateNftCollectionReceipt, DtoExpiresAtInput, EIP712DomainValue, EIP712Types, ErrorParamsOf, EstimateNftFeesParams, FailureOutcome, FailureView, FetchNftTokenClassesParams, GalaChainEnv, GalaChainEnvironmentConfig, GalaChainNftCollectionAuthorization, GalaChainPage, GalaChainPublicKey, GalaChainTokenBalance, GalaChainTokenBalanceSummary, GalaChainTokenClass, GalaChainTokenDetails, GalaChainTokenHold, GalaChainTokenInstanceKey, GalaErrorCatalogEntry, GalaErrorCode, GalaErrorParamKind, GalaErrorParams, GalaErrorPhase, GalaErrorShape, GatewayReadMethod, GatewayReadsOption, GatewayReadsOptions, GatewayWriteMethod, GatewayWriteOutcomeUnknownReason, GatewayWriteReceipt, GatewayWritesOption, GatewayWritesOptions, GeneratedWallet, InvalidDtoExpiresAtReason, InvalidNftInputReason, InvalidPrivateKeyReason, InvalidTokenReferenceReason, LockTokensInput, MintNftInput, MintNftReceipt, NftBalance, NftCollectionAuthorization, NftFeeBreakdown, NftFeeEstimate, NftFeeQuote, NftFeeReceipt, NftFeeRequest, NftTokenClassInput, NftTokenClassWithSupply, NftWriteMethod, PageInput, PageRequestField, PersonalSignChainDtoPayload, PrivateKeyInput, PublicKeyResult, RequestHeaderParts, RequestKind, SigningFailureReason, TokenBalanceInput, TokenClassKeyInput, TokenClassesFilter, TokenNameResolver, TokenQuantityInput, TransferGalaInput, TransferTokenInput, TypedDataPayload, UnlockTokensInput, WalletConnectionFailureReason, WalletInputProblem, WalletInputValidation, WalletNotConnectedReason, WalletProviderConfigMissing, WrapDirection, WrapRefusalReason, WriteKeyInput, WriteReceipt };
3493
3586
  //# sourceMappingURL=index.d.ts.map
package/dist/index.mjs CHANGED
@@ -70,6 +70,28 @@ const INVALID_NFT_INPUT_REASONS = [
70
70
  "bad_collection_name"
71
71
  ];
72
72
  /**
73
+ * Why a signed DTO's expiry is refused (`INVALID_DTO_EXPIRES_AT.params.reason`). A token for the
74
+ * app to map to its own text.
75
+ *
76
+ * - `not_a_safe_integer`: not a JS number that is a safe integer (`NaN`, `Infinity`, a fraction, a
77
+ * string, a bigint, a value beyond `Number.MAX_SAFE_INTEGER`).
78
+ * - `not_positive`: `0` or below. The chain reads a falsy `dtoExpiresAt` as "no expiry", so `0`
79
+ * is never signed as one.
80
+ * - `expired`: the deadline is not after the builder's clock (a wallet builder refuses to sign a
81
+ * DTO the chain would already refuse or refuse within the same millisecond).
82
+ * - `expiry_window`: the deadline is more than the wallet builder's window ahead of its clock, or
83
+ * an `expiresInMs` outside that window.
84
+ * - `bad_shape`: a wallet builder expiry that is not exactly one of `{ dtoExpiresAt }` or
85
+ * `{ expiresInMs, nowMs }` (never guessed between them).
86
+ */
87
+ const INVALID_DTO_EXPIRES_AT_REASONS = [
88
+ "not_a_safe_integer",
89
+ "not_positive",
90
+ "expired",
91
+ "expiry_window",
92
+ "bad_shape"
93
+ ];
94
+ /**
73
95
  * The `GatewayWrites` options that are refused when missing or of the wrong type
74
96
  * (`INVALID_WRITES_OPTION.params.option`). `walletAddress`, `requestTimeoutMs` and
75
97
  * `uniqueKeyPrefix` have codes of their own (`INVALID_WALLET_ADDRESS`, `INVALID_TIMEOUT`,
@@ -545,6 +567,19 @@ const GALA_ERROR_CATALOG = {
545
567
  template: "expires must be a non-negative whole number of epoch milliseconds, 0 for none (got {value}).",
546
568
  params: { value: "string" }
547
569
  },
570
+ INVALID_DTO_EXPIRES_AT: {
571
+ phase: "pre_send",
572
+ template: "Invalid {field}: {reason}.",
573
+ params: {
574
+ field: "string",
575
+ reason: INVALID_DTO_EXPIRES_AT_REASONS
576
+ }
577
+ },
578
+ INVALID_CONTRACT_PATH: {
579
+ phase: "pre_send",
580
+ template: "Invalid {field}: it names no contract this SDK knows a dtoOperation for; nothing was signed.",
581
+ params: { field: "string" }
582
+ },
548
583
  INVALID_LOCK_NAME: {
549
584
  phase: "pre_send",
550
585
  template: "The lock name must be a string (got a {valueType}).",
@@ -908,6 +943,8 @@ const GALA_ERROR_PHASE_BY_CODE = {
908
943
  INVALID_TOKEN_REFERENCE: "pre_send",
909
944
  INVALID_TOKEN_BATCH: "pre_send",
910
945
  INVALID_LOCK_EXPIRES: "pre_send",
946
+ INVALID_DTO_EXPIRES_AT: "pre_send",
947
+ INVALID_CONTRACT_PATH: "pre_send",
911
948
  INVALID_LOCK_NAME: "pre_send",
912
949
  INVALID_NFT_INPUT: "pre_send",
913
950
  NO_TOKEN_NAME_RESOLVER: "pre_send",
@@ -1281,7 +1318,7 @@ function galaChainUserRef(value, field) {
1281
1318
  }
1282
1319
  throw new GalaSDKError("INVALID_WALLET_ADDRESS", {
1283
1320
  field,
1284
- value: String(value)
1321
+ value: "[redacted]"
1285
1322
  });
1286
1323
  }
1287
1324
 
@@ -2675,6 +2712,18 @@ const CHAIN_METHOD_OPERATIONS = {
2675
2712
  "asset/bridge-contract:GrantAllowance": "asset-channel_bridge-chaincode_GalaChainToken:GrantAllowance"
2676
2713
  };
2677
2714
  /**
2715
+ * `value` as a {@link ChainContractPath}: a string naming a contract in the operation table (an
2716
+ * own key, so `toString` or a polluted prototype never counts). Checked before anything is built
2717
+ * or signed.
2718
+ *
2719
+ * @throws GalaSDKError `INVALID_CONTRACT_PATH` (`params.field` = `field`; the value is never
2720
+ * echoed).
2721
+ */
2722
+ function checkContractPath(value, field) {
2723
+ if (typeof value === "string" && Object.prototype.hasOwnProperty.call(CHAIN_CONTRACT_OPERATION_PREFIXES, value)) return value;
2724
+ throw new GalaSDKError("INVALID_CONTRACT_PATH", { field });
2725
+ }
2726
+ /**
2678
2727
  * The `dtoOperation` of `method` on the contract served at `contractPath`: the chain's own
2679
2728
  * (`CHAIN_METHOD_OPERATIONS`) where it deviates from the platform table, else the table's prefix plus `:<method>`.
2680
2729
  *
@@ -2904,7 +2953,7 @@ async function signPreSendFor(signer, contractPath, method, dto) {
2904
2953
  * fallback. It is the version in the default `User-Agent` (`GalaChain-SDK/<version>`) of every SDK
2905
2954
  * request, whichever product SDK sends it.
2906
2955
  */
2907
- const GALA_CORE_SDK_VERSION = "1.2.1";
2956
+ const GALA_CORE_SDK_VERSION = "1.3.0-rc.0";
2908
2957
 
2909
2958
  //#endregion
2910
2959
  //#region src/utils/transport.ts
@@ -2965,7 +3014,7 @@ function buildRequestHeaders(wire, parts = {}) {
2965
3014
  entries.set(name.toLowerCase(), [name, value]);
2966
3015
  }
2967
3016
  };
2968
- if ((wire === null || wire === void 0 ? void 0 : wire.userAgent) !== false) put({ "User-Agent": (wire === null || wire === void 0 ? void 0 : wire.userAgent) ?? `GalaChain-SDK/${"1.2.1"}` });
3017
+ if ((wire === null || wire === void 0 ? void 0 : wire.userAgent) !== false) put({ "User-Agent": (wire === null || wire === void 0 ? void 0 : wire.userAgent) ?? `GalaChain-SDK/${"1.3.0-rc.0"}` });
2969
3018
  put(parts.defaults);
2970
3019
  put(wire === null || wire === void 0 ? void 0 : wire.headers);
2971
3020
  if (parts.json === true && !entries.has("content-type")) put({ "Content-Type": "application/json" });
@@ -3745,6 +3794,36 @@ function getEthereumAddressFromPrivateKey(privateKey) {
3745
3794
  }
3746
3795
  }
3747
3796
 
3797
+ //#endregion
3798
+ //#region src/writes/dto_expiry.ts
3799
+ /**
3800
+ * A signed DTO's `dtoExpiresAt`, checked: a JS number that is a safe integer of epoch
3801
+ * MILLISECONDS, greater than zero. Returned unchanged, so the signed value is the one given.
3802
+ *
3803
+ * Chain semantics (`@GalaTransaction`, before authorization): the chain refuses the DTO with
3804
+ * `ExpiredError` when `dto.dtoExpiresAt && dto.dtoExpiresAt < Date.now()` (its own clock, strict
3805
+ * less-than: a DTO is still accepted in the millisecond it expires). A falsy value is no expiry at
3806
+ * all, so `0` is refused here rather than signed as one. A DTO without the field stays valid on
3807
+ * chain: the field is optional and additive.
3808
+ *
3809
+ * This checks the field only; it applies no window against a clock (the wallet builder in
3810
+ * `@gala-games/wallet-core` adds the 60 s quote window and refuses an expired deadline).
3811
+ *
3812
+ * @throws GalaSDKError `INVALID_DTO_EXPIRES_AT` (`reason` `not_a_safe_integer` or `not_positive`,
3813
+ * `field` = `field`).
3814
+ */
3815
+ function checkDtoExpiresAt(value, field = "dtoExpiresAt") {
3816
+ if (typeof value !== "number" || !Number.isSafeInteger(value)) throw new GalaSDKError("INVALID_DTO_EXPIRES_AT", {
3817
+ field,
3818
+ reason: "not_a_safe_integer"
3819
+ });
3820
+ if (value <= 0) throw new GalaSDKError("INVALID_DTO_EXPIRES_AT", {
3821
+ field,
3822
+ reason: "not_positive"
3823
+ });
3824
+ return value;
3825
+ }
3826
+
3748
3827
  //#endregion
3749
3828
  //#region src/writes/lock.ts
3750
3829
  /**
@@ -4372,20 +4451,33 @@ async function quoteNftFee(transport, uniqueKeyPrefix, callerPublicKey, method,
4372
4451
  //#region src/writes/token_ref.ts
4373
4452
  /** A plain decimal: digits, optionally a fraction. No sign, exponent, hex, spaces or separators. */
4374
4453
  const DECIMAL = /^[0-9]+(?:\.[0-9]+)?$/u;
4375
- const INSTANCE = /^[0-9]+$/u;
4376
4454
  /**
4377
- * The quantity of a write, exactly as the caller wrote it: whole tokens as a plain decimal string
4378
- * greater than zero. It is returned unchanged (never scaled to base units, never re-formatted), so
4379
- * the signed amount is the amount the caller passed. A JS number is refused: it may already have
4380
- * lost digits (`0.1 + 0.2`), and the chain receives strings.
4455
+ * A token instance in the one spelling the chain's `TokenInstanceKey` (`@BigNumberProperty`)
4456
+ * accepts: a whole number with no leading zeros (`0`, `7`; never `007` or `00`). Not rewritten:
4457
+ * an instance names one token, so a spelling the chain would refuse is refused here.
4458
+ */
4459
+ const INSTANCE = /^(?:0|[1-9][0-9]*)$/u;
4460
+ /** What the quantity error reports instead of the supplied value: errors never echo input. */
4461
+ const REDACTED = "[redacted]";
4462
+ /**
4463
+ * The quantity of a write: whole tokens as a plain decimal string greater than zero (never scaled
4464
+ * to base units), returned in the chain's canonical spelling, `new BigNumber(value).toFixed()`.
4465
+ * The chain's DTO classes (`@BigNumberProperty` + `IsBigNumber`) refuse every other spelling of
4466
+ * the same number, so `"1.50"` is signed as `"1.5"`, `"5.0"` as `"5"` and `"01"` as `"1"`: the
4467
+ * amount the caller passed, in the bytes the chain can execute. A JS number is refused: it may
4468
+ * already have lost digits (`0.1 + 0.2`), and the chain receives strings.
4381
4469
  *
4382
- * @throws GalaSDKError `INVALID_QUANTITY`.
4470
+ * @throws GalaSDKError `INVALID_QUANTITY` (`params.value` is `[redacted]`: the input is never
4471
+ * echoed).
4383
4472
  */
4384
4473
  function writeQuantity(value, field) {
4385
- if (typeof value === "string" && DECIMAL.test(value) && new BigNumber(value).isGreaterThan(0)) return value;
4474
+ if (typeof value === "string" && DECIMAL.test(value)) {
4475
+ const amount = new BigNumber(value);
4476
+ if (amount.isGreaterThan(0)) return amount.toFixed();
4477
+ }
4386
4478
  throw new GalaSDKError("INVALID_QUANTITY", {
4387
4479
  field,
4388
- value: String(value)
4480
+ value: REDACTED
4389
4481
  });
4390
4482
  }
4391
4483
  /**
@@ -4509,16 +4601,19 @@ const GALA_TOKEN_CLASS_KEY = Object.freeze({
4509
4601
  });
4510
4602
  /**
4511
4603
  * The unsigned `TransferToken` DTO: plain JSON, exactly the fields the chain signs, in the order
4512
- * the gateway has always received them (`from, to, quantity, tokenInstance, uniqueKey`). No signer
4513
- * field is ever added: the chain recovers the signer from the signature.
4604
+ * the gateway has always received them (`from, to, quantity, tokenInstance, uniqueKey`), then
4605
+ * `dtoExpiresAt` only when one is given (absent: the DTO, its bytes and its signature are exactly
4606
+ * what they were before the field existed). No signer field is ever added: the chain recovers the
4607
+ * signer from the signature.
4514
4608
  */
4515
- function transferTokenDto(from, to, token, uniqueKey) {
4609
+ function transferTokenDto(from, to, token, uniqueKey, dtoExpiresAt) {
4516
4610
  return {
4517
4611
  from,
4518
4612
  to,
4519
4613
  quantity: token.quantity,
4520
4614
  tokenInstance: token.key,
4521
- uniqueKey
4615
+ uniqueKey,
4616
+ ...dtoExpiresAt === void 0 ? {} : { dtoExpiresAt }
4522
4617
  };
4523
4618
  }
4524
4619
  /** The unsigned `BurnTokens` DTO (`tokenInstances, uniqueKey`); burns are of the signer's own tokens. */
@@ -4559,7 +4654,7 @@ const DEFAULT_REQUEST_TIMEOUT_MS$1 = 3e4;
4559
4654
  * the quantity, the `uniqueKey`, the batch), so a refused input costs no signature and no request.
4560
4655
  * The DTO is plain JSON with exactly the chain's fields; the signer signs it as it is (nothing,
4561
4656
  * least of all a signer hint, is added) and the body sent is what the signer returned. Quantities
4562
- * are whole tokens and are signed exactly as written.
4657
+ * are whole tokens, signed in the chain's canonical spelling (`writeQuantity`: `"1.50"` as `"1.5"`).
4563
4658
  *
4564
4659
  * @example
4565
4660
  * ```ts
@@ -4602,9 +4697,12 @@ var GatewayWrites = class {
4602
4697
  /**
4603
4698
  * Transfer GALA (`GALA|Unit|none|none`, instance `"0"`) to `to`.
4604
4699
  *
4700
+ * `input.dtoExpiresAt` (optional, epoch ms) is signed into the DTO when given; see
4701
+ * `DtoExpiresAtInput.dtoExpiresAt`.
4702
+ *
4605
4703
  * @throws GalaSDKError pre-send: `INVALID_WALLET_ADDRESS`, `INVALID_QUANTITY`,
4606
- * `INVALID_UNIQUE_KEY`, `SIGNING_FAILED`; in flight: `GATEWAY_WRITE_OUTCOME_UNKNOWN` (check
4607
- * `error.uniqueKey`; never resend under a fresh key);
4704
+ * `INVALID_DTO_EXPIRES_AT`, `INVALID_UNIQUE_KEY`, `SIGNING_FAILED`; in flight:
4705
+ * `GATEWAY_WRITE_OUTCOME_UNKNOWN` (check `error.uniqueKey`; never resend under a fresh key);
4608
4706
  * post-send: `GATEWAY_WRITE_REJECTED`, `GATEWAY_HTTP_ERROR`, `GATEWAY_RESPONSE_INVALID`.
4609
4707
  */
4610
4708
  transferGala(input) {
@@ -4612,7 +4710,8 @@ var GatewayWrites = class {
4612
4710
  to: input.to,
4613
4711
  quantity: input.quantity,
4614
4712
  tokenClassKey: GALA_TOKEN_CLASS_KEY,
4615
- uniqueKey: input.uniqueKey
4713
+ uniqueKey: input.uniqueKey,
4714
+ dtoExpiresAt: input.dtoExpiresAt
4616
4715
  });
4617
4716
  }
4618
4717
  /**
@@ -4624,9 +4723,10 @@ var GatewayWrites = class {
4624
4723
  async transferToken(input) {
4625
4724
  const to = galaChainUserRef(input.to, "to");
4626
4725
  const checked = checkQuantity(input, "");
4726
+ const dtoExpiresAt = input.dtoExpiresAt === void 0 ? void 0 : checkDtoExpiresAt(input.dtoExpiresAt);
4627
4727
  const uniqueKey = this.uniqueKeyOf(input.uniqueKey);
4628
4728
  const token = await this.resolveOne(checked);
4629
- return this.submit("TransferToken", transferTokenDto(this.walletAddress, to, token, uniqueKey), uniqueKey);
4729
+ return this.submit("TransferToken", transferTokenDto(this.walletAddress, to, token, uniqueKey, dtoExpiresAt), uniqueKey);
4630
4730
  }
4631
4731
  /**
4632
4732
  * Burn 1 to 50 tokens of the writer's. IRREVERSIBLE: burned tokens are gone.
@@ -5518,5 +5618,5 @@ const GALA_CHAIN_ENVIRONMENTS = Object.freeze({
5518
5618
  });
5519
5619
 
5520
5620
  //#endregion
5521
- export { BRIDGE_AMOUNT_PROBLEMS, BRIDGE_DEPOSIT_STEPS, BRIDGE_NETWORKS, BRIDGE_OUT_STEPS, BrowserWalletSigner, CHAIN_CONTRACT_OPERATION_PREFIXES, CHAIN_METHOD_OPERATIONS, DEFAULT_UNIQUE_KEY_PREFIX, EIP712_CAPABLE_METHODS, FAILURE_OUTCOMES, GALA_CHAIN_ENVIRONMENTS, GALA_CORE_SDK_VERSION, GALA_ERROR_CATALOG, GALA_ERROR_PHASES, GALA_ERROR_PHASE_BY_CODE, GALA_TOKEN_CLASS_KEY, GATEWAY_READS_OPTIONS, GATEWAY_READ_LIMITS, GATEWAY_READ_METHODS, GATEWAY_WRITES_OPTIONS, GATEWAY_WRITE_BATCH_LIMITS, GATEWAY_WRITE_METHODS, GATEWAY_WRITE_OUTCOME_UNKNOWN_REASONS, GalaSDKError, GalaWalletSigner, GatewayReads, GatewayWrites, INVALID_NFT_INPUT_REASONS, INVALID_PRIVATE_KEY_REASONS, INVALID_TOKEN_REFERENCE_REASONS, NFT_DEFAULT_ADDITIONAL_KEY, NFT_MINT_LIMIT, NFT_WRITE_METHODS, NftCollectionReads, PAGE_REQUEST_FIELDS, PrivateKeySigner, SIGNING_FAILURE_REASONS, WALLET_CONNECTION_FAILURE_REASONS, WALLET_INPUT_PROBLEMS, WALLET_NOT_CONNECTED_REASONS, WALLET_PROVIDER_CONFIG_MISSING, WRAP_DIRECTIONS, WRAP_REFUSAL_REASONS, armTimeout, assertUniqueKey, buildEIP712Payload, buildQueryString, buildRequestHeaders, calculatePersonalSignPrefix, canonicalDecimalString, checksumEthereumAddress, compositeKeyOf, createLazyPrivateKeySigner, createUniqueKey, createWallet, dtoOperationOf, eip1193ProviderFromEthers, eip712DomainFor, estimateNftOperationFees, ethAddressOfPrivateKey, ethereumAddressOfAccount, fetchRequestor, fixpointPrefixFor, galaChainUserRef, galaErrorTemplates, generateEIP712Types, getEthereumAddressFromPrivateKey, getNftCollectionClaimFee, getNftTokenClassCreateFee, getPayloadToSign, getPublicKeyFromPrivateKey, hasGalaErrorBrand, hashTypedData, httpRequestorFromAxios, isFetchTransportFailure, isGalaCatalogCode, isGalaError, isGalaErrorLike, isTokenClassKey, isValidUniqueKey, isWalletUserRejection, isWriteView, normalizePrivateKey, numberParamOf, parseJson, personalSignPrefixFor, readBlockNumberHeader, readHeader, readResponseBody, readRetryAfter, renderGalaErrorTemplate, requestWithTimeout, resolvePersonalSignChainDtoPayload, resolveUniqueKeyPrefix, serialize, signChainDtoHash, signChainDtoNative, signChainDtoPersonalSign, signNative, signPersonalMessage, signPreSend, signPreSendFor, signRawObject, signSerializedNative, signTypedDataPayload, splitClassKey, stringParamOf, stripEip712DomainType, templatePlaceholders, toFailureView, tokenClassDollarKey, tokenDetailsOf, tryParseCompositeKey, tryParseTokenClassKey, validateTimeoutMs, validateWalletInput, walletDeclineCode, withDtoOperation, withGalaWalletIdentity, withPrivateKey };
5621
+ export { BRIDGE_AMOUNT_PROBLEMS, BRIDGE_DEPOSIT_STEPS, BRIDGE_NETWORKS, BRIDGE_OUT_STEPS, BrowserWalletSigner, CHAIN_CONTRACT_OPERATION_PREFIXES, CHAIN_METHOD_OPERATIONS, DEFAULT_UNIQUE_KEY_PREFIX, EIP712_CAPABLE_METHODS, FAILURE_OUTCOMES, GALA_CHAIN_ENVIRONMENTS, GALA_CORE_SDK_VERSION, GALA_ERROR_CATALOG, GALA_ERROR_PHASES, GALA_ERROR_PHASE_BY_CODE, GALA_TOKEN_CLASS_KEY, GATEWAY_READS_OPTIONS, GATEWAY_READ_LIMITS, GATEWAY_READ_METHODS, GATEWAY_WRITES_OPTIONS, GATEWAY_WRITE_BATCH_LIMITS, GATEWAY_WRITE_METHODS, GATEWAY_WRITE_OUTCOME_UNKNOWN_REASONS, GalaSDKError, GalaWalletSigner, GatewayReads, GatewayWrites, INVALID_DTO_EXPIRES_AT_REASONS, INVALID_NFT_INPUT_REASONS, INVALID_PRIVATE_KEY_REASONS, INVALID_TOKEN_REFERENCE_REASONS, NFT_DEFAULT_ADDITIONAL_KEY, NFT_MINT_LIMIT, NFT_WRITE_METHODS, NftCollectionReads, PAGE_REQUEST_FIELDS, PrivateKeySigner, SIGNING_FAILURE_REASONS, WALLET_CONNECTION_FAILURE_REASONS, WALLET_INPUT_PROBLEMS, WALLET_NOT_CONNECTED_REASONS, WALLET_PROVIDER_CONFIG_MISSING, WRAP_DIRECTIONS, WRAP_REFUSAL_REASONS, armTimeout, assertUniqueKey, buildEIP712Payload, buildQueryString, buildRequestHeaders, calculatePersonalSignPrefix, canonicalDecimalString, checkContractPath, checkDtoExpiresAt, checksumEthereumAddress, compositeKeyOf, createLazyPrivateKeySigner, createUniqueKey, createWallet, dtoOperationOf, eip1193ProviderFromEthers, eip712DomainFor, estimateNftOperationFees, ethAddressOfPrivateKey, ethereumAddressOfAccount, fetchRequestor, fixpointPrefixFor, galaChainUserRef, galaErrorTemplates, generateEIP712Types, getEthereumAddressFromPrivateKey, getNftCollectionClaimFee, getNftTokenClassCreateFee, getPayloadToSign, getPublicKeyFromPrivateKey, hasGalaErrorBrand, hashTypedData, httpRequestorFromAxios, isFetchTransportFailure, isGalaCatalogCode, isGalaError, isGalaErrorLike, isTokenClassKey, isValidUniqueKey, isWalletUserRejection, isWriteView, normalizePrivateKey, numberParamOf, parseJson, personalSignPrefixFor, readBlockNumberHeader, readHeader, readResponseBody, readRetryAfter, renderGalaErrorTemplate, requestWithTimeout, resolvePersonalSignChainDtoPayload, resolveUniqueKeyPrefix, serialize, signChainDtoHash, signChainDtoNative, signChainDtoPersonalSign, signNative, signPersonalMessage, signPreSend, signPreSendFor, signRawObject, signSerializedNative, signTypedDataPayload, splitClassKey, stringParamOf, stripEip712DomainType, templatePlaceholders, toFailureView, tokenClassDollarKey, tokenDetailsOf, tryParseCompositeKey, tryParseTokenClassKey, validateTimeoutMs, validateWalletInput, walletDeclineCode, withDtoOperation, withGalaWalletIdentity, withPrivateKey, writeQuantity };
5522
5622
  //# sourceMappingURL=index.mjs.map