@gala-chain/gala-core-sdk 1.0.0 → 1.1.0-beta.1
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/README.md +28 -7
- package/dist/bridge.cjs +6 -1
- package/dist/bridge.cjs.map +1 -1
- package/dist/bridge.mjs +7 -2
- package/dist/bridge.mjs.map +1 -1
- package/dist/browser/bridge.js +1 -1
- package/dist/browser/bridge.js.map +1 -1
- package/dist/browser/classes/error_catalog.js.map +1 -1
- package/dist/browser/classes/error_phase_table.js.map +1 -1
- package/dist/browser/classes/error_phases.js.map +1 -1
- package/dist/browser/classes/gala_sdk_error.js +1 -1
- package/dist/browser/classes/gala_sdk_error.js.map +1 -1
- package/dist/browser/classes/signers.js +1 -1
- package/dist/browser/classes/signers.js.map +1 -1
- package/dist/browser/config/environments.js.map +1 -1
- package/dist/browser/index.js +1 -1
- package/dist/browser/providers.js.map +1 -1
- package/dist/browser/react.js.map +1 -1
- package/dist/browser/reads/gateway_reads.js +1 -1
- package/dist/browser/reads/gateway_reads.js.map +1 -1
- package/dist/browser/reads/parse.js.map +1 -1
- package/dist/browser/reads/request.js.map +1 -1
- package/dist/browser/reads/types.js.map +1 -1
- package/dist/browser/utils/axios_requestor.js.map +1 -1
- package/dist/browser/utils/chain_dto_signing.js.map +1 -1
- package/dist/browser/utils/class_key.js.map +1 -1
- package/dist/browser/utils/dto_operation.js +2 -0
- package/dist/browser/utils/dto_operation.js.map +1 -0
- package/dist/browser/utils/eip712.js.map +1 -1
- package/dist/browser/utils/error_brand.js.map +1 -1
- package/dist/browser/utils/eth_address.js.map +1 -1
- package/dist/browser/utils/ethers_provider.js.map +1 -1
- package/dist/browser/utils/failure_outcomes.js.map +1 -1
- package/dist/browser/utils/failure_view.js.map +1 -1
- package/dist/browser/utils/fetch_failure.js.map +1 -1
- package/dist/browser/utils/pre_send.js +1 -1
- package/dist/browser/utils/pre_send.js.map +1 -1
- package/dist/browser/utils/signing.js.map +1 -1
- package/dist/browser/utils/transport.js +1 -1
- package/dist/browser/utils/transport.js.map +1 -1
- package/dist/browser/utils/typed_data.js.map +1 -1
- package/dist/browser/utils/unique_key.js.map +1 -1
- package/dist/browser/utils/unique_key_syntax.js.map +1 -1
- package/dist/browser/utils/wallet_keys.js.map +1 -1
- package/dist/browser/utils/wallet_rejection.js.map +1 -1
- package/dist/browser/version.js +1 -1
- package/dist/browser/version.js.map +1 -1
- package/dist/browser/wallet.js.map +1 -1
- package/dist/browser/writes/gateway_writes.js +1 -1
- package/dist/browser/writes/gateway_writes.js.map +1 -1
- package/dist/browser/writes/identity.js.map +1 -1
- package/dist/browser/writes/lock.js.map +1 -1
- package/dist/browser/writes/submit.js +1 -1
- package/dist/browser/writes/submit.js.map +1 -1
- package/dist/browser/writes/token_ref.js.map +1 -1
- package/dist/browser/writes/transfer.js.map +1 -1
- package/dist/browser/writes/types.js.map +1 -1
- package/dist/index.cjs +119 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +95 -3
- package/dist/index.d.ts +95 -3
- package/dist/index.mjs +117 -9
- package/dist/index.mjs.map +1 -1
- package/package.json +30 -30
- /package/dist/browser/_virtual/{_@oxc-project_runtime@0.153.0 → _@oxc-project_runtime@0.154.0}/helpers/esm/defineProperty.js +0 -0
- /package/dist/browser/_virtual/{_@oxc-project_runtime@0.153.0 → _@oxc-project_runtime@0.154.0}/helpers/esm/toPrimitive.js +0 -0
- /package/dist/browser/_virtual/{_@oxc-project_runtime@0.153.0 → _@oxc-project_runtime@0.154.0}/helpers/esm/toPropertyKey.js +0 -0
- /package/dist/browser/_virtual/{_@oxc-project_runtime@0.153.0 → _@oxc-project_runtime@0.154.0}/helpers/esm/typeof.js +0 -0
package/dist/index.d.cts
CHANGED
|
@@ -1762,6 +1762,97 @@ export declare function hashTypedData(payload: TypedDataPayload): Uint8Array;
|
|
|
1762
1762
|
*/
|
|
1763
1763
|
export declare function signTypedDataPayload(privateKey: PrivateKeyInput, payload: TypedDataPayload): Promise<string>;
|
|
1764
1764
|
//#endregion
|
|
1765
|
+
//#region src/utils/dto_operation.d.ts
|
|
1766
|
+
/**
|
|
1767
|
+
* The chain's operation ids for the GalaChain contracts the gateway routes, from the gateway's
|
|
1768
|
+
* `dtoOperationMap` (the `dtoOperation` / API path table of the GalaChain platform team,
|
|
1769
|
+
* 2026-10-27). The chain refuses a signed DTO whose `dtoOperation` is not exactly the operation it
|
|
1770
|
+
* is called through ("The dto was signed to call X operation, but the current operation is Y"), so
|
|
1771
|
+
* the URL a write is POSTed to and the `dtoOperation` it carries both come from this one table and
|
|
1772
|
+
* can never disagree.
|
|
1773
|
+
*
|
|
1774
|
+
* `dtoOperation` is a SIGNED field: it is part of the DTO before the signer sees it, never added by
|
|
1775
|
+
* a signer or after the signature.
|
|
1776
|
+
*/
|
|
1777
|
+
/** `<channel>/<contract route>`: the path after `/api/` (or `/v1/chain/`) a contract is served at. */
|
|
1778
|
+
export declare const CHAIN_CONTRACT_OPERATION_PREFIXES: {
|
|
1779
|
+
readonly 'asset/public-key-contract': 'asset-channel_basic-asset_PublicKeyContract';
|
|
1780
|
+
readonly 'asset/token-contract': 'asset-channel_basic-asset_GalaChainToken';
|
|
1781
|
+
readonly 'asset/fee-contract': 'asset-channel_basic-asset_GalaChainFee';
|
|
1782
|
+
readonly 'asset/launchpad-contract': 'asset-channel_basic-asset_Launchpad';
|
|
1783
|
+
readonly 'asset/dexv3-contract': 'asset-channel_basic-asset_DexV3Contract';
|
|
1784
|
+
readonly 'asset/dex-contract': 'asset-channel_basic-asset_GalaChainDex';
|
|
1785
|
+
readonly 'asset/registrar-contract': 'asset-channel_basic-asset_RegistrarContract';
|
|
1786
|
+
readonly 'asset/staking-contract': 'asset-channel_basic-asset_StakingContract';
|
|
1787
|
+
readonly 'asset/wallet-attributes-contract': 'asset-channel_basic-asset_WalletAttributesContract';
|
|
1788
|
+
readonly 'asset/bridge-contract': 'asset-channel_bridge-chaincode_BridgeContract';
|
|
1789
|
+
readonly 'asset/bridge-public-key-contract': 'asset-channel_bridge-chaincode_PublicKeyContract';
|
|
1790
|
+
readonly 'asset/alm-contract': 'asset-channel_basic-asset_ALMContract';
|
|
1791
|
+
readonly 'spidertanks/contract': 'spidertanks-channel_spidertanks_SpiderTanks';
|
|
1792
|
+
readonly 'music/public-key-contract': 'music_music_PublicKeyContract';
|
|
1793
|
+
readonly 'music/music-contract': 'music_music_GalaMusic';
|
|
1794
|
+
readonly 'music/token-contract': 'music_music_GalaChainToken';
|
|
1795
|
+
readonly 'pokergo/pokergo-contract': 'pokergo_pokergo_PokerGo';
|
|
1796
|
+
readonly 'pokergo/public-key-contract': 'pokergo_pokergo_PublicKeyContract';
|
|
1797
|
+
readonly 'pokergo/token-contract': 'pokergo_pokergo_GalaChainToken';
|
|
1798
|
+
readonly 'championsarena/public-key-contract': 'championsarena_championsarena_PublicKeyContract';
|
|
1799
|
+
readonly 'championsarena/champions-arena': 'championsarena_championsarena_ChampionsArenaContract';
|
|
1800
|
+
readonly 'championsarena/token-contract': 'championsarena_championsarena_GalaChainToken';
|
|
1801
|
+
readonly 'superior/public-key-contract': 'superior_superior_PublicKeyContract';
|
|
1802
|
+
readonly 'superior/token-contract': 'superior_superior_GalaChainToken';
|
|
1803
|
+
readonly 'superior/superior': 'superior_superior_Product';
|
|
1804
|
+
readonly 'legacy/public-key-contract': 'legacy_legacy_PublicKeyContract';
|
|
1805
|
+
readonly 'legacy/token-contract': 'legacy_legacy_GalaChainToken';
|
|
1806
|
+
readonly 'legacy/legacy': 'legacy_legacy_Legacy';
|
|
1807
|
+
readonly 'eternalparadox/public-key-contract': 'eternalparadox_eternalparadox_PublicKeyContract';
|
|
1808
|
+
readonly 'eternalparadox/token-contract': 'eternalparadox_eternalparadox_GalaChainToken';
|
|
1809
|
+
readonly 'eternalparadox/eternalparadox': 'eternalparadox_eternalparadox_EternalParadox';
|
|
1810
|
+
readonly 'echoesofempire/public-key-contract': 'echoesofempire_echoesofempire_PublicKeyContract';
|
|
1811
|
+
readonly 'echoesofempire/token-contract': 'echoesofempire_echoesofempire_GalaChainToken';
|
|
1812
|
+
readonly 'echoesofempire/echoesofempire-contract': 'echoesofempire_echoesofempire_EchoesOfEmpire';
|
|
1813
|
+
readonly 'node/public-key-contract': 'node_node_PublicKeyContract';
|
|
1814
|
+
readonly 'node/token-contract': 'node_node_GalaChainToken';
|
|
1815
|
+
readonly 'node/node-contract': 'node_node_Product';
|
|
1816
|
+
readonly 'townstar/product-contract': 'townstar_townstar_TownStar';
|
|
1817
|
+
readonly 'townstar/token-contract': 'townstar_townstar_GalaChainToken';
|
|
1818
|
+
readonly 'townstar/public-key-contract': 'townstar_townstar_PublicKeyContract';
|
|
1819
|
+
readonly 'mirandus/public-key-contract': 'mirandus_mirandus_PublicKeyContract';
|
|
1820
|
+
readonly 'mirandus/token-contract': 'mirandus_mirandus_GalaChainToken';
|
|
1821
|
+
readonly 'mirandus/mirandus-contract': 'mirandus_mirandus_Product';
|
|
1822
|
+
readonly 'galafilm/public-key-contract': 'galafilm_galafilm_PublicKeyContract';
|
|
1823
|
+
readonly 'galafilm/token-contract': 'galafilm_galafilm_GalaChainToken';
|
|
1824
|
+
readonly 'galafilm/galafilm-contract': 'galafilm_galafilm_Product';
|
|
1825
|
+
readonly 'lastexpedition/public-key-contract': 'lastexpedition_lastexpedition_PublicKeyContract';
|
|
1826
|
+
readonly 'lastexpedition/token-contract': 'lastexpedition_lastexpedition_GalaChainToken';
|
|
1827
|
+
readonly 'lastexpedition/lastexpedition-contract': 'lastexpedition_lastexpedition_Product';
|
|
1828
|
+
readonly 'legendsreborn/public-key-contract': 'legendsreborn_legendsreborn_PublicKeyContract';
|
|
1829
|
+
readonly 'legendsreborn/token-contract': 'legendsreborn_legendsreborn_GalaChainToken';
|
|
1830
|
+
readonly 'legendsreborn/legendsreborn-contract': 'legendsreborn_legendsreborn_Product';
|
|
1831
|
+
readonly 'thewalkingdeadempires/public-key-contract': 'thewalkingdeadempires_thewalkingdeadempires_PublicKeyContract';
|
|
1832
|
+
readonly 'thewalkingdeadempires/token-contract': 'thewalkingdeadempires_thewalkingdeadempires_GalaChainToken';
|
|
1833
|
+
readonly 'thewalkingdeadempires/thewalkingdeadempires-contract': 'thewalkingdeadempires_thewalkingdeadempires_Product';
|
|
1834
|
+
readonly 'vox/public-key-contract': 'vox_vox_PublicKeyContract';
|
|
1835
|
+
readonly 'vox/token-contract': 'vox_vox_GalaChainToken';
|
|
1836
|
+
readonly 'vox/auction-contract': 'vox_vox_AuctionContract';
|
|
1837
|
+
readonly 'vox/phase-contract': 'vox_vox_PhaseContract';
|
|
1838
|
+
readonly 'vox/vox-contract': 'vox_vox_VOXTokenContract';
|
|
1839
|
+
readonly 'vox/resources-contract': 'vox_vox_VOXResourceToken';
|
|
1840
|
+
};
|
|
1841
|
+
/** An API path of a GalaChain contract (`asset/token-contract`, `asset/dex-contract`, ...). */
|
|
1842
|
+
type ChainContractPath = keyof typeof CHAIN_CONTRACT_OPERATION_PREFIXES;
|
|
1843
|
+
/** The `dtoOperation` of `method` on the contract served at `contractPath`. */
|
|
1844
|
+
export declare function dtoOperationOf(contractPath: ChainContractPath, method: string): string;
|
|
1845
|
+
/**
|
|
1846
|
+
* `dto` with its `dtoOperation` set for `method` on `contractPath`. A DTO that already names a
|
|
1847
|
+
* different operation is refused: it was built for another call, and sending it would be rejected
|
|
1848
|
+
* by the chain after the signer had already signed it.
|
|
1849
|
+
*
|
|
1850
|
+
* @throws GalaSDKError SIGNING_FAILED when `dto.dtoOperation` is set and is not the operation of this call.
|
|
1851
|
+
*/
|
|
1852
|
+
export declare function withDtoOperation<T extends Record<string, unknown>>(contractPath: ChainContractPath, method: string, dto: T): T & {
|
|
1853
|
+
readonly dtoOperation: string;
|
|
1854
|
+
};
|
|
1855
|
+
//#endregion
|
|
1765
1856
|
//#region src/utils/pre_send.d.ts
|
|
1766
1857
|
/**
|
|
1767
1858
|
* The boundary of "nothing was sent". Every place where an SDK hands control to code the APP
|
|
@@ -1773,7 +1864,8 @@ export declare function signTypedDataPayload(privateKey: PrivateKeyInput, payloa
|
|
|
1773
1864
|
* cannot know what the server did with the write.
|
|
1774
1865
|
*/
|
|
1775
1866
|
/**
|
|
1776
|
-
* Signs a DTO with the app's signer
|
|
1867
|
+
* Signs a DTO with the app's signer, after setting its `dtoOperation` to the operation of `method`
|
|
1868
|
+
* on the contract at `contractPath` (the chain refuses a DTO signed for another operation). Whatever the signer throws that is not already an SDK error
|
|
1777
1869
|
* (a locked wallet, an unreachable extension, a wallet that declined) is `SIGNING_FAILED`
|
|
1778
1870
|
* (`reason` `user_rejected` or `failed`, the original as `cause`), and a signer that returns
|
|
1779
1871
|
* something other than an object is `SIGNING_FAILED` too: both are pre-send, so a retry is safe.
|
|
@@ -1781,7 +1873,7 @@ export declare function signTypedDataPayload(privateKey: PrivateKeyInput, payloa
|
|
|
1781
1873
|
*
|
|
1782
1874
|
* @throws GalaSDKError SIGNING_FAILED, or the SDK error the signer itself threw.
|
|
1783
1875
|
*/
|
|
1784
|
-
export declare function signPreSend<T extends Record<string, unknown>>(signer: GalaChainSigner, method: string, dto: T): Promise<SignedDto<T>>;
|
|
1876
|
+
export declare function signPreSend<T extends Record<string, unknown>>(signer: GalaChainSigner, contractPath: ChainContractPath, method: string, dto: T): Promise<SignedDto<T>>;
|
|
1785
1877
|
//#endregion
|
|
1786
1878
|
//#region src/types/http_requestor.d.ts
|
|
1787
1879
|
type FetchReturnValue = Awaited<ReturnType<typeof fetch>>;
|
|
@@ -3059,5 +3151,5 @@ export declare function walletDeclineCode(value: unknown): number | string | und
|
|
|
3059
3151
|
*/
|
|
3060
3152
|
export declare const GALA_CORE_SDK_VERSION: string;
|
|
3061
3153
|
//#endregion
|
|
3062
|
-
export type { AllPagesOptions, BalancesFilter, BridgeAmountProblem, BridgeDepositStep, BridgeNetwork, BridgeOutStep, BurnTokensInput, EIP712DomainValue, EIP712Types, ErrorParamsOf, FailureOutcome, FailureView, 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, InvalidPrivateKeyReason, InvalidTokenReferenceReason, LockTokensInput, 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 };
|
|
3154
|
+
export type { AllPagesOptions, BalancesFilter, BridgeAmountProblem, BridgeDepositStep, BridgeNetwork, BridgeOutStep, BurnTokensInput, ChainContractPath, EIP712DomainValue, EIP712Types, ErrorParamsOf, FailureOutcome, FailureView, 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, InvalidPrivateKeyReason, InvalidTokenReferenceReason, LockTokensInput, 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 };
|
|
3063
3155
|
//# sourceMappingURL=index.d.cts.map
|
package/dist/index.d.ts
CHANGED
|
@@ -1762,6 +1762,97 @@ export declare function hashTypedData(payload: TypedDataPayload): Uint8Array;
|
|
|
1762
1762
|
*/
|
|
1763
1763
|
export declare function signTypedDataPayload(privateKey: PrivateKeyInput, payload: TypedDataPayload): Promise<string>;
|
|
1764
1764
|
//#endregion
|
|
1765
|
+
//#region src/utils/dto_operation.d.ts
|
|
1766
|
+
/**
|
|
1767
|
+
* The chain's operation ids for the GalaChain contracts the gateway routes, from the gateway's
|
|
1768
|
+
* `dtoOperationMap` (the `dtoOperation` / API path table of the GalaChain platform team,
|
|
1769
|
+
* 2026-10-27). The chain refuses a signed DTO whose `dtoOperation` is not exactly the operation it
|
|
1770
|
+
* is called through ("The dto was signed to call X operation, but the current operation is Y"), so
|
|
1771
|
+
* the URL a write is POSTed to and the `dtoOperation` it carries both come from this one table and
|
|
1772
|
+
* can never disagree.
|
|
1773
|
+
*
|
|
1774
|
+
* `dtoOperation` is a SIGNED field: it is part of the DTO before the signer sees it, never added by
|
|
1775
|
+
* a signer or after the signature.
|
|
1776
|
+
*/
|
|
1777
|
+
/** `<channel>/<contract route>`: the path after `/api/` (or `/v1/chain/`) a contract is served at. */
|
|
1778
|
+
export declare const CHAIN_CONTRACT_OPERATION_PREFIXES: {
|
|
1779
|
+
readonly 'asset/public-key-contract': 'asset-channel_basic-asset_PublicKeyContract';
|
|
1780
|
+
readonly 'asset/token-contract': 'asset-channel_basic-asset_GalaChainToken';
|
|
1781
|
+
readonly 'asset/fee-contract': 'asset-channel_basic-asset_GalaChainFee';
|
|
1782
|
+
readonly 'asset/launchpad-contract': 'asset-channel_basic-asset_Launchpad';
|
|
1783
|
+
readonly 'asset/dexv3-contract': 'asset-channel_basic-asset_DexV3Contract';
|
|
1784
|
+
readonly 'asset/dex-contract': 'asset-channel_basic-asset_GalaChainDex';
|
|
1785
|
+
readonly 'asset/registrar-contract': 'asset-channel_basic-asset_RegistrarContract';
|
|
1786
|
+
readonly 'asset/staking-contract': 'asset-channel_basic-asset_StakingContract';
|
|
1787
|
+
readonly 'asset/wallet-attributes-contract': 'asset-channel_basic-asset_WalletAttributesContract';
|
|
1788
|
+
readonly 'asset/bridge-contract': 'asset-channel_bridge-chaincode_BridgeContract';
|
|
1789
|
+
readonly 'asset/bridge-public-key-contract': 'asset-channel_bridge-chaincode_PublicKeyContract';
|
|
1790
|
+
readonly 'asset/alm-contract': 'asset-channel_basic-asset_ALMContract';
|
|
1791
|
+
readonly 'spidertanks/contract': 'spidertanks-channel_spidertanks_SpiderTanks';
|
|
1792
|
+
readonly 'music/public-key-contract': 'music_music_PublicKeyContract';
|
|
1793
|
+
readonly 'music/music-contract': 'music_music_GalaMusic';
|
|
1794
|
+
readonly 'music/token-contract': 'music_music_GalaChainToken';
|
|
1795
|
+
readonly 'pokergo/pokergo-contract': 'pokergo_pokergo_PokerGo';
|
|
1796
|
+
readonly 'pokergo/public-key-contract': 'pokergo_pokergo_PublicKeyContract';
|
|
1797
|
+
readonly 'pokergo/token-contract': 'pokergo_pokergo_GalaChainToken';
|
|
1798
|
+
readonly 'championsarena/public-key-contract': 'championsarena_championsarena_PublicKeyContract';
|
|
1799
|
+
readonly 'championsarena/champions-arena': 'championsarena_championsarena_ChampionsArenaContract';
|
|
1800
|
+
readonly 'championsarena/token-contract': 'championsarena_championsarena_GalaChainToken';
|
|
1801
|
+
readonly 'superior/public-key-contract': 'superior_superior_PublicKeyContract';
|
|
1802
|
+
readonly 'superior/token-contract': 'superior_superior_GalaChainToken';
|
|
1803
|
+
readonly 'superior/superior': 'superior_superior_Product';
|
|
1804
|
+
readonly 'legacy/public-key-contract': 'legacy_legacy_PublicKeyContract';
|
|
1805
|
+
readonly 'legacy/token-contract': 'legacy_legacy_GalaChainToken';
|
|
1806
|
+
readonly 'legacy/legacy': 'legacy_legacy_Legacy';
|
|
1807
|
+
readonly 'eternalparadox/public-key-contract': 'eternalparadox_eternalparadox_PublicKeyContract';
|
|
1808
|
+
readonly 'eternalparadox/token-contract': 'eternalparadox_eternalparadox_GalaChainToken';
|
|
1809
|
+
readonly 'eternalparadox/eternalparadox': 'eternalparadox_eternalparadox_EternalParadox';
|
|
1810
|
+
readonly 'echoesofempire/public-key-contract': 'echoesofempire_echoesofempire_PublicKeyContract';
|
|
1811
|
+
readonly 'echoesofempire/token-contract': 'echoesofempire_echoesofempire_GalaChainToken';
|
|
1812
|
+
readonly 'echoesofempire/echoesofempire-contract': 'echoesofempire_echoesofempire_EchoesOfEmpire';
|
|
1813
|
+
readonly 'node/public-key-contract': 'node_node_PublicKeyContract';
|
|
1814
|
+
readonly 'node/token-contract': 'node_node_GalaChainToken';
|
|
1815
|
+
readonly 'node/node-contract': 'node_node_Product';
|
|
1816
|
+
readonly 'townstar/product-contract': 'townstar_townstar_TownStar';
|
|
1817
|
+
readonly 'townstar/token-contract': 'townstar_townstar_GalaChainToken';
|
|
1818
|
+
readonly 'townstar/public-key-contract': 'townstar_townstar_PublicKeyContract';
|
|
1819
|
+
readonly 'mirandus/public-key-contract': 'mirandus_mirandus_PublicKeyContract';
|
|
1820
|
+
readonly 'mirandus/token-contract': 'mirandus_mirandus_GalaChainToken';
|
|
1821
|
+
readonly 'mirandus/mirandus-contract': 'mirandus_mirandus_Product';
|
|
1822
|
+
readonly 'galafilm/public-key-contract': 'galafilm_galafilm_PublicKeyContract';
|
|
1823
|
+
readonly 'galafilm/token-contract': 'galafilm_galafilm_GalaChainToken';
|
|
1824
|
+
readonly 'galafilm/galafilm-contract': 'galafilm_galafilm_Product';
|
|
1825
|
+
readonly 'lastexpedition/public-key-contract': 'lastexpedition_lastexpedition_PublicKeyContract';
|
|
1826
|
+
readonly 'lastexpedition/token-contract': 'lastexpedition_lastexpedition_GalaChainToken';
|
|
1827
|
+
readonly 'lastexpedition/lastexpedition-contract': 'lastexpedition_lastexpedition_Product';
|
|
1828
|
+
readonly 'legendsreborn/public-key-contract': 'legendsreborn_legendsreborn_PublicKeyContract';
|
|
1829
|
+
readonly 'legendsreborn/token-contract': 'legendsreborn_legendsreborn_GalaChainToken';
|
|
1830
|
+
readonly 'legendsreborn/legendsreborn-contract': 'legendsreborn_legendsreborn_Product';
|
|
1831
|
+
readonly 'thewalkingdeadempires/public-key-contract': 'thewalkingdeadempires_thewalkingdeadempires_PublicKeyContract';
|
|
1832
|
+
readonly 'thewalkingdeadempires/token-contract': 'thewalkingdeadempires_thewalkingdeadempires_GalaChainToken';
|
|
1833
|
+
readonly 'thewalkingdeadempires/thewalkingdeadempires-contract': 'thewalkingdeadempires_thewalkingdeadempires_Product';
|
|
1834
|
+
readonly 'vox/public-key-contract': 'vox_vox_PublicKeyContract';
|
|
1835
|
+
readonly 'vox/token-contract': 'vox_vox_GalaChainToken';
|
|
1836
|
+
readonly 'vox/auction-contract': 'vox_vox_AuctionContract';
|
|
1837
|
+
readonly 'vox/phase-contract': 'vox_vox_PhaseContract';
|
|
1838
|
+
readonly 'vox/vox-contract': 'vox_vox_VOXTokenContract';
|
|
1839
|
+
readonly 'vox/resources-contract': 'vox_vox_VOXResourceToken';
|
|
1840
|
+
};
|
|
1841
|
+
/** An API path of a GalaChain contract (`asset/token-contract`, `asset/dex-contract`, ...). */
|
|
1842
|
+
type ChainContractPath = keyof typeof CHAIN_CONTRACT_OPERATION_PREFIXES;
|
|
1843
|
+
/** The `dtoOperation` of `method` on the contract served at `contractPath`. */
|
|
1844
|
+
export declare function dtoOperationOf(contractPath: ChainContractPath, method: string): string;
|
|
1845
|
+
/**
|
|
1846
|
+
* `dto` with its `dtoOperation` set for `method` on `contractPath`. A DTO that already names a
|
|
1847
|
+
* different operation is refused: it was built for another call, and sending it would be rejected
|
|
1848
|
+
* by the chain after the signer had already signed it.
|
|
1849
|
+
*
|
|
1850
|
+
* @throws GalaSDKError SIGNING_FAILED when `dto.dtoOperation` is set and is not the operation of this call.
|
|
1851
|
+
*/
|
|
1852
|
+
export declare function withDtoOperation<T extends Record<string, unknown>>(contractPath: ChainContractPath, method: string, dto: T): T & {
|
|
1853
|
+
readonly dtoOperation: string;
|
|
1854
|
+
};
|
|
1855
|
+
//#endregion
|
|
1765
1856
|
//#region src/utils/pre_send.d.ts
|
|
1766
1857
|
/**
|
|
1767
1858
|
* The boundary of "nothing was sent". Every place where an SDK hands control to code the APP
|
|
@@ -1773,7 +1864,8 @@ export declare function signTypedDataPayload(privateKey: PrivateKeyInput, payloa
|
|
|
1773
1864
|
* cannot know what the server did with the write.
|
|
1774
1865
|
*/
|
|
1775
1866
|
/**
|
|
1776
|
-
* Signs a DTO with the app's signer
|
|
1867
|
+
* Signs a DTO with the app's signer, after setting its `dtoOperation` to the operation of `method`
|
|
1868
|
+
* on the contract at `contractPath` (the chain refuses a DTO signed for another operation). Whatever the signer throws that is not already an SDK error
|
|
1777
1869
|
* (a locked wallet, an unreachable extension, a wallet that declined) is `SIGNING_FAILED`
|
|
1778
1870
|
* (`reason` `user_rejected` or `failed`, the original as `cause`), and a signer that returns
|
|
1779
1871
|
* something other than an object is `SIGNING_FAILED` too: both are pre-send, so a retry is safe.
|
|
@@ -1781,7 +1873,7 @@ export declare function signTypedDataPayload(privateKey: PrivateKeyInput, payloa
|
|
|
1781
1873
|
*
|
|
1782
1874
|
* @throws GalaSDKError SIGNING_FAILED, or the SDK error the signer itself threw.
|
|
1783
1875
|
*/
|
|
1784
|
-
export declare function signPreSend<T extends Record<string, unknown>>(signer: GalaChainSigner, method: string, dto: T): Promise<SignedDto<T>>;
|
|
1876
|
+
export declare function signPreSend<T extends Record<string, unknown>>(signer: GalaChainSigner, contractPath: ChainContractPath, method: string, dto: T): Promise<SignedDto<T>>;
|
|
1785
1877
|
//#endregion
|
|
1786
1878
|
//#region src/types/http_requestor.d.ts
|
|
1787
1879
|
type FetchReturnValue = Awaited<ReturnType<typeof fetch>>;
|
|
@@ -3059,5 +3151,5 @@ export declare function walletDeclineCode(value: unknown): number | string | und
|
|
|
3059
3151
|
*/
|
|
3060
3152
|
export declare const GALA_CORE_SDK_VERSION: string;
|
|
3061
3153
|
//#endregion
|
|
3062
|
-
export type { AllPagesOptions, BalancesFilter, BridgeAmountProblem, BridgeDepositStep, BridgeNetwork, BridgeOutStep, BurnTokensInput, EIP712DomainValue, EIP712Types, ErrorParamsOf, FailureOutcome, FailureView, 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, InvalidPrivateKeyReason, InvalidTokenReferenceReason, LockTokensInput, 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 };
|
|
3154
|
+
export type { AllPagesOptions, BalancesFilter, BridgeAmountProblem, BridgeDepositStep, BridgeNetwork, BridgeOutStep, BurnTokensInput, ChainContractPath, EIP712DomainValue, EIP712Types, ErrorParamsOf, FailureOutcome, FailureView, 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, InvalidPrivateKeyReason, InvalidTokenReferenceReason, LockTokensInput, 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 };
|
|
3063
3155
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.mjs
CHANGED
|
@@ -2520,6 +2520,110 @@ async function signTypedDataPayload(privateKey, payload) {
|
|
|
2520
2520
|
return withPrivateKey(privateKey, (key) => `0x${signHash(key, digest)}`);
|
|
2521
2521
|
}
|
|
2522
2522
|
|
|
2523
|
+
//#endregion
|
|
2524
|
+
//#region src/utils/dto_operation.ts
|
|
2525
|
+
/**
|
|
2526
|
+
* The chain's operation ids for the GalaChain contracts the gateway routes, from the gateway's
|
|
2527
|
+
* `dtoOperationMap` (the `dtoOperation` / API path table of the GalaChain platform team,
|
|
2528
|
+
* 2026-10-27). The chain refuses a signed DTO whose `dtoOperation` is not exactly the operation it
|
|
2529
|
+
* is called through ("The dto was signed to call X operation, but the current operation is Y"), so
|
|
2530
|
+
* the URL a write is POSTed to and the `dtoOperation` it carries both come from this one table and
|
|
2531
|
+
* can never disagree.
|
|
2532
|
+
*
|
|
2533
|
+
* `dtoOperation` is a SIGNED field: it is part of the DTO before the signer sees it, never added by
|
|
2534
|
+
* a signer or after the signature.
|
|
2535
|
+
*/
|
|
2536
|
+
/** `<channel>/<contract route>`: the path after `/api/` (or `/v1/chain/`) a contract is served at. */
|
|
2537
|
+
const CHAIN_CONTRACT_OPERATION_PREFIXES = {
|
|
2538
|
+
"asset/public-key-contract": "asset-channel_basic-asset_PublicKeyContract",
|
|
2539
|
+
"asset/token-contract": "asset-channel_basic-asset_GalaChainToken",
|
|
2540
|
+
"asset/fee-contract": "asset-channel_basic-asset_GalaChainFee",
|
|
2541
|
+
"asset/launchpad-contract": "asset-channel_basic-asset_Launchpad",
|
|
2542
|
+
"asset/dexv3-contract": "asset-channel_basic-asset_DexV3Contract",
|
|
2543
|
+
"asset/dex-contract": "asset-channel_basic-asset_GalaChainDex",
|
|
2544
|
+
"asset/registrar-contract": "asset-channel_basic-asset_RegistrarContract",
|
|
2545
|
+
"asset/staking-contract": "asset-channel_basic-asset_StakingContract",
|
|
2546
|
+
"asset/wallet-attributes-contract": "asset-channel_basic-asset_WalletAttributesContract",
|
|
2547
|
+
"asset/bridge-contract": "asset-channel_bridge-chaincode_BridgeContract",
|
|
2548
|
+
"asset/bridge-public-key-contract": "asset-channel_bridge-chaincode_PublicKeyContract",
|
|
2549
|
+
"asset/alm-contract": "asset-channel_basic-asset_ALMContract",
|
|
2550
|
+
"spidertanks/contract": "spidertanks-channel_spidertanks_SpiderTanks",
|
|
2551
|
+
"music/public-key-contract": "music_music_PublicKeyContract",
|
|
2552
|
+
"music/music-contract": "music_music_GalaMusic",
|
|
2553
|
+
"music/token-contract": "music_music_GalaChainToken",
|
|
2554
|
+
"pokergo/pokergo-contract": "pokergo_pokergo_PokerGo",
|
|
2555
|
+
"pokergo/public-key-contract": "pokergo_pokergo_PublicKeyContract",
|
|
2556
|
+
"pokergo/token-contract": "pokergo_pokergo_GalaChainToken",
|
|
2557
|
+
"championsarena/public-key-contract": "championsarena_championsarena_PublicKeyContract",
|
|
2558
|
+
"championsarena/champions-arena": "championsarena_championsarena_ChampionsArenaContract",
|
|
2559
|
+
"championsarena/token-contract": "championsarena_championsarena_GalaChainToken",
|
|
2560
|
+
"superior/public-key-contract": "superior_superior_PublicKeyContract",
|
|
2561
|
+
"superior/token-contract": "superior_superior_GalaChainToken",
|
|
2562
|
+
"superior/superior": "superior_superior_Product",
|
|
2563
|
+
"legacy/public-key-contract": "legacy_legacy_PublicKeyContract",
|
|
2564
|
+
"legacy/token-contract": "legacy_legacy_GalaChainToken",
|
|
2565
|
+
"legacy/legacy": "legacy_legacy_Legacy",
|
|
2566
|
+
"eternalparadox/public-key-contract": "eternalparadox_eternalparadox_PublicKeyContract",
|
|
2567
|
+
"eternalparadox/token-contract": "eternalparadox_eternalparadox_GalaChainToken",
|
|
2568
|
+
"eternalparadox/eternalparadox": "eternalparadox_eternalparadox_EternalParadox",
|
|
2569
|
+
"echoesofempire/public-key-contract": "echoesofempire_echoesofempire_PublicKeyContract",
|
|
2570
|
+
"echoesofempire/token-contract": "echoesofempire_echoesofempire_GalaChainToken",
|
|
2571
|
+
"echoesofempire/echoesofempire-contract": "echoesofempire_echoesofempire_EchoesOfEmpire",
|
|
2572
|
+
"node/public-key-contract": "node_node_PublicKeyContract",
|
|
2573
|
+
"node/token-contract": "node_node_GalaChainToken",
|
|
2574
|
+
"node/node-contract": "node_node_Product",
|
|
2575
|
+
"townstar/product-contract": "townstar_townstar_TownStar",
|
|
2576
|
+
"townstar/token-contract": "townstar_townstar_GalaChainToken",
|
|
2577
|
+
"townstar/public-key-contract": "townstar_townstar_PublicKeyContract",
|
|
2578
|
+
"mirandus/public-key-contract": "mirandus_mirandus_PublicKeyContract",
|
|
2579
|
+
"mirandus/token-contract": "mirandus_mirandus_GalaChainToken",
|
|
2580
|
+
"mirandus/mirandus-contract": "mirandus_mirandus_Product",
|
|
2581
|
+
"galafilm/public-key-contract": "galafilm_galafilm_PublicKeyContract",
|
|
2582
|
+
"galafilm/token-contract": "galafilm_galafilm_GalaChainToken",
|
|
2583
|
+
"galafilm/galafilm-contract": "galafilm_galafilm_Product",
|
|
2584
|
+
"lastexpedition/public-key-contract": "lastexpedition_lastexpedition_PublicKeyContract",
|
|
2585
|
+
"lastexpedition/token-contract": "lastexpedition_lastexpedition_GalaChainToken",
|
|
2586
|
+
"lastexpedition/lastexpedition-contract": "lastexpedition_lastexpedition_Product",
|
|
2587
|
+
"legendsreborn/public-key-contract": "legendsreborn_legendsreborn_PublicKeyContract",
|
|
2588
|
+
"legendsreborn/token-contract": "legendsreborn_legendsreborn_GalaChainToken",
|
|
2589
|
+
"legendsreborn/legendsreborn-contract": "legendsreborn_legendsreborn_Product",
|
|
2590
|
+
"thewalkingdeadempires/public-key-contract": "thewalkingdeadempires_thewalkingdeadempires_PublicKeyContract",
|
|
2591
|
+
"thewalkingdeadempires/token-contract": "thewalkingdeadempires_thewalkingdeadempires_GalaChainToken",
|
|
2592
|
+
"thewalkingdeadempires/thewalkingdeadempires-contract": "thewalkingdeadempires_thewalkingdeadempires_Product",
|
|
2593
|
+
"vox/public-key-contract": "vox_vox_PublicKeyContract",
|
|
2594
|
+
"vox/token-contract": "vox_vox_GalaChainToken",
|
|
2595
|
+
"vox/auction-contract": "vox_vox_AuctionContract",
|
|
2596
|
+
"vox/phase-contract": "vox_vox_PhaseContract",
|
|
2597
|
+
"vox/vox-contract": "vox_vox_VOXTokenContract",
|
|
2598
|
+
"vox/resources-contract": "vox_vox_VOXResourceToken"
|
|
2599
|
+
};
|
|
2600
|
+
/** The `dtoOperation` of `method` on the contract served at `contractPath`. */
|
|
2601
|
+
function dtoOperationOf(contractPath, method) {
|
|
2602
|
+
return `${CHAIN_CONTRACT_OPERATION_PREFIXES[contractPath]}:${method}`;
|
|
2603
|
+
}
|
|
2604
|
+
/**
|
|
2605
|
+
* `dto` with its `dtoOperation` set for `method` on `contractPath`. A DTO that already names a
|
|
2606
|
+
* different operation is refused: it was built for another call, and sending it would be rejected
|
|
2607
|
+
* by the chain after the signer had already signed it.
|
|
2608
|
+
*
|
|
2609
|
+
* @throws GalaSDKError SIGNING_FAILED when `dto.dtoOperation` is set and is not the operation of this call.
|
|
2610
|
+
*/
|
|
2611
|
+
function withDtoOperation(contractPath, method, dto) {
|
|
2612
|
+
const dtoOperation = dtoOperationOf(contractPath, method);
|
|
2613
|
+
const present = dto["dtoOperation"];
|
|
2614
|
+
if (present !== void 0 && present !== dtoOperation) throw new GalaSDKError("SIGNING_FAILED", {
|
|
2615
|
+
method,
|
|
2616
|
+
reason: "failed"
|
|
2617
|
+
}, { cause: {
|
|
2618
|
+
dtoOperation: present,
|
|
2619
|
+
expected: dtoOperation
|
|
2620
|
+
} });
|
|
2621
|
+
return {
|
|
2622
|
+
...dto,
|
|
2623
|
+
dtoOperation
|
|
2624
|
+
};
|
|
2625
|
+
}
|
|
2626
|
+
|
|
2523
2627
|
//#endregion
|
|
2524
2628
|
//#region src/utils/wallet_rejection.ts
|
|
2525
2629
|
/**
|
|
@@ -2649,7 +2753,8 @@ function walletDeclineCode(value) {
|
|
|
2649
2753
|
* cannot know what the server did with the write.
|
|
2650
2754
|
*/
|
|
2651
2755
|
/**
|
|
2652
|
-
* Signs a DTO with the app's signer
|
|
2756
|
+
* Signs a DTO with the app's signer, after setting its `dtoOperation` to the operation of `method`
|
|
2757
|
+
* on the contract at `contractPath` (the chain refuses a DTO signed for another operation). Whatever the signer throws that is not already an SDK error
|
|
2653
2758
|
* (a locked wallet, an unreachable extension, a wallet that declined) is `SIGNING_FAILED`
|
|
2654
2759
|
* (`reason` `user_rejected` or `failed`, the original as `cause`), and a signer that returns
|
|
2655
2760
|
* something other than an object is `SIGNING_FAILED` too: both are pre-send, so a retry is safe.
|
|
@@ -2657,10 +2762,10 @@ function walletDeclineCode(value) {
|
|
|
2657
2762
|
*
|
|
2658
2763
|
* @throws GalaSDKError SIGNING_FAILED, or the SDK error the signer itself threw.
|
|
2659
2764
|
*/
|
|
2660
|
-
async function signPreSend(signer, method, dto) {
|
|
2765
|
+
async function signPreSend(signer, contractPath, method, dto) {
|
|
2661
2766
|
let signed;
|
|
2662
2767
|
try {
|
|
2663
|
-
signed = await signer.signObject(method, dto);
|
|
2768
|
+
signed = await signer.signObject(method, withDtoOperation(contractPath, method, dto));
|
|
2664
2769
|
} catch (cause) {
|
|
2665
2770
|
if (isGalaError(cause)) throw cause;
|
|
2666
2771
|
const reason = isWalletUserRejection(cause) ? "user_rejected" : "failed";
|
|
@@ -2686,7 +2791,7 @@ async function signPreSend(signer, method, dto) {
|
|
|
2686
2791
|
* fallback. It is the version in the default `User-Agent` (`GalaChain-SDK/<version>`) of every SDK
|
|
2687
2792
|
* request, whichever product SDK sends it.
|
|
2688
2793
|
*/
|
|
2689
|
-
const GALA_CORE_SDK_VERSION = "1.0.
|
|
2794
|
+
const GALA_CORE_SDK_VERSION = "1.1.0-beta.1";
|
|
2690
2795
|
|
|
2691
2796
|
//#endregion
|
|
2692
2797
|
//#region src/utils/transport.ts
|
|
@@ -2747,7 +2852,7 @@ function buildRequestHeaders(wire, parts = {}) {
|
|
|
2747
2852
|
entries.set(name.toLowerCase(), [name, value]);
|
|
2748
2853
|
}
|
|
2749
2854
|
};
|
|
2750
|
-
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.0.
|
|
2855
|
+
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.1.0-beta.1"}` });
|
|
2751
2856
|
put(parts.defaults);
|
|
2752
2857
|
put(wire === null || wire === void 0 ? void 0 : wire.headers);
|
|
2753
2858
|
if (parts.json === true && !entries.has("content-type")) put({ "Content-Type": "application/json" });
|
|
@@ -3582,6 +3687,8 @@ function unlockTokenDto(owner, tokens, uniqueKey, name) {
|
|
|
3582
3687
|
|
|
3583
3688
|
//#endregion
|
|
3584
3689
|
//#region src/writes/submit.ts
|
|
3690
|
+
/** The contract every write of this module is sent to (its URL path and its `dtoOperation`). */
|
|
3691
|
+
const TOKEN_CONTRACT = "asset/token-contract";
|
|
3585
3692
|
/**
|
|
3586
3693
|
* The fields a signer may add next to the DTO: the signature and, for the wallet schemes, the
|
|
3587
3694
|
* personal-sign `prefix` and the EIP-712 `types` / `domain`. Nothing else: a signer that inserts a
|
|
@@ -3611,8 +3718,9 @@ function carriesExactlyTheDto(builtDto, signed) {
|
|
|
3611
3718
|
* `SIGNING_FAILED` (pre-send: nothing was transmitted, a retry is safe).
|
|
3612
3719
|
*/
|
|
3613
3720
|
async function signedPayload(signer, method, dto) {
|
|
3614
|
-
const
|
|
3615
|
-
const
|
|
3721
|
+
const operated = withDtoOperation(TOKEN_CONTRACT, method, dto);
|
|
3722
|
+
const builtDto = serialize(operated);
|
|
3723
|
+
const signed = await signPreSend(signer, TOKEN_CONTRACT, method, operated);
|
|
3616
3724
|
let payload;
|
|
3617
3725
|
try {
|
|
3618
3726
|
payload = carriesExactlyTheDto(builtDto, signed) ? JSON.stringify(signed) : void 0;
|
|
@@ -3723,7 +3831,7 @@ function receiptOf(method, uniqueKey, url, response, body) {
|
|
|
3723
3831
|
*/
|
|
3724
3832
|
async function submitWrite(transport, method, dto, uniqueKey) {
|
|
3725
3833
|
const payload = await signedPayload(transport.signer, method, dto);
|
|
3726
|
-
const url = `${transport.gatewayBaseUrl}/api
|
|
3834
|
+
const url = `${transport.gatewayBaseUrl}/api/${TOKEN_CONTRACT}/${method}`;
|
|
3727
3835
|
const { response, body } = await post(transport, method, url, payload, uniqueKey);
|
|
3728
3836
|
return receiptOf(method, uniqueKey, url, response, body);
|
|
3729
3837
|
}
|
|
@@ -4738,5 +4846,5 @@ const GALA_CHAIN_ENVIRONMENTS = Object.freeze({
|
|
|
4738
4846
|
});
|
|
4739
4847
|
|
|
4740
4848
|
//#endregion
|
|
4741
|
-
export { BRIDGE_AMOUNT_PROBLEMS, BRIDGE_DEPOSIT_STEPS, BRIDGE_NETWORKS, BRIDGE_OUT_STEPS, BrowserWalletSigner, 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_PRIVATE_KEY_REASONS, INVALID_TOKEN_REFERENCE_REASONS, 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, eip1193ProviderFromEthers, eip712DomainFor, ethAddressOfPrivateKey, ethereumAddressOfAccount, fetchRequestor, fixpointPrefixFor, galaChainUserRef, galaErrorTemplates, generateEIP712Types, getEthereumAddressFromPrivateKey, 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, signRawObject, signSerializedNative, signTypedDataPayload, splitClassKey, stringParamOf, stripEip712DomainType, templatePlaceholders, toFailureView, tokenClassDollarKey, tokenDetailsOf, tryParseCompositeKey, tryParseTokenClassKey, validateTimeoutMs, validateWalletInput, walletDeclineCode, withGalaWalletIdentity, withPrivateKey };
|
|
4849
|
+
export { BRIDGE_AMOUNT_PROBLEMS, BRIDGE_DEPOSIT_STEPS, BRIDGE_NETWORKS, BRIDGE_OUT_STEPS, BrowserWalletSigner, CHAIN_CONTRACT_OPERATION_PREFIXES, 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_PRIVATE_KEY_REASONS, INVALID_TOKEN_REFERENCE_REASONS, 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, ethAddressOfPrivateKey, ethereumAddressOfAccount, fetchRequestor, fixpointPrefixFor, galaChainUserRef, galaErrorTemplates, generateEIP712Types, getEthereumAddressFromPrivateKey, 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, signRawObject, signSerializedNative, signTypedDataPayload, splitClassKey, stringParamOf, stripEip712DomainType, templatePlaceholders, toFailureView, tokenClassDollarKey, tokenDetailsOf, tryParseCompositeKey, tryParseTokenClassKey, validateTimeoutMs, validateWalletInput, walletDeclineCode, withDtoOperation, withGalaWalletIdentity, withPrivateKey };
|
|
4742
4850
|
//# sourceMappingURL=index.mjs.map
|