@gala-chain/gala-core-sdk 1.2.0 → 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/README.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # GalaChain core SDK
2
2
 
3
+ > **Signing your own DTOs? Every signed write needs `dtoOperation`; enforcement is coming soon, so implement it
4
+ > now.** Per-endpoint mapping, before and after payloads and the errors:
5
+ > [MIGRATING-TO-DTO-OPERATION.md](./MIGRATING-TO-DTO-OPERATION.md). Using an SDK signer? Upgrade; it sets the field
6
+ > for you.
7
+
3
8
  `@gala-chain/gala-core-sdk` is the layer every GalaChain product SDK and app shares: signing
4
9
  (native, personal-sign, EIP-712 and arbitrary typed data), the signers (private key, lazy private
5
10
  key, Gala Wallet, EIP-1193 browser wallets), the gateway transport (`fetch` requestor with
@@ -13,7 +18,7 @@ gateway generically; product backends (the DEX and Launchpad backends) have thei
13
18
  ## Install
14
19
 
15
20
  ```bash
16
- npm install @gala-chain/gala-core-sdk
21
+ npm install @gala-chain/gala-core-sdk@next
17
22
  ```
18
23
 
19
24
  Pin the exact version in an app build. A product SDK takes core as a **peer dependency**: install it
@@ -347,7 +352,7 @@ gzipped, before `ethers` and `@solana/*`) are loaded only by an app that imports
347
352
 
348
353
  ## Status
349
354
 
350
- <!-- docs:var version -->1.2.0<!-- /docs:var --> (1.2: NFT collection reads and fee estimates, the NFT writes
355
+ <!-- docs:var version -->1.3.0-rc.0<!-- /docs:var --> (1.2: NFT collection reads and fee estimates, the NFT writes
351
356
  `claimNftCollection`, `createNftCollection` and `mintNft` on `GatewayWrites`, and their DryRun fee quote
352
357
  `estimateNftFee`; rc.7: `eth|0x<hex>` is refused as `INVALID_ETH_USER_REF_PREFIX`, not an address form; rc.6: `fetchPublicKey`, MetaMask and Trust Wallet detection, silent `restore()`;
353
358
  rc.5: every Ethereum account a read, write or GalaConnect client sends is
@@ -361,6 +366,12 @@ and the key derivations) and the bridge (`./bridge`: bridging, the token lists,
361
366
  `createSolanaWallet`) (rc.3, from launchpad-sdk's `/wallet`, `/react`, `helpers/wallet`, `bridge/`
362
367
  and its bridgeable / wrappable token and wrap services, which are gone).
363
368
 
369
+ ## Migrating to `dtoOperation`
370
+
371
+ Every signed write must carry `dtoOperation`, set before signing. See
372
+ [MIGRATING-TO-DTO-OPERATION.md](./MIGRATING-TO-DTO-OPERATION.md): the per-endpoint mapping, a before and
373
+ after payload (private-key and EIP-712), the SDK helpers and the errors.
374
+
364
375
  ## Migrating from gswap-sdk 1.x
365
376
 
366
377
  See [MIGRATING-FROM-GSWAP.md](./MIGRATING-FROM-GSWAP.md): every moved export, old path to new
@@ -1,2 +1,2 @@
1
- const e=[`wrong_length`,`bad_encoding`,`not_on_curve`,`no_key_provided`],t=[`user_rejected`,`failed`],n=[`missing`,`ambiguous`,`bad_class_key`,`bad_instance`],r=[`not_a_string`,`empty`,`bad_characters`,`not_a_positive_whole_number`,`above_mint_limit`,`bad_public_key`,`bad_authorities`,`bad_collection_name`],i=[`signer`,`gatewayBaseUrl`,`httpRequestor`,`tokenNameResolver`],a=[`timeout`,`transport`],o=[`gatewayBaseUrl`,`httpRequestor`],s=[`limit`,`pageSize`,`maxPages`,`bookmark`],c=[`not_connected`,`disconnected`,`unauthorized`],l=[`no_accounts`,`user_rejected`,`failed`],u=[`eip1193_provider`,`private_key_or_eip1193_provider`],d=[`empty`,`unrecognized_format`,`unknown_mnemonic_word`,`mnemonic_checksum`],f=[`Ethereum`,`Solana`],p=[`not_a_number`,`not_positive`,`too_many_decimals`],m=[`request_id`,`bridge_token_out`,`transaction_hash`],h=[`send`,`confirmation`,`registration`],g=[`not_listed`,`no_counterpart`,`unknown_channel`],_=[`wrap`,`unwrap`],v={REQUEST_TIMEOUT:{phase:`in_flight`,template:`Request to {url} timed out after {timeoutMs} ms.`,params:{url:`string`,timeoutMs:`number`}},TRANSPORT_ERROR:{phase:`in_flight`,template:`The request to {url} failed before the server answered.`,params:{url:`string`}},INVALID_TIMEOUT:{phase:`pre_send`,template:`{field} must be a positive number of milliseconds, or Infinity for no timeout (got {value}).`,params:{field:`string`,value:`number`}},GALA_WALLET_NOT_AVAILABLE:{phase:`pre_send`,template:`Gala wallet is not available. Please ensure the Gala wallet is connected.`,params:{}},WALLET_UNAVAILABLE:{phase:`pre_send`,template:`No wallet is connected.`,params:{}},MALFORMED_WALLET_REQUEST:{phase:`pre_send`,template:`Wallet {method} request is malformed.`,params:{method:`string`}},UNSUPPORTED_WALLET_METHOD:{phase:`pre_send`,template:`Unsupported wallet method {method}.`,params:{method:`string`}},INVALID_SIGNATURE:{phase:`pre_send`,template:`Wallet returned an invalid {scheme} signature.`,params:{scheme:`string`}},INVALID_CHAIN_ID:{phase:`pre_send`,template:`Wallet returned an invalid chain id ({chainId}).`,params:{chainId:`string`}},SIGNER_ADDRESS_MISMATCH:{phase:`pre_send`,template:`The signing key does not belong to the expected account.`,params:{}},INVALID_PRIVATE_KEY:{phase:`pre_send`,template:`Invalid private key: {reason}.`,params:{reason:e}},SIGNING_FAILED:{phase:`pre_send`,template:`Signing the {method} request failed ({reason}); nothing was sent.`,params:{method:`string`,reason:t}},KEY_PROVIDER_FAILED:{phase:`pre_send`,template:`The signing key could not be fetched; nothing was sent.`,params:{}},INVALID_SIGNING_HASH_LENGTH:{phase:`pre_send`,template:`secp256k1 can only sign a 32-byte hash (got {length}).`,params:{length:`number`}},INVALID_WALLET_ADDRESS:{phase:`pre_send`,template:`Invalid {field}: "{value}" is not an accepted wallet address form.`,params:{field:`string`,value:`string`}},INVALID_ETH_USER_REF_PREFIX:{phase:`pre_send`,template:`Invalid {field}: "{value}" is not a GalaChain user reference. An eth| reference takes the 40 hex digits of the account with no 0x prefix; write it as "{expected}".`,params:{field:`string`,value:`string`,expected:`string`}},INVALID_DECIMAL:{phase:`pre_send`,template:`Invalid decimal quantity: {value}`,params:{value:`string`}},PERSONAL_SIGN_NOT_JSON:{phase:`pre_send`,template:`Personal-sign DTO is not valid JSON`,params:{}},PERSONAL_SIGN_NOT_OBJECT:{phase:`pre_send`,template:`Personal-sign DTO must be a JSON object`,params:{}},PERSONAL_SIGN_BAD_PREFIX:{phase:`pre_send`,template:`Personal-sign DTO prefix is not an EIP-191 "Ethereum Signed Message" header`,params:{}},PERSONAL_SIGN_ENVELOPE_FIELDS:{phase:`pre_send`,template:`Personal-sign DTO carries signing-envelope field(s): {fields}`,params:{fields:`string`}},PERSONAL_SIGN_NOT_CANONICAL:{phase:`pre_send`,template:`Personal-sign DTO is not in canonical serialized form`,params:{}},EIP712_NAME_COLLISION:{phase:`pre_send`,template:`Name collisions are not supported when deriving EIP-712 types ({name}).`,params:{name:`string`}},EIP712_UNSUPPORTED_VALUE:{phase:`pre_send`,template:`Unsupported EIP-712 value of type {valueType}.`,params:{valueType:`string`}},TYPED_DATA_NOT_STRING:{phase:`pre_send`,template:`Invalid typed data: {what} must be a string`,params:{what:`string`}},TYPED_DATA_UNPAIRED_SURROGATE:{phase:`pre_send`,template:`Invalid typed data: {what} has an unpaired surrogate`,params:{what:`string`}},TYPED_DATA_NOT_HEX_BYTES:{phase:`pre_send`,template:`Invalid typed data: {what} must be an even-length 0x hex string`,params:{what:`string`}},TYPED_DATA_NOT_SAFE_INTEGER:{phase:`pre_send`,template:`Invalid typed data: {what} must be a safe integer`,params:{what:`string`}},TYPED_DATA_NOT_INTEGER:{phase:`pre_send`,template:`Invalid typed data: {what} must be an integer`,params:{what:`string`}},TYPED_DATA_NOT_BOOLEAN:{phase:`pre_send`,template:`Invalid typed data: bool must be a boolean`,params:{}},TYPED_DATA_BAD_ADDRESS:{phase:`pre_send`,template:`Invalid typed data: address must be 0x followed by 40 hex digits`,params:{}},TYPED_DATA_BAD_CHECKSUM:{phase:`pre_send`,template:`Invalid typed data: address has a bad checksum`,params:{}},TYPED_DATA_BYTES_LENGTH:{phase:`pre_send`,template:`Invalid typed data: {type} must be exactly {width} bytes`,params:{type:`string`,width:`number`}},TYPED_DATA_OUT_OF_BOUNDS:{phase:`pre_send`,template:`Invalid typed data: value out of bounds for {type}`,params:{type:`string`}},TYPED_DATA_UNSUPPORTED_TYPE:{phase:`pre_send`,template:`Invalid typed data: unsupported type "{type}"`,params:{type:`string`}},TYPED_DATA_FIELDS_NOT_LIST:{phase:`pre_send`,template:`Invalid typed data: type {typeName} must be a list of fields`,params:{typeName:`string`}},TYPED_DATA_FIELD_MALFORMED:{phase:`pre_send`,template:`Invalid typed data: type {typeName} has a field without a string name and type`,params:{typeName:`string`}},TYPED_DATA_INVALID_FIELD_NAME:{phase:`pre_send`,template:`Invalid typed data: invalid field name "{name}"`,params:{name:`string`}},TYPED_DATA_DUPLICATE_FIELD:{phase:`pre_send`,template:`Invalid typed data: duplicate field "{name}" in {typeName}`,params:{name:`string`,typeName:`string`}},TYPED_DATA_INVALID_TYPE_NAME:{phase:`pre_send`,template:`Invalid typed data: invalid type name "{name}"`,params:{name:`string`}},TYPED_DATA_CIRCULAR_TYPE:{phase:`pre_send`,template:`Invalid typed data: circular type reference in {typeName}`,params:{typeName:`string`}},TYPED_DATA_UNKNOWN_FIELD_TYPE:{phase:`pre_send`,template:`Invalid typed data: unknown type "{type}" in {typeName}`,params:{type:`string`,typeName:`string`}},TYPED_DATA_NO_PRIMARY_TYPE:{phase:`pre_send`,template:`Invalid typed data: missing primary type`,params:{}},TYPED_DATA_AMBIGUOUS_PRIMARY_TYPE:{phase:`pre_send`,template:`Invalid typed data: ambiguous primary types or unused types ({roots})`,params:{roots:`string`}},TYPED_DATA_ARRAY_EXPECTED:{phase:`pre_send`,template:`Invalid typed data: {type} array value must be an array`,params:{type:`string`}},TYPED_DATA_ARRAY_LENGTH_MISMATCH:{phase:`pre_send`,template:`Invalid typed data: array length mismatch`,params:{}},TYPED_DATA_STRUCT_NOT_OBJECT:{phase:`pre_send`,template:`Invalid typed data: {typeName} value must be an object`,params:{typeName:`string`}},TYPED_DATA_MISSING_FIELD:{phase:`pre_send`,template:`Invalid typed data: {typeName} value is missing field "{field}"`,params:{typeName:`string`,field:`string`}},TYPED_DATA_DOMAIN_NOT_OBJECT:{phase:`pre_send`,template:`Invalid typed data: domain must be an object`,params:{}},TYPED_DATA_INVALID_DOMAIN_KEY:{phase:`pre_send`,template:`Invalid typed data: invalid typed-data domain key {key}`,params:{key:`string`}},INVALID_UNIQUE_KEY:{phase:`pre_send`,template:`The uniqueKey "{uniqueKey}" must be 1-128 characters of A-Z, a-z, 0-9, ".", "_", ":" or "-".`,params:{uniqueKey:`string`}},INVALID_UNIQUE_KEY_PREFIX:{phase:`pre_send`,template:`uniqueKeyPrefix "{uniqueKeyPrefix}" must be at most {maxLength} characters of A-Z, a-z, 0-9, ".", "_", ":" or "-".`,params:{uniqueKeyPrefix:`string`,maxLength:`number`}},CSPRNG_UNAVAILABLE:{phase:`pre_send`,template:`No cryptographically secure random source (globalThis.crypto.getRandomValues) is available to mint a uniqueKey or a new wallet; install a getRandomValues polyfill (react-native-get-random-values on Hermes).`,params:{}},INVALID_WRITES_OPTION:{phase:`pre_send`,template:`GatewayWrites option {option} is missing or is not of the expected type.`,params:{option:i}},INVALID_QUANTITY:{phase:`pre_send`,template:`{field} must be a positive decimal number of whole tokens, written as a string (got "{value}").`,params:{field:`string`,value:`string`}},INVALID_TOKEN_REFERENCE:{phase:`pre_send`,template:`Invalid token reference {field}: {reason}.`,params:{field:`string`,reason:n}},INVALID_TOKEN_BATCH:{phase:`pre_send`,template:`{method} takes 1 to {max} tokens (got {count}).`,params:{method:`string`,count:`number`,max:`number`}},INVALID_LOCK_EXPIRES:{phase:`pre_send`,template:`expires must be a non-negative whole number of epoch milliseconds, 0 for none (got {value}).`,params:{value:`string`}},INVALID_LOCK_NAME:{phase:`pre_send`,template:`The lock name must be a string (got a {valueType}).`,params:{valueType:`string`}},INVALID_NFT_INPUT:{phase:`pre_send`,template:`Invalid NFT input {field}: {reason}.`,params:{field:`string`,reason:r}},NO_TOKEN_NAME_RESOLVER:{phase:`pre_send`,template:`The token name "{tokenName}" cannot be resolved: no tokenNameResolver is configured. Pass its tokenClassKey instead.`,params:{tokenName:`string`}},TOKEN_NAME_RESOLUTION_FAILED:{phase:`pre_send`,template:`The token name "{tokenName}" could not be resolved to a token class key; nothing was sent.`,params:{tokenName:`string`}},GATEWAY_WRITE_OUTCOME_UNKNOWN:{phase:`in_flight`,template:`The outcome of {method} is unknown ({reason}): the request may have reached the gateway. Check the write by its uniqueKey before sending it again.`,params:{method:`string`,reason:a}},GATEWAY_HTTP_ERROR:{phase:`post_send`,template:`The gateway answered {method} with HTTP {status}.`,params:{method:`string`,status:`number`,serverMessage:`string`},unrendered:[`serverMessage`]},GATEWAY_WRITE_REJECTED:{phase:`post_send`,template:`GalaChain rejected {method} (Status {chainStatus}, error key "{errorKey}").`,params:{method:`string`,chainStatus:`number`,errorKey:`string`,serverMessage:`string`},unrendered:[`serverMessage`]},GATEWAY_RESPONSE_INVALID:{phase:`post_send`,template:`The gateway answered {method} with something that is not a GalaChain result; the write may have been applied.`,params:{method:`string`}},INVALID_READS_OPTION:{phase:`pre_send`,template:`GatewayReads option {option} is missing or is not of the expected type.`,params:{option:o}},INVALID_PAGE_REQUEST:{phase:`pre_send`,template:`{field} is not valid for a paginated read (got {value}): a page size or page count is a whole number from 1 to 10000, a bookmark a string.`,params:{field:s,value:`string`}},GATEWAY_READ_REJECTED:{phase:`post_send`,template:`GalaChain refused {method} (Status {chainStatus}, error key "{errorKey}").`,params:{method:`string`,chainStatus:`number`,errorKey:`string`,serverMessage:`string`},unrendered:[`serverMessage`]},GATEWAY_READ_RESPONSE_INVALID:{phase:`post_send`,template:`The gateway answered {method} with something that is not a usable GalaChain result.`,params:{method:`string`}},TOKEN_CLASS_NOT_FOUND:{phase:`post_send`,template:`GalaChain has no token class {tokenClassKey}.`,params:{tokenClassKey:`string`}},PAGINATION_LIMIT_EXCEEDED:{phase:`post_send`,template:`Reading every page of {method} takes more than {maxPages} pages; narrow the filter or raise maxPages.`,params:{method:`string`,maxPages:`number`}},WALLET_NOT_CONNECTED:{phase:`pre_send`,template:`The wallet is not connected ({reason}): connect it before {operation}.`,params:{reason:c,operation:`string`}},WALLET_CONNECTION_FAILED:{phase:`pre_send`,template:`Connecting to the wallet failed ({reason}).`,params:{reason:l}},INVALID_WALLET_PROVIDER_CONFIG:{phase:`pre_send`,template:`A wallet provider cannot be built without {missing}.`,params:{missing:u}},PRIVATE_KEY_NOT_ACCESSIBLE:{phase:`pre_send`,template:`This wallet provider signs in the wallet and cannot give out a private key; only a PrivateKeyProvider holds one.`,params:{}},INVALID_WALLET_INPUT:{phase:`pre_send`,template:`The wallet input was refused ({reason}): give a private key (64 hex digits) or a 12- or 24-word mnemonic.`,params:{reason:d}},INVALID_BRIDGE_AMOUNT:{phase:`pre_send`,template:`The bridge amount "{value}" was refused ({reason}).`,params:{value:`string`,reason:p}},UNSUPPORTED_BRIDGE_TOKEN:{phase:`pre_send`,template:`{symbol} cannot be bridged with {network}.`,params:{network:`string`,symbol:`string`}},BRIDGE_NOT_CONFIGURED:{phase:`pre_send`,template:`{network} bridging is not configured: give the bridge a {network} private key (ethereumPrivateKey / solanaPrivateKey).`,params:{network:f}},INVALID_TRANSACTION_HASH:{phase:`pre_send`,template:`"{value}" is not a {network} transaction hash.`,params:{network:f,value:`string`}},INVALID_BRIDGE_OPTION:{phase:`pre_send`,template:`The bridge option {option} is missing or out of range.`,params:{option:`string`}},BRIDGE_RESPONSE_INVALID:{phase:`post_send`,template:`GalaConnect answered {method} without a usable {missing}; the request may have been accepted.`,params:{method:`string`,missing:`string`}},BRIDGE_READ_RESPONSE_INVALID:{phase:`post_send`,template:`GalaConnect answered {method} with something that is not a usable result.`,params:{method:`string`}},BRIDGE_WRITE_OUTCOME_UNKNOWN:{phase:`in_flight`,template:`The outcome of {method} is unknown: the request failed in transit and may have reached GalaConnect. Check it before sending it again.`,params:{method:`string`}},GALACONNECT_HTTP_ERROR:{phase:`post_send`,template:`GalaConnect answered {method} with HTTP {status}.`,params:{method:`string`,status:`number`,serverMessage:`string`},unrendered:[`serverMessage`]},BRIDGE_TOKEN_NOT_FOUND:{phase:`post_send`,template:`GalaConnect has no verified bridge configuration for {symbol}.`,params:{symbol:`string`}},TOKEN_NOT_WRAPPABLE:{phase:`post_send`,template:`{tokenId} cannot be wrapped or unwrapped ({reason}).`,params:{tokenId:`string`,reason:g}},INVALID_WRAP_DIRECTION:{phase:`pre_send`,template:`Cannot {direction} {symbol}: it is on the wrong channel for it (use the other direction).`,params:{symbol:`string`,direction:_}},BRIDGE_REQUEST_REJECTED:{phase:`post_send`,template:`GalaChain refused {method} (Status {chainStatus}, error key "{errorKey}").`,params:{method:`string`,chainStatus:`number`,errorKey:`string`,serverMessage:`string`},unrendered:[`serverMessage`]},BRIDGE_OUT_OUTCOME_UNKNOWN:{phase:`in_flight`,template:`GalaConnect accepted the bridge-out request, which may have locked the tokens, then the bridge-out failed at {step}. Check it before bridging again.`,params:{step:m,bridgeRequestId:`string`},unrendered:[`bridgeRequestId`]},BRIDGE_DEPOSIT_OUTCOME_UNKNOWN:{phase:`in_flight`,template:`The {network} bridge deposit may have been sent, then its {step} failed. Check the deposit before sending another.`,params:{network:f,step:h,transactionHash:`string`},unrendered:[`transactionHash`]},BRIDGE_CHAIN_READ_FAILED:{phase:`post_send`,template:`The {network} read {call} failed or answered something unusable; nothing was sent.`,params:{network:f,call:`string`}},INSUFFICIENT_BRIDGE_BALANCE:{phase:`pre_send`,template:`The {network} balance of {symbol} is {available}; the bridge needs {needed}.`,params:{network:f,symbol:`string`,needed:`string`,available:`string`}},BRIDGE_STATUS_TIMEOUT:{phase:`in_flight`,template:`The bridge transaction did not reach a final status within {timeoutMs} ms (last status {lastStatus}); it may still complete.`,params:{transactionHash:`string`,timeoutMs:`number`,lastStatus:`number`},unrendered:[`transactionHash`]},WALLET_CONTEXT_MISSING:{phase:`pre_send`,template:`The wallet hooks and the wallet context need a WalletProvider above them.`,params:{}}},y=Object.fromEntries(Object.entries(v).map(([e,t])=>[e,t.template])),b=/\{([A-Za-z0-9_]+)\}/gu;function x(e,t){return e.replace(b,(e,n)=>{let r=t[n];return typeof r==`string`||typeof r==`number`||typeof r==`boolean`?String(r):e})}function S(e){return[...new Set([...e.matchAll(b)].map(e=>e[1]))]}export{p as BRIDGE_AMOUNT_PROBLEMS,h as BRIDGE_DEPOSIT_STEPS,f as BRIDGE_NETWORKS,m as BRIDGE_OUT_STEPS,v as GALA_ERROR_CATALOG,o as GATEWAY_READS_OPTIONS,i as GATEWAY_WRITES_OPTIONS,a as GATEWAY_WRITE_OUTCOME_UNKNOWN_REASONS,r as INVALID_NFT_INPUT_REASONS,e as INVALID_PRIVATE_KEY_REASONS,n as INVALID_TOKEN_REFERENCE_REASONS,s as PAGE_REQUEST_FIELDS,t as SIGNING_FAILURE_REASONS,l as WALLET_CONNECTION_FAILURE_REASONS,d as WALLET_INPUT_PROBLEMS,c as WALLET_NOT_CONNECTED_REASONS,u as WALLET_PROVIDER_CONFIG_MISSING,_ as WRAP_DIRECTIONS,g as WRAP_REFUSAL_REASONS,y as galaErrorTemplates,x as renderGalaErrorTemplate,S as templatePlaceholders};
1
+ const e=[`wrong_length`,`bad_encoding`,`not_on_curve`,`no_key_provided`],t=[`user_rejected`,`failed`],n=[`missing`,`ambiguous`,`bad_class_key`,`bad_instance`],r=[`not_a_string`,`empty`,`bad_characters`,`not_a_positive_whole_number`,`above_mint_limit`,`bad_public_key`,`bad_authorities`,`bad_collection_name`],i=[`not_a_safe_integer`,`not_positive`,`expired`,`expiry_window`,`bad_shape`],a=[`signer`,`gatewayBaseUrl`,`httpRequestor`,`tokenNameResolver`],o=[`timeout`,`transport`],s=[`gatewayBaseUrl`,`httpRequestor`],c=[`limit`,`pageSize`,`maxPages`,`bookmark`],l=[`not_connected`,`disconnected`,`unauthorized`],u=[`no_accounts`,`user_rejected`,`failed`],d=[`eip1193_provider`,`private_key_or_eip1193_provider`],f=[`empty`,`unrecognized_format`,`unknown_mnemonic_word`,`mnemonic_checksum`],p=[`Ethereum`,`Solana`],m=[`not_a_number`,`not_positive`,`too_many_decimals`],h=[`request_id`,`bridge_token_out`,`transaction_hash`],g=[`send`,`confirmation`,`registration`],_=[`not_listed`,`no_counterpart`,`unknown_channel`],v=[`wrap`,`unwrap`],y={REQUEST_TIMEOUT:{phase:`in_flight`,template:`Request to {url} timed out after {timeoutMs} ms.`,params:{url:`string`,timeoutMs:`number`}},TRANSPORT_ERROR:{phase:`in_flight`,template:`The request to {url} failed before the server answered.`,params:{url:`string`}},INVALID_TIMEOUT:{phase:`pre_send`,template:`{field} must be a positive number of milliseconds, or Infinity for no timeout (got {value}).`,params:{field:`string`,value:`number`}},GALA_WALLET_NOT_AVAILABLE:{phase:`pre_send`,template:`Gala wallet is not available. Please ensure the Gala wallet is connected.`,params:{}},WALLET_UNAVAILABLE:{phase:`pre_send`,template:`No wallet is connected.`,params:{}},MALFORMED_WALLET_REQUEST:{phase:`pre_send`,template:`Wallet {method} request is malformed.`,params:{method:`string`}},UNSUPPORTED_WALLET_METHOD:{phase:`pre_send`,template:`Unsupported wallet method {method}.`,params:{method:`string`}},INVALID_SIGNATURE:{phase:`pre_send`,template:`Wallet returned an invalid {scheme} signature.`,params:{scheme:`string`}},INVALID_CHAIN_ID:{phase:`pre_send`,template:`Wallet returned an invalid chain id ({chainId}).`,params:{chainId:`string`}},SIGNER_ADDRESS_MISMATCH:{phase:`pre_send`,template:`The signing key does not belong to the expected account.`,params:{}},INVALID_PRIVATE_KEY:{phase:`pre_send`,template:`Invalid private key: {reason}.`,params:{reason:e}},SIGNING_FAILED:{phase:`pre_send`,template:`Signing the {method} request failed ({reason}); nothing was sent.`,params:{method:`string`,reason:t}},KEY_PROVIDER_FAILED:{phase:`pre_send`,template:`The signing key could not be fetched; nothing was sent.`,params:{}},INVALID_SIGNING_HASH_LENGTH:{phase:`pre_send`,template:`secp256k1 can only sign a 32-byte hash (got {length}).`,params:{length:`number`}},INVALID_WALLET_ADDRESS:{phase:`pre_send`,template:`Invalid {field}: "{value}" is not an accepted wallet address form.`,params:{field:`string`,value:`string`}},INVALID_ETH_USER_REF_PREFIX:{phase:`pre_send`,template:`Invalid {field}: "{value}" is not a GalaChain user reference. An eth| reference takes the 40 hex digits of the account with no 0x prefix; write it as "{expected}".`,params:{field:`string`,value:`string`,expected:`string`}},INVALID_DECIMAL:{phase:`pre_send`,template:`Invalid decimal quantity: {value}`,params:{value:`string`}},PERSONAL_SIGN_NOT_JSON:{phase:`pre_send`,template:`Personal-sign DTO is not valid JSON`,params:{}},PERSONAL_SIGN_NOT_OBJECT:{phase:`pre_send`,template:`Personal-sign DTO must be a JSON object`,params:{}},PERSONAL_SIGN_BAD_PREFIX:{phase:`pre_send`,template:`Personal-sign DTO prefix is not an EIP-191 "Ethereum Signed Message" header`,params:{}},PERSONAL_SIGN_ENVELOPE_FIELDS:{phase:`pre_send`,template:`Personal-sign DTO carries signing-envelope field(s): {fields}`,params:{fields:`string`}},PERSONAL_SIGN_NOT_CANONICAL:{phase:`pre_send`,template:`Personal-sign DTO is not in canonical serialized form`,params:{}},EIP712_NAME_COLLISION:{phase:`pre_send`,template:`Name collisions are not supported when deriving EIP-712 types ({name}).`,params:{name:`string`}},EIP712_UNSUPPORTED_VALUE:{phase:`pre_send`,template:`Unsupported EIP-712 value of type {valueType}.`,params:{valueType:`string`}},TYPED_DATA_NOT_STRING:{phase:`pre_send`,template:`Invalid typed data: {what} must be a string`,params:{what:`string`}},TYPED_DATA_UNPAIRED_SURROGATE:{phase:`pre_send`,template:`Invalid typed data: {what} has an unpaired surrogate`,params:{what:`string`}},TYPED_DATA_NOT_HEX_BYTES:{phase:`pre_send`,template:`Invalid typed data: {what} must be an even-length 0x hex string`,params:{what:`string`}},TYPED_DATA_NOT_SAFE_INTEGER:{phase:`pre_send`,template:`Invalid typed data: {what} must be a safe integer`,params:{what:`string`}},TYPED_DATA_NOT_INTEGER:{phase:`pre_send`,template:`Invalid typed data: {what} must be an integer`,params:{what:`string`}},TYPED_DATA_NOT_BOOLEAN:{phase:`pre_send`,template:`Invalid typed data: bool must be a boolean`,params:{}},TYPED_DATA_BAD_ADDRESS:{phase:`pre_send`,template:`Invalid typed data: address must be 0x followed by 40 hex digits`,params:{}},TYPED_DATA_BAD_CHECKSUM:{phase:`pre_send`,template:`Invalid typed data: address has a bad checksum`,params:{}},TYPED_DATA_BYTES_LENGTH:{phase:`pre_send`,template:`Invalid typed data: {type} must be exactly {width} bytes`,params:{type:`string`,width:`number`}},TYPED_DATA_OUT_OF_BOUNDS:{phase:`pre_send`,template:`Invalid typed data: value out of bounds for {type}`,params:{type:`string`}},TYPED_DATA_UNSUPPORTED_TYPE:{phase:`pre_send`,template:`Invalid typed data: unsupported type "{type}"`,params:{type:`string`}},TYPED_DATA_FIELDS_NOT_LIST:{phase:`pre_send`,template:`Invalid typed data: type {typeName} must be a list of fields`,params:{typeName:`string`}},TYPED_DATA_FIELD_MALFORMED:{phase:`pre_send`,template:`Invalid typed data: type {typeName} has a field without a string name and type`,params:{typeName:`string`}},TYPED_DATA_INVALID_FIELD_NAME:{phase:`pre_send`,template:`Invalid typed data: invalid field name "{name}"`,params:{name:`string`}},TYPED_DATA_DUPLICATE_FIELD:{phase:`pre_send`,template:`Invalid typed data: duplicate field "{name}" in {typeName}`,params:{name:`string`,typeName:`string`}},TYPED_DATA_INVALID_TYPE_NAME:{phase:`pre_send`,template:`Invalid typed data: invalid type name "{name}"`,params:{name:`string`}},TYPED_DATA_CIRCULAR_TYPE:{phase:`pre_send`,template:`Invalid typed data: circular type reference in {typeName}`,params:{typeName:`string`}},TYPED_DATA_UNKNOWN_FIELD_TYPE:{phase:`pre_send`,template:`Invalid typed data: unknown type "{type}" in {typeName}`,params:{type:`string`,typeName:`string`}},TYPED_DATA_NO_PRIMARY_TYPE:{phase:`pre_send`,template:`Invalid typed data: missing primary type`,params:{}},TYPED_DATA_AMBIGUOUS_PRIMARY_TYPE:{phase:`pre_send`,template:`Invalid typed data: ambiguous primary types or unused types ({roots})`,params:{roots:`string`}},TYPED_DATA_ARRAY_EXPECTED:{phase:`pre_send`,template:`Invalid typed data: {type} array value must be an array`,params:{type:`string`}},TYPED_DATA_ARRAY_LENGTH_MISMATCH:{phase:`pre_send`,template:`Invalid typed data: array length mismatch`,params:{}},TYPED_DATA_STRUCT_NOT_OBJECT:{phase:`pre_send`,template:`Invalid typed data: {typeName} value must be an object`,params:{typeName:`string`}},TYPED_DATA_MISSING_FIELD:{phase:`pre_send`,template:`Invalid typed data: {typeName} value is missing field "{field}"`,params:{typeName:`string`,field:`string`}},TYPED_DATA_DOMAIN_NOT_OBJECT:{phase:`pre_send`,template:`Invalid typed data: domain must be an object`,params:{}},TYPED_DATA_INVALID_DOMAIN_KEY:{phase:`pre_send`,template:`Invalid typed data: invalid typed-data domain key {key}`,params:{key:`string`}},INVALID_UNIQUE_KEY:{phase:`pre_send`,template:`The uniqueKey "{uniqueKey}" must be 1-128 characters of A-Z, a-z, 0-9, ".", "_", ":" or "-".`,params:{uniqueKey:`string`}},INVALID_UNIQUE_KEY_PREFIX:{phase:`pre_send`,template:`uniqueKeyPrefix "{uniqueKeyPrefix}" must be at most {maxLength} characters of A-Z, a-z, 0-9, ".", "_", ":" or "-".`,params:{uniqueKeyPrefix:`string`,maxLength:`number`}},CSPRNG_UNAVAILABLE:{phase:`pre_send`,template:`No cryptographically secure random source (globalThis.crypto.getRandomValues) is available to mint a uniqueKey or a new wallet; install a getRandomValues polyfill (react-native-get-random-values on Hermes).`,params:{}},INVALID_WRITES_OPTION:{phase:`pre_send`,template:`GatewayWrites option {option} is missing or is not of the expected type.`,params:{option:a}},INVALID_QUANTITY:{phase:`pre_send`,template:`{field} must be a positive decimal number of whole tokens, written as a string (got "{value}").`,params:{field:`string`,value:`string`}},INVALID_TOKEN_REFERENCE:{phase:`pre_send`,template:`Invalid token reference {field}: {reason}.`,params:{field:`string`,reason:n}},INVALID_TOKEN_BATCH:{phase:`pre_send`,template:`{method} takes 1 to {max} tokens (got {count}).`,params:{method:`string`,count:`number`,max:`number`}},INVALID_LOCK_EXPIRES:{phase:`pre_send`,template:`expires must be a non-negative whole number of epoch milliseconds, 0 for none (got {value}).`,params:{value:`string`}},INVALID_DTO_EXPIRES_AT:{phase:`pre_send`,template:`Invalid {field}: {reason}.`,params:{field:`string`,reason:i}},INVALID_CONTRACT_PATH:{phase:`pre_send`,template:`Invalid {field}: it names no contract this SDK knows a dtoOperation for; nothing was signed.`,params:{field:`string`}},INVALID_LOCK_NAME:{phase:`pre_send`,template:`The lock name must be a string (got a {valueType}).`,params:{valueType:`string`}},INVALID_NFT_INPUT:{phase:`pre_send`,template:`Invalid NFT input {field}: {reason}.`,params:{field:`string`,reason:r}},NO_TOKEN_NAME_RESOLVER:{phase:`pre_send`,template:`The token name "{tokenName}" cannot be resolved: no tokenNameResolver is configured. Pass its tokenClassKey instead.`,params:{tokenName:`string`}},TOKEN_NAME_RESOLUTION_FAILED:{phase:`pre_send`,template:`The token name "{tokenName}" could not be resolved to a token class key; nothing was sent.`,params:{tokenName:`string`}},GATEWAY_WRITE_OUTCOME_UNKNOWN:{phase:`in_flight`,template:`The outcome of {method} is unknown ({reason}): the request may have reached the gateway. Check the write by its uniqueKey before sending it again.`,params:{method:`string`,reason:o}},GATEWAY_HTTP_ERROR:{phase:`post_send`,template:`The gateway answered {method} with HTTP {status}.`,params:{method:`string`,status:`number`,serverMessage:`string`},unrendered:[`serverMessage`]},GATEWAY_WRITE_REJECTED:{phase:`post_send`,template:`GalaChain rejected {method} (Status {chainStatus}, error key "{errorKey}").`,params:{method:`string`,chainStatus:`number`,errorKey:`string`,serverMessage:`string`},unrendered:[`serverMessage`]},GATEWAY_RESPONSE_INVALID:{phase:`post_send`,template:`The gateway answered {method} with something that is not a GalaChain result; the write may have been applied.`,params:{method:`string`}},INVALID_READS_OPTION:{phase:`pre_send`,template:`GatewayReads option {option} is missing or is not of the expected type.`,params:{option:s}},INVALID_PAGE_REQUEST:{phase:`pre_send`,template:`{field} is not valid for a paginated read (got {value}): a page size or page count is a whole number from 1 to 10000, a bookmark a string.`,params:{field:c,value:`string`}},GATEWAY_READ_REJECTED:{phase:`post_send`,template:`GalaChain refused {method} (Status {chainStatus}, error key "{errorKey}").`,params:{method:`string`,chainStatus:`number`,errorKey:`string`,serverMessage:`string`},unrendered:[`serverMessage`]},GATEWAY_READ_RESPONSE_INVALID:{phase:`post_send`,template:`The gateway answered {method} with something that is not a usable GalaChain result.`,params:{method:`string`}},TOKEN_CLASS_NOT_FOUND:{phase:`post_send`,template:`GalaChain has no token class {tokenClassKey}.`,params:{tokenClassKey:`string`}},PAGINATION_LIMIT_EXCEEDED:{phase:`post_send`,template:`Reading every page of {method} takes more than {maxPages} pages; narrow the filter or raise maxPages.`,params:{method:`string`,maxPages:`number`}},WALLET_NOT_CONNECTED:{phase:`pre_send`,template:`The wallet is not connected ({reason}): connect it before {operation}.`,params:{reason:l,operation:`string`}},WALLET_CONNECTION_FAILED:{phase:`pre_send`,template:`Connecting to the wallet failed ({reason}).`,params:{reason:u}},INVALID_WALLET_PROVIDER_CONFIG:{phase:`pre_send`,template:`A wallet provider cannot be built without {missing}.`,params:{missing:d}},PRIVATE_KEY_NOT_ACCESSIBLE:{phase:`pre_send`,template:`This wallet provider signs in the wallet and cannot give out a private key; only a PrivateKeyProvider holds one.`,params:{}},INVALID_WALLET_INPUT:{phase:`pre_send`,template:`The wallet input was refused ({reason}): give a private key (64 hex digits) or a 12- or 24-word mnemonic.`,params:{reason:f}},INVALID_BRIDGE_AMOUNT:{phase:`pre_send`,template:`The bridge amount "{value}" was refused ({reason}).`,params:{value:`string`,reason:m}},UNSUPPORTED_BRIDGE_TOKEN:{phase:`pre_send`,template:`{symbol} cannot be bridged with {network}.`,params:{network:`string`,symbol:`string`}},BRIDGE_NOT_CONFIGURED:{phase:`pre_send`,template:`{network} bridging is not configured: give the bridge a {network} private key (ethereumPrivateKey / solanaPrivateKey).`,params:{network:p}},INVALID_TRANSACTION_HASH:{phase:`pre_send`,template:`"{value}" is not a {network} transaction hash.`,params:{network:p,value:`string`}},INVALID_BRIDGE_OPTION:{phase:`pre_send`,template:`The bridge option {option} is missing or out of range.`,params:{option:`string`}},BRIDGE_RESPONSE_INVALID:{phase:`post_send`,template:`GalaConnect answered {method} without a usable {missing}; the request may have been accepted.`,params:{method:`string`,missing:`string`}},BRIDGE_READ_RESPONSE_INVALID:{phase:`post_send`,template:`GalaConnect answered {method} with something that is not a usable result.`,params:{method:`string`}},BRIDGE_WRITE_OUTCOME_UNKNOWN:{phase:`in_flight`,template:`The outcome of {method} is unknown: the request failed in transit and may have reached GalaConnect. Check it before sending it again.`,params:{method:`string`}},GALACONNECT_HTTP_ERROR:{phase:`post_send`,template:`GalaConnect answered {method} with HTTP {status}.`,params:{method:`string`,status:`number`,serverMessage:`string`},unrendered:[`serverMessage`]},BRIDGE_TOKEN_NOT_FOUND:{phase:`post_send`,template:`GalaConnect has no verified bridge configuration for {symbol}.`,params:{symbol:`string`}},TOKEN_NOT_WRAPPABLE:{phase:`post_send`,template:`{tokenId} cannot be wrapped or unwrapped ({reason}).`,params:{tokenId:`string`,reason:_}},INVALID_WRAP_DIRECTION:{phase:`pre_send`,template:`Cannot {direction} {symbol}: it is on the wrong channel for it (use the other direction).`,params:{symbol:`string`,direction:v}},BRIDGE_REQUEST_REJECTED:{phase:`post_send`,template:`GalaChain refused {method} (Status {chainStatus}, error key "{errorKey}").`,params:{method:`string`,chainStatus:`number`,errorKey:`string`,serverMessage:`string`},unrendered:[`serverMessage`]},BRIDGE_OUT_OUTCOME_UNKNOWN:{phase:`in_flight`,template:`GalaConnect accepted the bridge-out request, which may have locked the tokens, then the bridge-out failed at {step}. Check it before bridging again.`,params:{step:h,bridgeRequestId:`string`},unrendered:[`bridgeRequestId`]},BRIDGE_DEPOSIT_OUTCOME_UNKNOWN:{phase:`in_flight`,template:`The {network} bridge deposit may have been sent, then its {step} failed. Check the deposit before sending another.`,params:{network:p,step:g,transactionHash:`string`},unrendered:[`transactionHash`]},BRIDGE_CHAIN_READ_FAILED:{phase:`post_send`,template:`The {network} read {call} failed or answered something unusable; nothing was sent.`,params:{network:p,call:`string`}},INSUFFICIENT_BRIDGE_BALANCE:{phase:`pre_send`,template:`The {network} balance of {symbol} is {available}; the bridge needs {needed}.`,params:{network:p,symbol:`string`,needed:`string`,available:`string`}},BRIDGE_STATUS_TIMEOUT:{phase:`in_flight`,template:`The bridge transaction did not reach a final status within {timeoutMs} ms (last status {lastStatus}); it may still complete.`,params:{transactionHash:`string`,timeoutMs:`number`,lastStatus:`number`},unrendered:[`transactionHash`]},WALLET_CONTEXT_MISSING:{phase:`pre_send`,template:`The wallet hooks and the wallet context need a WalletProvider above them.`,params:{}}},b=Object.fromEntries(Object.entries(y).map(([e,t])=>[e,t.template])),x=/\{([A-Za-z0-9_]+)\}/gu;function S(e,t){return e.replace(x,(e,n)=>{let r=t[n];return typeof r==`string`||typeof r==`number`||typeof r==`boolean`?String(r):e})}function C(e){return[...new Set([...e.matchAll(x)].map(e=>e[1]))]}export{m as BRIDGE_AMOUNT_PROBLEMS,g as BRIDGE_DEPOSIT_STEPS,p as BRIDGE_NETWORKS,h as BRIDGE_OUT_STEPS,y as GALA_ERROR_CATALOG,s as GATEWAY_READS_OPTIONS,a as GATEWAY_WRITES_OPTIONS,o as GATEWAY_WRITE_OUTCOME_UNKNOWN_REASONS,i as INVALID_DTO_EXPIRES_AT_REASONS,r as INVALID_NFT_INPUT_REASONS,e as INVALID_PRIVATE_KEY_REASONS,n as INVALID_TOKEN_REFERENCE_REASONS,c as PAGE_REQUEST_FIELDS,t as SIGNING_FAILURE_REASONS,u as WALLET_CONNECTION_FAILURE_REASONS,f as WALLET_INPUT_PROBLEMS,l as WALLET_NOT_CONNECTED_REASONS,d as WALLET_PROVIDER_CONFIG_MISSING,v as WRAP_DIRECTIONS,_ as WRAP_REFUSAL_REASONS,b as galaErrorTemplates,S as renderGalaErrorTemplate,C as templatePlaceholders};
2
2
  //# sourceMappingURL=error_catalog.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"error_catalog.js","names":["INVALID_PRIVATE_KEY_REASONS","SIGNING_FAILURE_REASONS","INVALID_TOKEN_REFERENCE_REASONS","INVALID_NFT_INPUT_REASONS","GATEWAY_WRITES_OPTIONS","GATEWAY_WRITE_OUTCOME_UNKNOWN_REASONS","GATEWAY_READS_OPTIONS","PAGE_REQUEST_FIELDS","WALLET_NOT_CONNECTED_REASONS","WALLET_CONNECTION_FAILURE_REASONS","WALLET_PROVIDER_CONFIG_MISSING","WALLET_INPUT_PROBLEMS","BRIDGE_NETWORKS","BRIDGE_AMOUNT_PROBLEMS","BRIDGE_OUT_STEPS","BRIDGE_DEPOSIT_STEPS","WRAP_REFUSAL_REASONS","WRAP_DIRECTIONS","GALA_ERROR_CATALOG","galaErrorTemplates","code","entry","PLACEHOLDER","renderGalaErrorTemplate","template","value","params","name","whole","templatePlaceholders","match"],"sources":["../../../src/classes/error_catalog.ts"],"sourcesContent":["/**\n * The catalog of every error `@gala-chain/gala-core-sdk` throws: the SINGLE source of truth for\n * its `code`, the named parameters it carries and the English template its `message` is generated\n * from. A product SDK (gswap-sdk, launchpad-sdk) keeps its OWN catalog of the codes only it throws,\n * and its error class (a subclass of `GalaSDKError`) reads both; no code is defined twice.\n *\n * - `code` is the only discriminator. It is stable: apps branch on it, never on message text.\n * - `params` are the named placeholders of the error: a flat object of primitives (string,\n * number, boolean) that an app feeds to its own localization (i18next, ICU, FormatJS).\n * Raw server payloads are never params (they are `error.body` / `error.bodyText`), and no\n * secret (private key, signature, raw DTO) ever is.\n * - `template` is English with `{placeholder}` markers. `error.message` is generated from it\n * and the params, so the two cannot drift. It is for logs and developers: it is not stable and\n * must not be shown to users or matched on.\n *\n * Every placeholder in a template is a declared param and every declared param is a placeholder,\n * except the few `unrendered` params that carry server text for the app and are kept out of\n * `message` on purpose (pinned by tests/error_catalog.test.ts). Facts that are not placeholders\n * (HTTP status, URL, `uniqueKey`, transaction ids, the raw body, the cause) are typed properties of\n * the error, see {@link GalaErrorContext}.\n */\n\nimport type { GalaErrorPhase } from './error_phases.js';\n\n/**\n * The kinds a param can have: a primitive, or a CLOSED set of string tokens (a readonly tuple).\n * A closed set is a documented union: an app maps each member to its own text and can check that\n * it covered all of them, and a new member is a compile error until it does.\n */\nexport type GalaErrorParamKind = 'string' | 'number' | 'boolean' | readonly string[];\n\n/** One catalog entry (of this catalog, or of a product SDK's own catalog). */\nexport interface GalaErrorCatalogEntry {\n /** The phase this code is thrown in, unless a throw site says otherwise (see {@link GalaErrorPhase}). */\n readonly phase: GalaErrorPhase;\n /** English message template with `{placeholder}` markers. */\n readonly template: string;\n /** Param name to kind. Every param is required and appears in the template, except `unrendered`. */\n readonly params: Readonly<Record<string, GalaErrorParamKind>>;\n /**\n * Params that are carried for the app but deliberately NOT placeholders of the template. Used\n * for `serverMessage` on the codes whose failing answer may be anything (a proxy's page, a\n * validation list): the server's text is data for the app to relay or ignore, and keeping it out\n * of `message` means it cannot reach a log line or a user interface by accident.\n */\n readonly unrendered?: readonly string[];\n}\n\n/**\n * Why a private key was refused (`INVALID_PRIVATE_KEY.params.reason`). A token for the app to map\n * to its own text, never English and never any part of the key.\n *\n * - `wrong_length`: raw bytes that are not 32 bytes long (a `./bridge` Solana secret key: not 64\n * bytes once decoded).\n * - `bad_encoding`: a string that is neither 64 hex characters (optionally `0x`-prefixed, 63 is\n * left-padded) nor a 44-character base64 string (`./bridge`: an Ethereum key that is not `0x`\n * and 64 hex characters; a Solana secret key that is not base58, or whose public half does not\n * match its secret half).\n * - `not_on_curve`: 32 bytes that are not a valid secp256k1 secret scalar.\n * - `no_key_provided`: a lazy key provider returned something that is not a string.\n */\nexport const INVALID_PRIVATE_KEY_REASONS = [\n 'wrong_length',\n 'bad_encoding',\n 'not_on_curve',\n 'no_key_provided',\n] as const;\n\n/** One member of {@link INVALID_PRIVATE_KEY_REASONS}. */\nexport type InvalidPrivateKeyReason = (typeof INVALID_PRIVATE_KEY_REASONS)[number];\n\n/**\n * Why a signer could not produce a signature (`SIGNING_FAILED.params.reason`). A token for the\n * app to map to its own text.\n *\n * - `user_rejected`: the person declined in their wallet (an EIP-1193 `4001`, an ethers\n * `ACTION_REJECTED`, or a wallet that words it \"User rejected/denied ...\"). Nothing is wrong:\n * they may simply try again.\n * - `failed`: anything else the signer threw (a locked wallet, an unreachable extension, a wallet\n * that refused). The original error is `cause`.\n */\nexport const SIGNING_FAILURE_REASONS = ['user_rejected', 'failed'] as const;\n\n/** One member of {@link SIGNING_FAILURE_REASONS}. */\nexport type SigningFailureReason = (typeof SIGNING_FAILURE_REASONS)[number];\n\n/**\n * Why a gateway write refused the token it was asked to move\n * (`INVALID_TOKEN_REFERENCE.params.reason`). A token for the app to map to its own text.\n *\n * - `missing`: neither `tokenClassKey` nor `tokenName` was given.\n * - `ambiguous`: more than one way of naming the token was given (`tokenClassKey` and\n * `tokenName`, or a `tokenName` with an `instance`: a resolved name decides its own instance).\n * - `bad_class_key`: `tokenClassKey` is not a class key: a pipe string needs exactly four\n * non-empty parts, a `$` string at least four (split from the right), an object four non-empty\n * strings. A bare symbol is never a class key and none is derived from it.\n * - `bad_instance`: `instance` is not a string of decimal digits.\n */\nexport const INVALID_TOKEN_REFERENCE_REASONS = [\n 'missing',\n 'ambiguous',\n 'bad_class_key',\n 'bad_instance',\n] as const;\n\n/** One member of {@link INVALID_TOKEN_REFERENCE_REASONS}. */\nexport type InvalidTokenReferenceReason = (typeof INVALID_TOKEN_REFERENCE_REASONS)[number];\n\n/**\n * Why an NFT read's, write's or fee quote's input is refused (`INVALID_NFT_INPUT.params.reason`).\n * A token for the app to map to its own text.\n */\nexport const INVALID_NFT_INPUT_REASONS = [\n 'not_a_string',\n 'empty',\n 'bad_characters',\n 'not_a_positive_whole_number',\n 'above_mint_limit',\n 'bad_public_key',\n 'bad_authorities',\n 'bad_collection_name',\n] as const;\n\n/** One member of {@link INVALID_NFT_INPUT_REASONS}. */\nexport type InvalidNftInputReason = (typeof INVALID_NFT_INPUT_REASONS)[number];\n\n/**\n * The `GatewayWrites` options that are refused when missing or of the wrong type\n * (`INVALID_WRITES_OPTION.params.option`). `walletAddress`, `requestTimeoutMs` and\n * `uniqueKeyPrefix` have codes of their own (`INVALID_WALLET_ADDRESS`, `INVALID_TIMEOUT`,\n * `INVALID_UNIQUE_KEY_PREFIX`).\n */\nexport const GATEWAY_WRITES_OPTIONS = [\n 'signer',\n 'gatewayBaseUrl',\n 'httpRequestor',\n 'tokenNameResolver',\n] as const;\n\n/** One member of {@link GATEWAY_WRITES_OPTIONS}. */\nexport type GatewayWritesOption = (typeof GATEWAY_WRITES_OPTIONS)[number];\n\n/**\n * Why the outcome of a gateway write is unknown (`GATEWAY_WRITE_OUTCOME_UNKNOWN.params.reason`).\n * Both say the same thing about the write (it MAY have been applied: never send it again under a\n * fresh key, check `error.uniqueKey` instead) and differ only in what happened to the request.\n *\n * - `timeout`: the POST exceeded `requestTimeoutMs`; the request may still be running.\n * - `transport`: the POST failed before an answer was read (offline, connection reset, DNS, CORS,\n * a body that broke off). The bytes may have reached the gateway.\n */\nexport const GATEWAY_WRITE_OUTCOME_UNKNOWN_REASONS = ['timeout', 'transport'] as const;\n\n/** One member of {@link GATEWAY_WRITE_OUTCOME_UNKNOWN_REASONS}. */\nexport type GatewayWriteOutcomeUnknownReason =\n (typeof GATEWAY_WRITE_OUTCOME_UNKNOWN_REASONS)[number];\n\n/**\n * The `GatewayReads` options that are refused when missing or of the wrong type\n * (`INVALID_READS_OPTION.params.option`). `requestTimeoutMs` has its own code (`INVALID_TIMEOUT`).\n */\nexport const GATEWAY_READS_OPTIONS = ['gatewayBaseUrl', 'httpRequestor'] as const;\n\n/** One member of {@link GATEWAY_READS_OPTIONS}. */\nexport type GatewayReadsOption = (typeof GATEWAY_READS_OPTIONS)[number];\n\n/**\n * The part of a paginated read that was refused (`INVALID_PAGE_REQUEST.params.field`):\n *\n * - `limit` / `pageSize`: results per page, a whole number from 1 to 10 000;\n * - `maxPages`: how many pages a `fetchAll...` read may walk, a whole number from 1 to 10 000;\n * - `bookmark`: the previous page's `nextPageBookmark`, a string.\n */\nexport const PAGE_REQUEST_FIELDS = ['limit', 'pageSize', 'maxPages', 'bookmark'] as const;\n\n/** One member of {@link PAGE_REQUEST_FIELDS}. */\nexport type PageRequestField = (typeof PAGE_REQUEST_FIELDS)[number];\n\n/**\n * Why a wallet provider is not connected (`WALLET_NOT_CONNECTED.params.reason`):\n *\n * - `not_connected`: `connect()` was never called, or `disconnect()` was;\n * - `disconnected`: the wallet reported it is disconnected (EIP-1193 `4900` / `4901`, a\n * `disconnect` event, or an `accountsChanged` with no account);\n * - `unauthorized`: the wallet refused the account (EIP-1193 `4100`): the person has not granted\n * this app access to it.\n */\nexport const WALLET_NOT_CONNECTED_REASONS = [\n 'not_connected',\n 'disconnected',\n 'unauthorized',\n] as const;\n\n/** One member of {@link WALLET_NOT_CONNECTED_REASONS}. */\nexport type WalletNotConnectedReason = (typeof WALLET_NOT_CONNECTED_REASONS)[number];\n\n/**\n * Why connecting a wallet provider failed (`WALLET_CONNECTION_FAILED.params.reason`):\n *\n * - `no_accounts`: the wallet answered `eth_requestAccounts` with no account;\n * - `user_rejected`: the person declined the connection in their wallet (EIP-1193 `4001`);\n * - `failed`: anything else the wallet threw (the original error is `cause`).\n */\nexport const WALLET_CONNECTION_FAILURE_REASONS = [\n 'no_accounts',\n 'user_rejected',\n 'failed',\n] as const;\n\n/** One member of {@link WALLET_CONNECTION_FAILURE_REASONS}. */\nexport type WalletConnectionFailureReason = (typeof WALLET_CONNECTION_FAILURE_REASONS)[number];\n\n/**\n * What a wallet provider was built without (`INVALID_WALLET_PROVIDER_CONFIG.params.missing`):\n *\n * - `eip1193_provider`: an `ExternalWalletProvider` / `GalaWalletProvider` needs the wallet's\n * provider object (`window.ethereum`, an EIP-6963 announcement, `window.gala`);\n * - `private_key_or_eip1193_provider`: `createWalletProvider` needs one of the two.\n */\nexport const WALLET_PROVIDER_CONFIG_MISSING = [\n 'eip1193_provider',\n 'private_key_or_eip1193_provider',\n] as const;\n\n/** One member of {@link WALLET_PROVIDER_CONFIG_MISSING}. */\nexport type WalletProviderConfigMissing = (typeof WALLET_PROVIDER_CONFIG_MISSING)[number];\n\n/**\n * Why `createWallet` refused its input (`INVALID_WALLET_INPUT.params.reason`), never naming any part\n * of it (it may be a key or a mnemonic):\n *\n * - `empty`: nothing but whitespace;\n * - `unrecognized_format`: neither 64 hex digits nor 12 / 24 words of letters;\n * - `unknown_mnemonic_word`: a word that is not in the BIP-39 English wordlist;\n * - `mnemonic_checksum`: every word is known but the phrase's checksum is wrong (a typo or a\n * swapped word).\n */\nexport const WALLET_INPUT_PROBLEMS = [\n 'empty',\n 'unrecognized_format',\n 'unknown_mnemonic_word',\n 'mnemonic_checksum',\n] as const;\n\n/** One member of {@link WALLET_INPUT_PROBLEMS}. */\nexport type WalletInputProblem = (typeof WALLET_INPUT_PROBLEMS)[number];\n\n/** The external networks `./bridge` bridges to and from. */\nexport const BRIDGE_NETWORKS = ['Ethereum', 'Solana'] as const;\n\n/** One member of {@link BRIDGE_NETWORKS}. */\nexport type BridgeNetwork = (typeof BRIDGE_NETWORKS)[number];\n\n/**\n * Why a bridge amount was refused (`INVALID_BRIDGE_AMOUNT.params.reason`):\n *\n * - `not_a_number`: not a finite decimal number;\n * - `not_positive`: zero or negative (a bridge of nothing only wastes the fee);\n * - `too_many_decimals`: more decimal places than the token has (it would be rounded).\n */\nexport const BRIDGE_AMOUNT_PROBLEMS = [\n 'not_a_number',\n 'not_positive',\n 'too_many_decimals',\n] as const;\n\n/** One member of {@link BRIDGE_AMOUNT_PROBLEMS}. */\nexport type BridgeAmountProblem = (typeof BRIDGE_AMOUNT_PROBLEMS)[number];\n\n/**\n * Where a bridge-out failed AFTER GalaConnect accepted its `RequestTokenBridgeOut`\n * (`BRIDGE_OUT_OUTCOME_UNKNOWN.params.step`):\n *\n * - `request_id`: the answer had no bridge request id;\n * - `bridge_token_out`: the `BridgeTokenOut` call failed;\n * - `transaction_hash`: the `BridgeTokenOut` answer had no transaction hash.\n */\nexport const BRIDGE_OUT_STEPS = ['request_id', 'bridge_token_out', 'transaction_hash'] as const;\n\n/** One member of {@link BRIDGE_OUT_STEPS}. */\nexport type BridgeOutStep = (typeof BRIDGE_OUT_STEPS)[number];\n\n/**\n * Where a bridge-in deposit failed once it was being sent (`BRIDGE_DEPOSIT_OUTCOME_UNKNOWN.params.step`):\n *\n * - `send`: sending the deposit transaction failed (it may have reached the network);\n * - `confirmation`: the deposit was sent and its confirmation failed or is unknown;\n * - `registration`: the deposit is confirmed and registering it with GalaConnect failed.\n */\nexport const BRIDGE_DEPOSIT_STEPS = ['send', 'confirmation', 'registration'] as const;\n\n/** One member of {@link BRIDGE_DEPOSIT_STEPS}. */\nexport type BridgeDepositStep = (typeof BRIDGE_DEPOSIT_STEPS)[number];\n\n/**\n * Why a token cannot be wrapped or unwrapped (`TOKEN_NOT_WRAPPABLE.params.reason`):\n *\n * - `not_listed`: the wrappable token list does not have it;\n * - `no_counterpart`: the token it wraps to / unwraps from is not listed;\n * - `unknown_channel`: its channel (or its counterpart's) is not one a wrap moves between.\n */\nexport const WRAP_REFUSAL_REASONS = ['not_listed', 'no_counterpart', 'unknown_channel'] as const;\n\n/** One member of {@link WRAP_REFUSAL_REASONS}. */\nexport type WrapRefusalReason = (typeof WRAP_REFUSAL_REASONS)[number];\n\n/** The two cross-channel directions (`INVALID_WRAP_DIRECTION.params.direction`). */\nexport const WRAP_DIRECTIONS = ['wrap', 'unwrap'] as const;\n\n/** One member of {@link WRAP_DIRECTIONS}. */\nexport type WrapDirection = (typeof WRAP_DIRECTIONS)[number];\n\n/** The whole core catalog. Add a code here before throwing it anywhere in this package. */\nexport const GALA_ERROR_CATALOG = {\n // ---------------------------------------------------------------------------------- transport\n REQUEST_TIMEOUT: {\n phase: 'in_flight',\n template: 'Request to {url} timed out after {timeoutMs} ms.',\n params: { url: 'string', timeoutMs: 'number' },\n },\n TRANSPORT_ERROR: {\n phase: 'in_flight',\n template: 'The request to {url} failed before the server answered.',\n params: { url: 'string' },\n },\n INVALID_TIMEOUT: {\n phase: 'pre_send',\n template:\n '{field} must be a positive number of milliseconds, or Infinity for no timeout (got {value}).',\n params: { field: 'string', value: 'number' },\n },\n\n // ------------------------------------------------------------------------------ wallet / keys\n GALA_WALLET_NOT_AVAILABLE: {\n phase: 'pre_send',\n template: 'Gala wallet is not available. Please ensure the Gala wallet is connected.',\n params: {},\n },\n WALLET_UNAVAILABLE: {\n phase: 'pre_send',\n template: 'No wallet is connected.',\n params: {},\n },\n MALFORMED_WALLET_REQUEST: {\n phase: 'pre_send',\n template: 'Wallet {method} request is malformed.',\n params: { method: 'string' },\n },\n UNSUPPORTED_WALLET_METHOD: {\n phase: 'pre_send',\n template: 'Unsupported wallet method {method}.',\n params: { method: 'string' },\n },\n INVALID_SIGNATURE: {\n phase: 'pre_send',\n template: 'Wallet returned an invalid {scheme} signature.',\n params: { scheme: 'string' },\n },\n INVALID_CHAIN_ID: {\n phase: 'pre_send',\n template: 'Wallet returned an invalid chain id ({chainId}).',\n params: { chainId: 'string' },\n },\n SIGNER_ADDRESS_MISMATCH: {\n phase: 'pre_send',\n template: 'The signing key does not belong to the expected account.',\n params: {},\n },\n INVALID_PRIVATE_KEY: {\n phase: 'pre_send',\n template: 'Invalid private key: {reason}.',\n params: { reason: INVALID_PRIVATE_KEY_REASONS },\n },\n SIGNING_FAILED: {\n phase: 'pre_send',\n template: 'Signing the {method} request failed ({reason}); nothing was sent.',\n params: { method: 'string', reason: SIGNING_FAILURE_REASONS },\n },\n KEY_PROVIDER_FAILED: {\n phase: 'pre_send',\n template: 'The signing key could not be fetched; nothing was sent.',\n params: {},\n },\n INVALID_SIGNING_HASH_LENGTH: {\n phase: 'pre_send',\n template: 'secp256k1 can only sign a 32-byte hash (got {length}).',\n params: { length: 'number' },\n },\n INVALID_WALLET_ADDRESS: {\n phase: 'pre_send',\n template: 'Invalid {field}: \"{value}\" is not an accepted wallet address form.',\n params: { field: 'string', value: 'string' },\n },\n INVALID_ETH_USER_REF_PREFIX: {\n phase: 'pre_send',\n template:\n 'Invalid {field}: \"{value}\" is not a GalaChain user reference. An eth| reference takes the 40 hex digits of the account with no 0x prefix; write it as \"{expected}\".',\n params: { field: 'string', value: 'string', expected: 'string' },\n },\n INVALID_DECIMAL: {\n phase: 'pre_send',\n template: 'Invalid decimal quantity: {value}',\n params: { value: 'string' },\n },\n\n // ------------------------------------------------------------------------- personal-sign DTOs\n PERSONAL_SIGN_NOT_JSON: {\n phase: 'pre_send',\n template: 'Personal-sign DTO is not valid JSON',\n params: {},\n },\n PERSONAL_SIGN_NOT_OBJECT: {\n phase: 'pre_send',\n template: 'Personal-sign DTO must be a JSON object',\n params: {},\n },\n PERSONAL_SIGN_BAD_PREFIX: {\n phase: 'pre_send',\n template: 'Personal-sign DTO prefix is not an EIP-191 \"Ethereum Signed Message\" header',\n params: {},\n },\n PERSONAL_SIGN_ENVELOPE_FIELDS: {\n phase: 'pre_send',\n template: 'Personal-sign DTO carries signing-envelope field(s): {fields}',\n params: { fields: 'string' },\n },\n PERSONAL_SIGN_NOT_CANONICAL: {\n phase: 'pre_send',\n template: 'Personal-sign DTO is not in canonical serialized form',\n params: {},\n },\n\n // ------------------------------------------------------------------ EIP-712 payload derivation\n EIP712_NAME_COLLISION: {\n phase: 'pre_send',\n template: 'Name collisions are not supported when deriving EIP-712 types ({name}).',\n params: { name: 'string' },\n },\n EIP712_UNSUPPORTED_VALUE: {\n phase: 'pre_send',\n template: 'Unsupported EIP-712 value of type {valueType}.',\n params: { valueType: 'string' },\n },\n\n // ----------------------------------------------------------------------------- EIP-712 typed data\n TYPED_DATA_NOT_STRING: {\n phase: 'pre_send',\n template: 'Invalid typed data: {what} must be a string',\n params: { what: 'string' },\n },\n TYPED_DATA_UNPAIRED_SURROGATE: {\n phase: 'pre_send',\n template: 'Invalid typed data: {what} has an unpaired surrogate',\n params: { what: 'string' },\n },\n TYPED_DATA_NOT_HEX_BYTES: {\n phase: 'pre_send',\n template: 'Invalid typed data: {what} must be an even-length 0x hex string',\n params: { what: 'string' },\n },\n TYPED_DATA_NOT_SAFE_INTEGER: {\n phase: 'pre_send',\n template: 'Invalid typed data: {what} must be a safe integer',\n params: { what: 'string' },\n },\n TYPED_DATA_NOT_INTEGER: {\n phase: 'pre_send',\n template: 'Invalid typed data: {what} must be an integer',\n params: { what: 'string' },\n },\n TYPED_DATA_NOT_BOOLEAN: {\n phase: 'pre_send',\n template: 'Invalid typed data: bool must be a boolean',\n params: {},\n },\n TYPED_DATA_BAD_ADDRESS: {\n phase: 'pre_send',\n template: 'Invalid typed data: address must be 0x followed by 40 hex digits',\n params: {},\n },\n TYPED_DATA_BAD_CHECKSUM: {\n phase: 'pre_send',\n template: 'Invalid typed data: address has a bad checksum',\n params: {},\n },\n TYPED_DATA_BYTES_LENGTH: {\n phase: 'pre_send',\n template: 'Invalid typed data: {type} must be exactly {width} bytes',\n params: { type: 'string', width: 'number' },\n },\n TYPED_DATA_OUT_OF_BOUNDS: {\n phase: 'pre_send',\n template: 'Invalid typed data: value out of bounds for {type}',\n params: { type: 'string' },\n },\n TYPED_DATA_UNSUPPORTED_TYPE: {\n phase: 'pre_send',\n template: 'Invalid typed data: unsupported type \"{type}\"',\n params: { type: 'string' },\n },\n TYPED_DATA_FIELDS_NOT_LIST: {\n phase: 'pre_send',\n template: 'Invalid typed data: type {typeName} must be a list of fields',\n params: { typeName: 'string' },\n },\n TYPED_DATA_FIELD_MALFORMED: {\n phase: 'pre_send',\n template: 'Invalid typed data: type {typeName} has a field without a string name and type',\n params: { typeName: 'string' },\n },\n TYPED_DATA_INVALID_FIELD_NAME: {\n phase: 'pre_send',\n template: 'Invalid typed data: invalid field name \"{name}\"',\n params: { name: 'string' },\n },\n TYPED_DATA_DUPLICATE_FIELD: {\n phase: 'pre_send',\n template: 'Invalid typed data: duplicate field \"{name}\" in {typeName}',\n params: { name: 'string', typeName: 'string' },\n },\n TYPED_DATA_INVALID_TYPE_NAME: {\n phase: 'pre_send',\n template: 'Invalid typed data: invalid type name \"{name}\"',\n params: { name: 'string' },\n },\n TYPED_DATA_CIRCULAR_TYPE: {\n phase: 'pre_send',\n template: 'Invalid typed data: circular type reference in {typeName}',\n params: { typeName: 'string' },\n },\n TYPED_DATA_UNKNOWN_FIELD_TYPE: {\n phase: 'pre_send',\n template: 'Invalid typed data: unknown type \"{type}\" in {typeName}',\n params: { type: 'string', typeName: 'string' },\n },\n TYPED_DATA_NO_PRIMARY_TYPE: {\n phase: 'pre_send',\n template: 'Invalid typed data: missing primary type',\n params: {},\n },\n TYPED_DATA_AMBIGUOUS_PRIMARY_TYPE: {\n phase: 'pre_send',\n template: 'Invalid typed data: ambiguous primary types or unused types ({roots})',\n params: { roots: 'string' },\n },\n TYPED_DATA_ARRAY_EXPECTED: {\n phase: 'pre_send',\n template: 'Invalid typed data: {type} array value must be an array',\n params: { type: 'string' },\n },\n TYPED_DATA_ARRAY_LENGTH_MISMATCH: {\n phase: 'pre_send',\n template: 'Invalid typed data: array length mismatch',\n params: {},\n },\n TYPED_DATA_STRUCT_NOT_OBJECT: {\n phase: 'pre_send',\n template: 'Invalid typed data: {typeName} value must be an object',\n params: { typeName: 'string' },\n },\n TYPED_DATA_MISSING_FIELD: {\n phase: 'pre_send',\n template: 'Invalid typed data: {typeName} value is missing field \"{field}\"',\n params: { typeName: 'string', field: 'string' },\n },\n TYPED_DATA_DOMAIN_NOT_OBJECT: {\n phase: 'pre_send',\n template: 'Invalid typed data: domain must be an object',\n params: {},\n },\n TYPED_DATA_INVALID_DOMAIN_KEY: {\n phase: 'pre_send',\n template: 'Invalid typed data: invalid typed-data domain key {key}',\n params: { key: 'string' },\n },\n\n // ---------------------------------------------------------------------------------- unique keys\n INVALID_UNIQUE_KEY: {\n phase: 'pre_send',\n template:\n 'The uniqueKey \"{uniqueKey}\" must be 1-128 characters of A-Z, a-z, 0-9, \".\", \"_\", \":\" or \"-\".',\n params: { uniqueKey: 'string' },\n },\n INVALID_UNIQUE_KEY_PREFIX: {\n phase: 'pre_send',\n template:\n 'uniqueKeyPrefix \"{uniqueKeyPrefix}\" must be at most {maxLength} characters of A-Z, a-z, 0-9, \".\", \"_\", \":\" or \"-\".',\n params: { uniqueKeyPrefix: 'string', maxLength: 'number' },\n },\n CSPRNG_UNAVAILABLE: {\n phase: 'pre_send',\n template:\n 'No cryptographically secure random source (globalThis.crypto.getRandomValues) is available to mint a uniqueKey or a new wallet; install a getRandomValues polyfill (react-native-get-random-values on Hermes).',\n params: {},\n },\n\n // ----------------------------------------------------------------------------- gateway writes\n INVALID_WRITES_OPTION: {\n phase: 'pre_send',\n template: 'GatewayWrites option {option} is missing or is not of the expected type.',\n params: { option: GATEWAY_WRITES_OPTIONS },\n },\n INVALID_QUANTITY: {\n phase: 'pre_send',\n template:\n '{field} must be a positive decimal number of whole tokens, written as a string (got \"{value}\").',\n params: { field: 'string', value: 'string' },\n },\n INVALID_TOKEN_REFERENCE: {\n phase: 'pre_send',\n template: 'Invalid token reference {field}: {reason}.',\n params: { field: 'string', reason: INVALID_TOKEN_REFERENCE_REASONS },\n },\n INVALID_TOKEN_BATCH: {\n phase: 'pre_send',\n template: '{method} takes 1 to {max} tokens (got {count}).',\n params: { method: 'string', count: 'number', max: 'number' },\n },\n INVALID_LOCK_EXPIRES: {\n phase: 'pre_send',\n template:\n 'expires must be a non-negative whole number of epoch milliseconds, 0 for none (got {value}).',\n params: { value: 'string' },\n },\n INVALID_LOCK_NAME: {\n phase: 'pre_send',\n template: 'The lock name must be a string (got a {valueType}).',\n params: { valueType: 'string' },\n },\n INVALID_NFT_INPUT: {\n phase: 'pre_send',\n template: 'Invalid NFT input {field}: {reason}.',\n params: { field: 'string', reason: INVALID_NFT_INPUT_REASONS },\n },\n NO_TOKEN_NAME_RESOLVER: {\n phase: 'pre_send',\n template:\n 'The token name \"{tokenName}\" cannot be resolved: no tokenNameResolver is configured. Pass its tokenClassKey instead.',\n params: { tokenName: 'string' },\n },\n TOKEN_NAME_RESOLUTION_FAILED: {\n phase: 'pre_send',\n template:\n 'The token name \"{tokenName}\" could not be resolved to a token class key; nothing was sent.',\n params: { tokenName: 'string' },\n },\n GATEWAY_WRITE_OUTCOME_UNKNOWN: {\n phase: 'in_flight',\n template:\n 'The outcome of {method} is unknown ({reason}): the request may have reached the gateway. Check the write by its uniqueKey before sending it again.',\n params: { method: 'string', reason: GATEWAY_WRITE_OUTCOME_UNKNOWN_REASONS },\n },\n GATEWAY_HTTP_ERROR: {\n phase: 'post_send',\n template: 'The gateway answered {method} with HTTP {status}.',\n params: { method: 'string', status: 'number', serverMessage: 'string' },\n unrendered: ['serverMessage'],\n },\n GATEWAY_WRITE_REJECTED: {\n phase: 'post_send',\n template: 'GalaChain rejected {method} (Status {chainStatus}, error key \"{errorKey}\").',\n params: {\n method: 'string',\n chainStatus: 'number',\n errorKey: 'string',\n serverMessage: 'string',\n },\n unrendered: ['serverMessage'],\n },\n GATEWAY_RESPONSE_INVALID: {\n phase: 'post_send',\n template:\n 'The gateway answered {method} with something that is not a GalaChain result; the write may have been applied.',\n params: { method: 'string' },\n },\n\n // ------------------------------------------------------------------------------ gateway reads\n INVALID_READS_OPTION: {\n phase: 'pre_send',\n template: 'GatewayReads option {option} is missing or is not of the expected type.',\n params: { option: GATEWAY_READS_OPTIONS },\n },\n INVALID_PAGE_REQUEST: {\n phase: 'pre_send',\n template:\n '{field} is not valid for a paginated read (got {value}): a page size or page count is a whole number from 1 to 10000, a bookmark a string.',\n params: { field: PAGE_REQUEST_FIELDS, value: 'string' },\n },\n GATEWAY_READ_REJECTED: {\n phase: 'post_send',\n template: 'GalaChain refused {method} (Status {chainStatus}, error key \"{errorKey}\").',\n params: {\n method: 'string',\n chainStatus: 'number',\n errorKey: 'string',\n serverMessage: 'string',\n },\n unrendered: ['serverMessage'],\n },\n GATEWAY_READ_RESPONSE_INVALID: {\n phase: 'post_send',\n template: 'The gateway answered {method} with something that is not a usable GalaChain result.',\n params: { method: 'string' },\n },\n TOKEN_CLASS_NOT_FOUND: {\n phase: 'post_send',\n template: 'GalaChain has no token class {tokenClassKey}.',\n params: { tokenClassKey: 'string' },\n },\n PAGINATION_LIMIT_EXCEEDED: {\n phase: 'post_send',\n template:\n 'Reading every page of {method} takes more than {maxPages} pages; narrow the filter or raise maxPages.',\n params: { method: 'string', maxPages: 'number' },\n },\n\n // ------------------------------------------------------------- wallet providers (`./providers`)\n WALLET_NOT_CONNECTED: {\n phase: 'pre_send',\n template: 'The wallet is not connected ({reason}): connect it before {operation}.',\n params: { reason: WALLET_NOT_CONNECTED_REASONS, operation: 'string' },\n },\n WALLET_CONNECTION_FAILED: {\n phase: 'pre_send',\n template: 'Connecting to the wallet failed ({reason}).',\n params: { reason: WALLET_CONNECTION_FAILURE_REASONS },\n },\n INVALID_WALLET_PROVIDER_CONFIG: {\n phase: 'pre_send',\n template: 'A wallet provider cannot be built without {missing}.',\n params: { missing: WALLET_PROVIDER_CONFIG_MISSING },\n },\n PRIVATE_KEY_NOT_ACCESSIBLE: {\n phase: 'pre_send',\n template:\n 'This wallet provider signs in the wallet and cannot give out a private key; only a PrivateKeyProvider holds one.',\n params: {},\n },\n\n // ----------------------------------------------------------------------------- wallet helpers\n INVALID_WALLET_INPUT: {\n phase: 'pre_send',\n template:\n 'The wallet input was refused ({reason}): give a private key (64 hex digits) or a 12- or 24-word mnemonic.',\n params: { reason: WALLET_INPUT_PROBLEMS },\n },\n\n // ------------------------------------------------------------------------ bridge (`./bridge`)\n INVALID_BRIDGE_AMOUNT: {\n phase: 'pre_send',\n template: 'The bridge amount \"{value}\" was refused ({reason}).',\n params: { value: 'string', reason: BRIDGE_AMOUNT_PROBLEMS },\n },\n UNSUPPORTED_BRIDGE_TOKEN: {\n phase: 'pre_send',\n template: '{symbol} cannot be bridged with {network}.',\n params: { network: 'string', symbol: 'string' },\n },\n BRIDGE_NOT_CONFIGURED: {\n phase: 'pre_send',\n template:\n '{network} bridging is not configured: give the bridge a {network} private key (ethereumPrivateKey / solanaPrivateKey).',\n params: { network: BRIDGE_NETWORKS },\n },\n INVALID_TRANSACTION_HASH: {\n phase: 'pre_send',\n template: '\"{value}\" is not a {network} transaction hash.',\n params: { network: BRIDGE_NETWORKS, value: 'string' },\n },\n INVALID_BRIDGE_OPTION: {\n phase: 'pre_send',\n template: 'The bridge option {option} is missing or out of range.',\n params: { option: 'string' },\n },\n BRIDGE_RESPONSE_INVALID: {\n phase: 'post_send',\n template:\n 'GalaConnect answered {method} without a usable {missing}; the request may have been accepted.',\n params: { method: 'string', missing: 'string' },\n },\n BRIDGE_READ_RESPONSE_INVALID: {\n phase: 'post_send',\n template: 'GalaConnect answered {method} with something that is not a usable result.',\n params: { method: 'string' },\n },\n BRIDGE_WRITE_OUTCOME_UNKNOWN: {\n phase: 'in_flight',\n template:\n 'The outcome of {method} is unknown: the request failed in transit and may have reached GalaConnect. Check it before sending it again.',\n params: { method: 'string' },\n },\n GALACONNECT_HTTP_ERROR: {\n phase: 'post_send',\n template: 'GalaConnect answered {method} with HTTP {status}.',\n params: { method: 'string', status: 'number', serverMessage: 'string' },\n unrendered: ['serverMessage'],\n },\n BRIDGE_TOKEN_NOT_FOUND: {\n phase: 'post_send',\n template: 'GalaConnect has no verified bridge configuration for {symbol}.',\n params: { symbol: 'string' },\n },\n TOKEN_NOT_WRAPPABLE: {\n phase: 'post_send',\n template: '{tokenId} cannot be wrapped or unwrapped ({reason}).',\n params: { tokenId: 'string', reason: WRAP_REFUSAL_REASONS },\n },\n INVALID_WRAP_DIRECTION: {\n phase: 'pre_send',\n template:\n 'Cannot {direction} {symbol}: it is on the wrong channel for it (use the other direction).',\n params: { symbol: 'string', direction: WRAP_DIRECTIONS },\n },\n BRIDGE_REQUEST_REJECTED: {\n phase: 'post_send',\n template: 'GalaChain refused {method} (Status {chainStatus}, error key \"{errorKey}\").',\n params: {\n method: 'string',\n chainStatus: 'number',\n errorKey: 'string',\n serverMessage: 'string',\n },\n unrendered: ['serverMessage'],\n },\n BRIDGE_OUT_OUTCOME_UNKNOWN: {\n phase: 'in_flight',\n template:\n 'GalaConnect accepted the bridge-out request, which may have locked the tokens, then the bridge-out failed at {step}. Check it before bridging again.',\n params: { step: BRIDGE_OUT_STEPS, bridgeRequestId: 'string' },\n unrendered: ['bridgeRequestId'],\n },\n BRIDGE_DEPOSIT_OUTCOME_UNKNOWN: {\n phase: 'in_flight',\n template:\n 'The {network} bridge deposit may have been sent, then its {step} failed. Check the deposit before sending another.',\n params: { network: BRIDGE_NETWORKS, step: BRIDGE_DEPOSIT_STEPS, transactionHash: 'string' },\n unrendered: ['transactionHash'],\n },\n BRIDGE_CHAIN_READ_FAILED: {\n phase: 'post_send',\n template: 'The {network} read {call} failed or answered something unusable; nothing was sent.',\n params: { network: BRIDGE_NETWORKS, call: 'string' },\n },\n INSUFFICIENT_BRIDGE_BALANCE: {\n phase: 'pre_send',\n template: 'The {network} balance of {symbol} is {available}; the bridge needs {needed}.',\n params: { network: BRIDGE_NETWORKS, symbol: 'string', needed: 'string', available: 'string' },\n },\n BRIDGE_STATUS_TIMEOUT: {\n phase: 'in_flight',\n template:\n 'The bridge transaction did not reach a final status within {timeoutMs} ms (last status {lastStatus}); it may still complete.',\n params: { transactionHash: 'string', timeoutMs: 'number', lastStatus: 'number' },\n unrendered: ['transactionHash'],\n },\n\n // ------------------------------------------------------------------- React context (`./react`)\n WALLET_CONTEXT_MISSING: {\n phase: 'pre_send',\n template: 'The wallet hooks and the wallet context need a WalletProvider above them.',\n params: {},\n },\n} as const satisfies Record<string, GalaErrorCatalogEntry>;\n\n/** Every error code the core SDK can throw. */\nexport type GalaErrorCode = keyof typeof GALA_ERROR_CATALOG;\n\ninterface KindToType {\n string: string;\n number: number;\n boolean: boolean;\n}\n\n/** The value type of a param kind: a primitive, or the union of a closed set's members. */\ntype ParamValue<K> = K extends readonly (infer Member)[]\n ? Member\n : K extends keyof KindToType\n ? KindToType[K]\n : never;\n\n/**\n * The named params of code `C` of ANY catalog object (`typeof SOME_CATALOG`): a flat object of\n * primitives (or closed string tokens). A product SDK derives its own params type from its\n * catalog with it, so every catalog types its params the same way.\n */\nexport type ErrorParamsOf<\n Catalog extends Readonly<Record<string, GalaErrorCatalogEntry>>,\n C extends keyof Catalog,\n> = {\n readonly [P in keyof Catalog[C]['params']]: ParamValue<Catalog[C]['params'][P]>;\n};\n\n/** The named params of one core error code. */\nexport type GalaErrorParams<C extends GalaErrorCode> = ErrorParamsOf<typeof GALA_ERROR_CATALOG, C>;\n\n/**\n * The English template of every core error code, `{placeholder}` markers included. An optional\n * seed or fallback for an app's own translations; the SDK's `message` is generated from it. A\n * product SDK exports the templates of its own codes next to it.\n */\nexport const galaErrorTemplates: { readonly [C in GalaErrorCode]: string } = Object.fromEntries(\n Object.entries(GALA_ERROR_CATALOG).map(([code, entry]) => [code, entry.template]),\n) as { readonly [C in GalaErrorCode]: string };\n\nconst PLACEHOLDER = /\\{([A-Za-z0-9_]+)\\}/gu;\n\n/** Fills a template's `{placeholders}` from `params`; an unknown placeholder is left as written. */\nexport function renderGalaErrorTemplate(\n template: string,\n params: Readonly<Record<string, unknown>>,\n): string {\n return template.replace(PLACEHOLDER, (whole, name: string) => {\n const value = params[name];\n return typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean'\n ? String(value)\n : whole;\n });\n}\n\n/** The placeholder names a template uses, in order of first appearance. */\nexport function templatePlaceholders(template: string): string[] {\n return [...new Set([...template.matchAll(PLACEHOLDER)].map((match) => match[1] as string))];\n}\n"],"mappings":"AA6DA,MAAaA,EAA8B,CACzC,eACA,eACA,eACA,iBACF,EAeaC,EAA0B,CAAC,gBAAiB,QAAQ,EAiBpDC,EAAkC,CAC7C,UACA,YACA,gBACA,cACF,EASaC,EAA4B,CACvC,eACA,QACA,iBACA,8BACA,mBACA,iBACA,kBACA,qBACF,EAWaC,EAAyB,CACpC,SACA,iBACA,gBACA,mBACF,EAcaC,EAAwC,CAAC,UAAW,WAAW,EAU/DC,EAAwB,CAAC,iBAAkB,eAAe,EAY1DC,EAAsB,CAAC,QAAS,WAAY,WAAY,UAAU,EAclEC,EAA+B,CAC1C,gBACA,e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CAAC,CAAC,CAC5F,C"}
1
+ {"version":3,"file":"error_catalog.js","names":["INVALID_PRIVATE_KEY_REASONS","SIGNING_FAILURE_REASONS","INVALID_TOKEN_REFERENCE_REASONS","INVALID_NFT_INPUT_REASONS","INVALID_DTO_EXPIRES_AT_REASONS","GATEWAY_WRITES_OPTIONS","GATEWAY_WRITE_OUTCOME_UNKNOWN_REASONS","GATEWAY_READS_OPTIONS","PAGE_REQUEST_FIELDS","WALLET_NOT_CONNECTED_REASONS","WALLET_CONNECTION_FAILURE_REASONS","WALLET_PROVIDER_CONFIG_MISSING","WALLET_INPUT_PROBLEMS","BRIDGE_NETWORKS","BRIDGE_AMOUNT_PROBLEMS","BRIDGE_OUT_STEPS","BRIDGE_DEPOSIT_STEPS","WRAP_REFUSAL_REASONS","WRAP_DIRECTIONS","GALA_ERROR_CATALOG","galaErrorTemplates","code","entry","PLACEHOLDER","renderGalaErrorTemplate","template","value","params","name","whole","templatePlaceholders","match"],"sources":["../../../src/classes/error_catalog.ts"],"sourcesContent":["/**\n * The catalog of every error `@gala-chain/gala-core-sdk` throws: the SINGLE source of truth for\n * its `code`, the named parameters it carries and the English template its `message` is generated\n * from. A product SDK (gswap-sdk, launchpad-sdk) keeps its OWN catalog of the codes only it throws,\n * and its error class (a subclass of `GalaSDKError`) reads both; no code is defined twice.\n *\n * - `code` is the only discriminator. It is stable: apps branch on it, never on message text.\n * - `params` are the named placeholders of the error: a flat object of primitives (string,\n * number, boolean) that an app feeds to its own localization (i18next, ICU, FormatJS).\n * Raw server payloads are never params (they are `error.body` / `error.bodyText`), and no\n * secret (private key, signature, raw DTO) ever is.\n * - `template` is English with `{placeholder}` markers. `error.message` is generated from it\n * and the params, so the two cannot drift. It is for logs and developers: it is not stable and\n * must not be shown to users or matched on.\n *\n * Every placeholder in a template is a declared param and every declared param is a placeholder,\n * except the few `unrendered` params that carry server text for the app and are kept out of\n * `message` on purpose (pinned by tests/error_catalog.test.ts). Facts that are not placeholders\n * (HTTP status, URL, `uniqueKey`, transaction ids, the raw body, the cause) are typed properties of\n * the error, see {@link GalaErrorContext}.\n */\n\nimport type { GalaErrorPhase } from './error_phases.js';\n\n/**\n * The kinds a param can have: a primitive, or a CLOSED set of string tokens (a readonly tuple).\n * A closed set is a documented union: an app maps each member to its own text and can check that\n * it covered all of them, and a new member is a compile error until it does.\n */\nexport type GalaErrorParamKind = 'string' | 'number' | 'boolean' | readonly string[];\n\n/** One catalog entry (of this catalog, or of a product SDK's own catalog). */\nexport interface GalaErrorCatalogEntry {\n /** The phase this code is thrown in, unless a throw site says otherwise (see {@link GalaErrorPhase}). */\n readonly phase: GalaErrorPhase;\n /** English message template with `{placeholder}` markers. */\n readonly template: string;\n /** Param name to kind. Every param is required and appears in the template, except `unrendered`. */\n readonly params: Readonly<Record<string, GalaErrorParamKind>>;\n /**\n * Params that are carried for the app but deliberately NOT placeholders of the template. Used\n * for `serverMessage` on the codes whose failing answer may be anything (a proxy's page, a\n * validation list): the server's text is data for the app to relay or ignore, and keeping it out\n * of `message` means it cannot reach a log line or a user interface by accident.\n */\n readonly unrendered?: readonly string[];\n}\n\n/**\n * Why a private key was refused (`INVALID_PRIVATE_KEY.params.reason`). A token for the app to map\n * to its own text, never English and never any part of the key.\n *\n * - `wrong_length`: raw bytes that are not 32 bytes long (a `./bridge` Solana secret key: not 64\n * bytes once decoded).\n * - `bad_encoding`: a string that is neither 64 hex characters (optionally `0x`-prefixed, 63 is\n * left-padded) nor a 44-character base64 string (`./bridge`: an Ethereum key that is not `0x`\n * and 64 hex characters; a Solana secret key that is not base58, or whose public half does not\n * match its secret half).\n * - `not_on_curve`: 32 bytes that are not a valid secp256k1 secret scalar.\n * - `no_key_provided`: a lazy key provider returned something that is not a string.\n */\nexport const INVALID_PRIVATE_KEY_REASONS = [\n 'wrong_length',\n 'bad_encoding',\n 'not_on_curve',\n 'no_key_provided',\n] as const;\n\n/** One member of {@link INVALID_PRIVATE_KEY_REASONS}. */\nexport type InvalidPrivateKeyReason = (typeof INVALID_PRIVATE_KEY_REASONS)[number];\n\n/**\n * Why a signer could not produce a signature (`SIGNING_FAILED.params.reason`). A token for the\n * app to map to its own text.\n *\n * - `user_rejected`: the person declined in their wallet (an EIP-1193 `4001`, an ethers\n * `ACTION_REJECTED`, or a wallet that words it \"User rejected/denied ...\"). Nothing is wrong:\n * they may simply try again.\n * - `failed`: anything else the signer threw (a locked wallet, an unreachable extension, a wallet\n * that refused). The original error is `cause`.\n */\nexport const SIGNING_FAILURE_REASONS = ['user_rejected', 'failed'] as const;\n\n/** One member of {@link SIGNING_FAILURE_REASONS}. */\nexport type SigningFailureReason = (typeof SIGNING_FAILURE_REASONS)[number];\n\n/**\n * Why a gateway write refused the token it was asked to move\n * (`INVALID_TOKEN_REFERENCE.params.reason`). A token for the app to map to its own text.\n *\n * - `missing`: neither `tokenClassKey` nor `tokenName` was given.\n * - `ambiguous`: more than one way of naming the token was given (`tokenClassKey` and\n * `tokenName`, or a `tokenName` with an `instance`: a resolved name decides its own instance).\n * - `bad_class_key`: `tokenClassKey` is not a class key: a pipe string needs exactly four\n * non-empty parts, a `$` string at least four (split from the right), an object four non-empty\n * strings. A bare symbol is never a class key and none is derived from it.\n * - `bad_instance`: `instance` is not a string of decimal digits.\n */\nexport const INVALID_TOKEN_REFERENCE_REASONS = [\n 'missing',\n 'ambiguous',\n 'bad_class_key',\n 'bad_instance',\n] as const;\n\n/** One member of {@link INVALID_TOKEN_REFERENCE_REASONS}. */\nexport type InvalidTokenReferenceReason = (typeof INVALID_TOKEN_REFERENCE_REASONS)[number];\n\n/**\n * Why an NFT read's, write's or fee quote's input is refused (`INVALID_NFT_INPUT.params.reason`).\n * A token for the app to map to its own text.\n */\nexport const INVALID_NFT_INPUT_REASONS = [\n 'not_a_string',\n 'empty',\n 'bad_characters',\n 'not_a_positive_whole_number',\n 'above_mint_limit',\n 'bad_public_key',\n 'bad_authorities',\n 'bad_collection_name',\n] as const;\n\n/** One member of {@link INVALID_NFT_INPUT_REASONS}. */\nexport type InvalidNftInputReason = (typeof INVALID_NFT_INPUT_REASONS)[number];\n\n/**\n * Why a signed DTO's expiry is refused (`INVALID_DTO_EXPIRES_AT.params.reason`). A token for the\n * app to map to its own text.\n *\n * - `not_a_safe_integer`: not a JS number that is a safe integer (`NaN`, `Infinity`, a fraction, a\n * string, a bigint, a value beyond `Number.MAX_SAFE_INTEGER`).\n * - `not_positive`: `0` or below. The chain reads a falsy `dtoExpiresAt` as \"no expiry\", so `0`\n * is never signed as one.\n * - `expired`: the deadline is not after the builder's clock (a wallet builder refuses to sign a\n * DTO the chain would already refuse or refuse within the same millisecond).\n * - `expiry_window`: the deadline is more than the wallet builder's window ahead of its clock, or\n * an `expiresInMs` outside that window.\n * - `bad_shape`: a wallet builder expiry that is not exactly one of `{ dtoExpiresAt }` or\n * `{ expiresInMs, nowMs }` (never guessed between them).\n */\nexport const INVALID_DTO_EXPIRES_AT_REASONS = [\n 'not_a_safe_integer',\n 'not_positive',\n 'expired',\n 'expiry_window',\n 'bad_shape',\n] as const;\n\n/** One member of {@link INVALID_DTO_EXPIRES_AT_REASONS}. */\nexport type InvalidDtoExpiresAtReason = (typeof INVALID_DTO_EXPIRES_AT_REASONS)[number];\n\n/**\n * The `GatewayWrites` options that are refused when missing or of the wrong type\n * (`INVALID_WRITES_OPTION.params.option`). `walletAddress`, `requestTimeoutMs` and\n * `uniqueKeyPrefix` have codes of their own (`INVALID_WALLET_ADDRESS`, `INVALID_TIMEOUT`,\n * `INVALID_UNIQUE_KEY_PREFIX`).\n */\nexport const GATEWAY_WRITES_OPTIONS = [\n 'signer',\n 'gatewayBaseUrl',\n 'httpRequestor',\n 'tokenNameResolver',\n] as const;\n\n/** One member of {@link GATEWAY_WRITES_OPTIONS}. */\nexport type GatewayWritesOption = (typeof GATEWAY_WRITES_OPTIONS)[number];\n\n/**\n * Why the outcome of a gateway write is unknown (`GATEWAY_WRITE_OUTCOME_UNKNOWN.params.reason`).\n * Both say the same thing about the write (it MAY have been applied: never send it again under a\n * fresh key, check `error.uniqueKey` instead) and differ only in what happened to the request.\n *\n * - `timeout`: the POST exceeded `requestTimeoutMs`; the request may still be running.\n * - `transport`: the POST failed before an answer was read (offline, connection reset, DNS, CORS,\n * a body that broke off). The bytes may have reached the gateway.\n */\nexport const GATEWAY_WRITE_OUTCOME_UNKNOWN_REASONS = ['timeout', 'transport'] as const;\n\n/** One member of {@link GATEWAY_WRITE_OUTCOME_UNKNOWN_REASONS}. */\nexport type GatewayWriteOutcomeUnknownReason =\n (typeof GATEWAY_WRITE_OUTCOME_UNKNOWN_REASONS)[number];\n\n/**\n * The `GatewayReads` options that are refused when missing or of the wrong type\n * (`INVALID_READS_OPTION.params.option`). `requestTimeoutMs` has its own code (`INVALID_TIMEOUT`).\n */\nexport const GATEWAY_READS_OPTIONS = ['gatewayBaseUrl', 'httpRequestor'] as const;\n\n/** One member of {@link GATEWAY_READS_OPTIONS}. */\nexport type GatewayReadsOption = (typeof GATEWAY_READS_OPTIONS)[number];\n\n/**\n * The part of a paginated read that was refused (`INVALID_PAGE_REQUEST.params.field`):\n *\n * - `limit` / `pageSize`: results per page, a whole number from 1 to 10 000;\n * - `maxPages`: how many pages a `fetchAll...` read may walk, a whole number from 1 to 10 000;\n * - `bookmark`: the previous page's `nextPageBookmark`, a string.\n */\nexport const PAGE_REQUEST_FIELDS = ['limit', 'pageSize', 'maxPages', 'bookmark'] as const;\n\n/** One member of {@link PAGE_REQUEST_FIELDS}. */\nexport type PageRequestField = (typeof PAGE_REQUEST_FIELDS)[number];\n\n/**\n * Why a wallet provider is not connected (`WALLET_NOT_CONNECTED.params.reason`):\n *\n * - `not_connected`: `connect()` was never called, or `disconnect()` was;\n * - `disconnected`: the wallet reported it is disconnected (EIP-1193 `4900` / `4901`, a\n * `disconnect` event, or an `accountsChanged` with no account);\n * - `unauthorized`: the wallet refused the account (EIP-1193 `4100`): the person has not granted\n * this app access to it.\n */\nexport const WALLET_NOT_CONNECTED_REASONS = [\n 'not_connected',\n 'disconnected',\n 'unauthorized',\n] as const;\n\n/** One member of {@link WALLET_NOT_CONNECTED_REASONS}. */\nexport type WalletNotConnectedReason = (typeof WALLET_NOT_CONNECTED_REASONS)[number];\n\n/**\n * Why connecting a wallet provider failed (`WALLET_CONNECTION_FAILED.params.reason`):\n *\n * - `no_accounts`: the wallet answered `eth_requestAccounts` with no account;\n * - `user_rejected`: the person declined the connection in their wallet (EIP-1193 `4001`);\n * - `failed`: anything else the wallet threw (the original error is `cause`).\n */\nexport const WALLET_CONNECTION_FAILURE_REASONS = [\n 'no_accounts',\n 'user_rejected',\n 'failed',\n] as const;\n\n/** One member of {@link WALLET_CONNECTION_FAILURE_REASONS}. */\nexport type WalletConnectionFailureReason = (typeof WALLET_CONNECTION_FAILURE_REASONS)[number];\n\n/**\n * What a wallet provider was built without (`INVALID_WALLET_PROVIDER_CONFIG.params.missing`):\n *\n * - `eip1193_provider`: an `ExternalWalletProvider` / `GalaWalletProvider` needs the wallet's\n * provider object (`window.ethereum`, an EIP-6963 announcement, `window.gala`);\n * - `private_key_or_eip1193_provider`: `createWalletProvider` needs one of the two.\n */\nexport const WALLET_PROVIDER_CONFIG_MISSING = [\n 'eip1193_provider',\n 'private_key_or_eip1193_provider',\n] as const;\n\n/** One member of {@link WALLET_PROVIDER_CONFIG_MISSING}. */\nexport type WalletProviderConfigMissing = (typeof WALLET_PROVIDER_CONFIG_MISSING)[number];\n\n/**\n * Why `createWallet` refused its input (`INVALID_WALLET_INPUT.params.reason`), never naming any part\n * of it (it may be a key or a mnemonic):\n *\n * - `empty`: nothing but whitespace;\n * - `unrecognized_format`: neither 64 hex digits nor 12 / 24 words of letters;\n * - `unknown_mnemonic_word`: a word that is not in the BIP-39 English wordlist;\n * - `mnemonic_checksum`: every word is known but the phrase's checksum is wrong (a typo or a\n * swapped word).\n */\nexport const WALLET_INPUT_PROBLEMS = [\n 'empty',\n 'unrecognized_format',\n 'unknown_mnemonic_word',\n 'mnemonic_checksum',\n] as const;\n\n/** One member of {@link WALLET_INPUT_PROBLEMS}. */\nexport type WalletInputProblem = (typeof WALLET_INPUT_PROBLEMS)[number];\n\n/** The external networks `./bridge` bridges to and from. */\nexport const BRIDGE_NETWORKS = ['Ethereum', 'Solana'] as const;\n\n/** One member of {@link BRIDGE_NETWORKS}. */\nexport type BridgeNetwork = (typeof BRIDGE_NETWORKS)[number];\n\n/**\n * Why a bridge amount was refused (`INVALID_BRIDGE_AMOUNT.params.reason`):\n *\n * - `not_a_number`: not a finite decimal number;\n * - `not_positive`: zero or negative (a bridge of nothing only wastes the fee);\n * - `too_many_decimals`: more decimal places than the token has (it would be rounded).\n */\nexport const BRIDGE_AMOUNT_PROBLEMS = [\n 'not_a_number',\n 'not_positive',\n 'too_many_decimals',\n] as const;\n\n/** One member of {@link BRIDGE_AMOUNT_PROBLEMS}. */\nexport type BridgeAmountProblem = (typeof BRIDGE_AMOUNT_PROBLEMS)[number];\n\n/**\n * Where a bridge-out failed AFTER GalaConnect accepted its `RequestTokenBridgeOut`\n * (`BRIDGE_OUT_OUTCOME_UNKNOWN.params.step`):\n *\n * - `request_id`: the answer had no bridge request id;\n * - `bridge_token_out`: the `BridgeTokenOut` call failed;\n * - `transaction_hash`: the `BridgeTokenOut` answer had no transaction hash.\n */\nexport const BRIDGE_OUT_STEPS = ['request_id', 'bridge_token_out', 'transaction_hash'] as const;\n\n/** One member of {@link BRIDGE_OUT_STEPS}. */\nexport type BridgeOutStep = (typeof BRIDGE_OUT_STEPS)[number];\n\n/**\n * Where a bridge-in deposit failed once it was being sent (`BRIDGE_DEPOSIT_OUTCOME_UNKNOWN.params.step`):\n *\n * - `send`: sending the deposit transaction failed (it may have reached the network);\n * - `confirmation`: the deposit was sent and its confirmation failed or is unknown;\n * - `registration`: the deposit is confirmed and registering it with GalaConnect failed.\n */\nexport const BRIDGE_DEPOSIT_STEPS = ['send', 'confirmation', 'registration'] as const;\n\n/** One member of {@link BRIDGE_DEPOSIT_STEPS}. */\nexport type BridgeDepositStep = (typeof BRIDGE_DEPOSIT_STEPS)[number];\n\n/**\n * Why a token cannot be wrapped or unwrapped (`TOKEN_NOT_WRAPPABLE.params.reason`):\n *\n * - `not_listed`: the wrappable token list does not have it;\n * - `no_counterpart`: the token it wraps to / unwraps from is not listed;\n * - `unknown_channel`: its channel (or its counterpart's) is not one a wrap moves between.\n */\nexport const WRAP_REFUSAL_REASONS = ['not_listed', 'no_counterpart', 'unknown_channel'] as const;\n\n/** One member of {@link WRAP_REFUSAL_REASONS}. */\nexport type WrapRefusalReason = (typeof WRAP_REFUSAL_REASONS)[number];\n\n/** The two cross-channel directions (`INVALID_WRAP_DIRECTION.params.direction`). */\nexport const WRAP_DIRECTIONS = ['wrap', 'unwrap'] as const;\n\n/** One member of {@link WRAP_DIRECTIONS}. */\nexport type WrapDirection = (typeof WRAP_DIRECTIONS)[number];\n\n/** The whole core catalog. Add a code here before throwing it anywhere in this package. */\nexport const GALA_ERROR_CATALOG = {\n // ---------------------------------------------------------------------------------- transport\n REQUEST_TIMEOUT: {\n phase: 'in_flight',\n template: 'Request to {url} timed out after {timeoutMs} ms.',\n params: { url: 'string', timeoutMs: 'number' },\n },\n TRANSPORT_ERROR: {\n phase: 'in_flight',\n template: 'The request to {url} failed before the server answered.',\n params: { url: 'string' },\n },\n INVALID_TIMEOUT: {\n phase: 'pre_send',\n template:\n '{field} must be a positive number of milliseconds, or Infinity for no timeout (got {value}).',\n params: { field: 'string', value: 'number' },\n },\n\n // ------------------------------------------------------------------------------ wallet / keys\n GALA_WALLET_NOT_AVAILABLE: {\n phase: 'pre_send',\n template: 'Gala wallet is not available. Please ensure the Gala wallet is connected.',\n params: {},\n },\n WALLET_UNAVAILABLE: {\n phase: 'pre_send',\n template: 'No wallet is connected.',\n params: {},\n },\n MALFORMED_WALLET_REQUEST: {\n phase: 'pre_send',\n template: 'Wallet {method} request is malformed.',\n params: { method: 'string' },\n },\n UNSUPPORTED_WALLET_METHOD: {\n phase: 'pre_send',\n template: 'Unsupported wallet method {method}.',\n params: { method: 'string' },\n },\n INVALID_SIGNATURE: {\n phase: 'pre_send',\n template: 'Wallet returned an invalid {scheme} signature.',\n params: { scheme: 'string' },\n },\n INVALID_CHAIN_ID: {\n phase: 'pre_send',\n template: 'Wallet returned an invalid chain id ({chainId}).',\n params: { chainId: 'string' },\n },\n SIGNER_ADDRESS_MISMATCH: {\n phase: 'pre_send',\n template: 'The signing key does not belong to the expected account.',\n params: {},\n },\n INVALID_PRIVATE_KEY: {\n phase: 'pre_send',\n template: 'Invalid private key: {reason}.',\n params: { reason: INVALID_PRIVATE_KEY_REASONS },\n },\n SIGNING_FAILED: {\n phase: 'pre_send',\n template: 'Signing the {method} request failed ({reason}); nothing was sent.',\n params: { method: 'string', reason: SIGNING_FAILURE_REASONS },\n },\n KEY_PROVIDER_FAILED: {\n phase: 'pre_send',\n template: 'The signing key could not be fetched; nothing was sent.',\n params: {},\n },\n INVALID_SIGNING_HASH_LENGTH: {\n phase: 'pre_send',\n template: 'secp256k1 can only sign a 32-byte hash (got {length}).',\n params: { length: 'number' },\n },\n INVALID_WALLET_ADDRESS: {\n phase: 'pre_send',\n template: 'Invalid {field}: \"{value}\" is not an accepted wallet address form.',\n params: { field: 'string', value: 'string' },\n },\n INVALID_ETH_USER_REF_PREFIX: {\n phase: 'pre_send',\n template:\n 'Invalid {field}: \"{value}\" is not a GalaChain user reference. An eth| reference takes the 40 hex digits of the account with no 0x prefix; write it as \"{expected}\".',\n params: { field: 'string', value: 'string', expected: 'string' },\n },\n INVALID_DECIMAL: {\n phase: 'pre_send',\n template: 'Invalid decimal quantity: {value}',\n params: { value: 'string' },\n },\n\n // ------------------------------------------------------------------------- personal-sign DTOs\n PERSONAL_SIGN_NOT_JSON: {\n phase: 'pre_send',\n template: 'Personal-sign DTO is not valid JSON',\n params: {},\n },\n PERSONAL_SIGN_NOT_OBJECT: {\n phase: 'pre_send',\n template: 'Personal-sign DTO must be a JSON object',\n params: {},\n },\n PERSONAL_SIGN_BAD_PREFIX: {\n phase: 'pre_send',\n template: 'Personal-sign DTO prefix is not an EIP-191 \"Ethereum Signed Message\" header',\n params: {},\n },\n PERSONAL_SIGN_ENVELOPE_FIELDS: {\n phase: 'pre_send',\n template: 'Personal-sign DTO carries signing-envelope field(s): {fields}',\n params: { fields: 'string' },\n },\n PERSONAL_SIGN_NOT_CANONICAL: {\n phase: 'pre_send',\n template: 'Personal-sign DTO is not in canonical serialized form',\n params: {},\n },\n\n // ------------------------------------------------------------------ EIP-712 payload derivation\n EIP712_NAME_COLLISION: {\n phase: 'pre_send',\n template: 'Name collisions are not supported when deriving EIP-712 types ({name}).',\n params: { name: 'string' },\n },\n EIP712_UNSUPPORTED_VALUE: {\n phase: 'pre_send',\n template: 'Unsupported EIP-712 value of type {valueType}.',\n params: { valueType: 'string' },\n },\n\n // ----------------------------------------------------------------------------- EIP-712 typed data\n TYPED_DATA_NOT_STRING: {\n phase: 'pre_send',\n template: 'Invalid typed data: {what} must be a string',\n params: { what: 'string' },\n },\n TYPED_DATA_UNPAIRED_SURROGATE: {\n phase: 'pre_send',\n template: 'Invalid typed data: {what} has an unpaired surrogate',\n params: { what: 'string' },\n },\n TYPED_DATA_NOT_HEX_BYTES: {\n phase: 'pre_send',\n template: 'Invalid typed data: {what} must be an even-length 0x hex string',\n params: { what: 'string' },\n },\n TYPED_DATA_NOT_SAFE_INTEGER: {\n phase: 'pre_send',\n template: 'Invalid typed data: {what} must be a safe integer',\n params: { what: 'string' },\n },\n TYPED_DATA_NOT_INTEGER: {\n phase: 'pre_send',\n template: 'Invalid typed data: {what} must be an integer',\n params: { what: 'string' },\n },\n TYPED_DATA_NOT_BOOLEAN: {\n phase: 'pre_send',\n template: 'Invalid typed data: bool must be a boolean',\n params: {},\n },\n TYPED_DATA_BAD_ADDRESS: {\n phase: 'pre_send',\n template: 'Invalid typed data: address must be 0x followed by 40 hex digits',\n params: {},\n },\n TYPED_DATA_BAD_CHECKSUM: {\n phase: 'pre_send',\n template: 'Invalid typed data: address has a bad checksum',\n params: {},\n },\n TYPED_DATA_BYTES_LENGTH: {\n phase: 'pre_send',\n template: 'Invalid typed data: {type} must be exactly {width} bytes',\n params: { type: 'string', width: 'number' },\n },\n TYPED_DATA_OUT_OF_BOUNDS: {\n phase: 'pre_send',\n template: 'Invalid typed data: value out of bounds for {type}',\n params: { type: 'string' },\n },\n TYPED_DATA_UNSUPPORTED_TYPE: {\n phase: 'pre_send',\n template: 'Invalid typed data: unsupported type \"{type}\"',\n params: { type: 'string' },\n },\n TYPED_DATA_FIELDS_NOT_LIST: {\n phase: 'pre_send',\n template: 'Invalid typed data: type {typeName} must be a list of fields',\n params: { typeName: 'string' },\n },\n TYPED_DATA_FIELD_MALFORMED: {\n phase: 'pre_send',\n template: 'Invalid typed data: type {typeName} has a field without a string name and type',\n params: { typeName: 'string' },\n },\n TYPED_DATA_INVALID_FIELD_NAME: {\n phase: 'pre_send',\n template: 'Invalid typed data: invalid field name \"{name}\"',\n params: { name: 'string' },\n },\n TYPED_DATA_DUPLICATE_FIELD: {\n phase: 'pre_send',\n template: 'Invalid typed data: duplicate field \"{name}\" in {typeName}',\n params: { name: 'string', typeName: 'string' },\n },\n TYPED_DATA_INVALID_TYPE_NAME: {\n phase: 'pre_send',\n template: 'Invalid typed data: invalid type name \"{name}\"',\n params: { name: 'string' },\n },\n TYPED_DATA_CIRCULAR_TYPE: {\n phase: 'pre_send',\n template: 'Invalid typed data: circular type reference in {typeName}',\n params: { typeName: 'string' },\n },\n TYPED_DATA_UNKNOWN_FIELD_TYPE: {\n phase: 'pre_send',\n template: 'Invalid typed data: unknown type \"{type}\" in {typeName}',\n params: { type: 'string', typeName: 'string' },\n },\n TYPED_DATA_NO_PRIMARY_TYPE: {\n phase: 'pre_send',\n template: 'Invalid typed data: missing primary type',\n params: {},\n },\n TYPED_DATA_AMBIGUOUS_PRIMARY_TYPE: {\n phase: 'pre_send',\n template: 'Invalid typed data: ambiguous primary types or unused types ({roots})',\n params: { roots: 'string' },\n },\n TYPED_DATA_ARRAY_EXPECTED: {\n phase: 'pre_send',\n template: 'Invalid typed data: {type} array value must be an array',\n params: { type: 'string' },\n },\n TYPED_DATA_ARRAY_LENGTH_MISMATCH: {\n phase: 'pre_send',\n template: 'Invalid typed data: array length mismatch',\n params: {},\n },\n TYPED_DATA_STRUCT_NOT_OBJECT: {\n phase: 'pre_send',\n template: 'Invalid typed data: {typeName} value must be an object',\n params: { typeName: 'string' },\n },\n TYPED_DATA_MISSING_FIELD: {\n phase: 'pre_send',\n template: 'Invalid typed data: {typeName} value is missing field \"{field}\"',\n params: { typeName: 'string', field: 'string' },\n },\n TYPED_DATA_DOMAIN_NOT_OBJECT: {\n phase: 'pre_send',\n template: 'Invalid typed data: domain must be an object',\n params: {},\n },\n TYPED_DATA_INVALID_DOMAIN_KEY: {\n phase: 'pre_send',\n template: 'Invalid typed data: invalid typed-data domain key {key}',\n params: { key: 'string' },\n },\n\n // ---------------------------------------------------------------------------------- unique keys\n INVALID_UNIQUE_KEY: {\n phase: 'pre_send',\n template:\n 'The uniqueKey \"{uniqueKey}\" must be 1-128 characters of A-Z, a-z, 0-9, \".\", \"_\", \":\" or \"-\".',\n params: { uniqueKey: 'string' },\n },\n INVALID_UNIQUE_KEY_PREFIX: {\n phase: 'pre_send',\n template:\n 'uniqueKeyPrefix \"{uniqueKeyPrefix}\" must be at most {maxLength} characters of A-Z, a-z, 0-9, \".\", \"_\", \":\" or \"-\".',\n params: { uniqueKeyPrefix: 'string', maxLength: 'number' },\n },\n CSPRNG_UNAVAILABLE: {\n phase: 'pre_send',\n template:\n 'No cryptographically secure random source (globalThis.crypto.getRandomValues) is available to mint a uniqueKey or a new wallet; install a getRandomValues polyfill (react-native-get-random-values on Hermes).',\n params: {},\n },\n\n // ----------------------------------------------------------------------------- gateway writes\n INVALID_WRITES_OPTION: {\n phase: 'pre_send',\n template: 'GatewayWrites option {option} is missing or is not of the expected type.',\n params: { option: GATEWAY_WRITES_OPTIONS },\n },\n INVALID_QUANTITY: {\n phase: 'pre_send',\n template:\n '{field} must be a positive decimal number of whole tokens, written as a string (got \"{value}\").',\n params: { field: 'string', value: 'string' },\n },\n INVALID_TOKEN_REFERENCE: {\n phase: 'pre_send',\n template: 'Invalid token reference {field}: {reason}.',\n params: { field: 'string', reason: INVALID_TOKEN_REFERENCE_REASONS },\n },\n INVALID_TOKEN_BATCH: {\n phase: 'pre_send',\n template: '{method} takes 1 to {max} tokens (got {count}).',\n params: { method: 'string', count: 'number', max: 'number' },\n },\n INVALID_LOCK_EXPIRES: {\n phase: 'pre_send',\n template:\n 'expires must be a non-negative whole number of epoch milliseconds, 0 for none (got {value}).',\n params: { value: 'string' },\n },\n INVALID_DTO_EXPIRES_AT: {\n phase: 'pre_send',\n template: 'Invalid {field}: {reason}.',\n params: { field: 'string', reason: INVALID_DTO_EXPIRES_AT_REASONS },\n },\n INVALID_CONTRACT_PATH: {\n phase: 'pre_send',\n template:\n 'Invalid {field}: it names no contract this SDK knows a dtoOperation for; nothing was signed.',\n params: { field: 'string' },\n },\n INVALID_LOCK_NAME: {\n phase: 'pre_send',\n template: 'The lock name must be a string (got a {valueType}).',\n params: { valueType: 'string' },\n },\n INVALID_NFT_INPUT: {\n phase: 'pre_send',\n template: 'Invalid NFT input {field}: {reason}.',\n params: { field: 'string', reason: INVALID_NFT_INPUT_REASONS },\n },\n NO_TOKEN_NAME_RESOLVER: {\n phase: 'pre_send',\n template:\n 'The token name \"{tokenName}\" cannot be resolved: no tokenNameResolver is configured. Pass its tokenClassKey instead.',\n params: { tokenName: 'string' },\n },\n TOKEN_NAME_RESOLUTION_FAILED: {\n phase: 'pre_send',\n template:\n 'The token name \"{tokenName}\" could not be resolved to a token class key; nothing was sent.',\n params: { tokenName: 'string' },\n },\n GATEWAY_WRITE_OUTCOME_UNKNOWN: {\n phase: 'in_flight',\n template:\n 'The outcome of {method} is unknown ({reason}): the request may have reached the gateway. Check the write by its uniqueKey before sending it again.',\n params: { method: 'string', reason: GATEWAY_WRITE_OUTCOME_UNKNOWN_REASONS },\n },\n GATEWAY_HTTP_ERROR: {\n phase: 'post_send',\n template: 'The gateway answered {method} with HTTP {status}.',\n params: { method: 'string', status: 'number', serverMessage: 'string' },\n unrendered: ['serverMessage'],\n },\n GATEWAY_WRITE_REJECTED: {\n phase: 'post_send',\n template: 'GalaChain rejected {method} (Status {chainStatus}, error key \"{errorKey}\").',\n params: {\n method: 'string',\n chainStatus: 'number',\n errorKey: 'string',\n serverMessage: 'string',\n },\n unrendered: ['serverMessage'],\n },\n GATEWAY_RESPONSE_INVALID: {\n phase: 'post_send',\n template:\n 'The gateway answered {method} with something that is not a GalaChain result; the write may have been applied.',\n params: { method: 'string' },\n },\n\n // ------------------------------------------------------------------------------ gateway reads\n INVALID_READS_OPTION: {\n phase: 'pre_send',\n template: 'GatewayReads option {option} is missing or is not of the expected type.',\n params: { option: GATEWAY_READS_OPTIONS },\n },\n INVALID_PAGE_REQUEST: {\n phase: 'pre_send',\n template:\n '{field} is not valid for a paginated read (got {value}): a page size or page count is a whole number from 1 to 10000, a bookmark a string.',\n params: { field: PAGE_REQUEST_FIELDS, value: 'string' },\n },\n GATEWAY_READ_REJECTED: {\n phase: 'post_send',\n template: 'GalaChain refused {method} (Status {chainStatus}, error key \"{errorKey}\").',\n params: {\n method: 'string',\n chainStatus: 'number',\n errorKey: 'string',\n serverMessage: 'string',\n },\n unrendered: ['serverMessage'],\n },\n GATEWAY_READ_RESPONSE_INVALID: {\n phase: 'post_send',\n template: 'The gateway answered {method} with something that is not a usable GalaChain result.',\n params: { method: 'string' },\n },\n TOKEN_CLASS_NOT_FOUND: {\n phase: 'post_send',\n template: 'GalaChain has no token class {tokenClassKey}.',\n params: { tokenClassKey: 'string' },\n },\n PAGINATION_LIMIT_EXCEEDED: {\n phase: 'post_send',\n template:\n 'Reading every page of {method} takes more than {maxPages} pages; narrow the filter or raise maxPages.',\n params: { method: 'string', maxPages: 'number' },\n },\n\n // ------------------------------------------------------------- wallet providers (`./providers`)\n WALLET_NOT_CONNECTED: {\n phase: 'pre_send',\n template: 'The wallet is not connected ({reason}): connect it before {operation}.',\n params: { reason: WALLET_NOT_CONNECTED_REASONS, operation: 'string' },\n },\n WALLET_CONNECTION_FAILED: {\n phase: 'pre_send',\n template: 'Connecting to the wallet failed ({reason}).',\n params: { reason: WALLET_CONNECTION_FAILURE_REASONS },\n },\n INVALID_WALLET_PROVIDER_CONFIG: {\n phase: 'pre_send',\n template: 'A wallet provider cannot be built without {missing}.',\n params: { missing: WALLET_PROVIDER_CONFIG_MISSING },\n },\n PRIVATE_KEY_NOT_ACCESSIBLE: {\n phase: 'pre_send',\n template:\n 'This wallet provider signs in the wallet and cannot give out a private key; only a PrivateKeyProvider holds one.',\n params: {},\n },\n\n // ----------------------------------------------------------------------------- wallet helpers\n INVALID_WALLET_INPUT: {\n phase: 'pre_send',\n template:\n 'The wallet input was refused ({reason}): give a private key (64 hex digits) or a 12- or 24-word mnemonic.',\n params: { reason: WALLET_INPUT_PROBLEMS },\n },\n\n // ------------------------------------------------------------------------ bridge (`./bridge`)\n INVALID_BRIDGE_AMOUNT: {\n phase: 'pre_send',\n template: 'The bridge amount \"{value}\" was refused ({reason}).',\n params: { value: 'string', reason: BRIDGE_AMOUNT_PROBLEMS },\n },\n UNSUPPORTED_BRIDGE_TOKEN: {\n phase: 'pre_send',\n template: '{symbol} cannot be bridged with {network}.',\n params: { network: 'string', symbol: 'string' },\n },\n BRIDGE_NOT_CONFIGURED: {\n phase: 'pre_send',\n template:\n '{network} bridging is not configured: give the bridge a {network} private key (ethereumPrivateKey / solanaPrivateKey).',\n params: { network: BRIDGE_NETWORKS },\n },\n INVALID_TRANSACTION_HASH: {\n phase: 'pre_send',\n template: '\"{value}\" is not a {network} transaction hash.',\n params: { network: BRIDGE_NETWORKS, value: 'string' },\n },\n INVALID_BRIDGE_OPTION: {\n phase: 'pre_send',\n template: 'The bridge option {option} is missing or out of range.',\n params: { option: 'string' },\n },\n BRIDGE_RESPONSE_INVALID: {\n phase: 'post_send',\n template:\n 'GalaConnect answered {method} without a usable {missing}; the request may have been accepted.',\n params: { method: 'string', missing: 'string' },\n },\n BRIDGE_READ_RESPONSE_INVALID: {\n phase: 'post_send',\n template: 'GalaConnect answered {method} with something that is not a usable result.',\n params: { method: 'string' },\n },\n BRIDGE_WRITE_OUTCOME_UNKNOWN: {\n phase: 'in_flight',\n template:\n 'The outcome of {method} is unknown: the request failed in transit and may have reached GalaConnect. Check it before sending it again.',\n params: { method: 'string' },\n },\n GALACONNECT_HTTP_ERROR: {\n phase: 'post_send',\n template: 'GalaConnect answered {method} with HTTP {status}.',\n params: { method: 'string', status: 'number', serverMessage: 'string' },\n unrendered: ['serverMessage'],\n },\n BRIDGE_TOKEN_NOT_FOUND: {\n phase: 'post_send',\n template: 'GalaConnect has no verified bridge configuration for {symbol}.',\n params: { symbol: 'string' },\n },\n TOKEN_NOT_WRAPPABLE: {\n phase: 'post_send',\n template: '{tokenId} cannot be wrapped or unwrapped ({reason}).',\n params: { tokenId: 'string', reason: WRAP_REFUSAL_REASONS },\n },\n INVALID_WRAP_DIRECTION: {\n phase: 'pre_send',\n template:\n 'Cannot {direction} {symbol}: it is on the wrong channel for it (use the other direction).',\n params: { symbol: 'string', direction: WRAP_DIRECTIONS },\n },\n BRIDGE_REQUEST_REJECTED: {\n phase: 'post_send',\n template: 'GalaChain refused {method} (Status {chainStatus}, error key \"{errorKey}\").',\n params: {\n method: 'string',\n chainStatus: 'number',\n errorKey: 'string',\n serverMessage: 'string',\n },\n unrendered: ['serverMessage'],\n },\n BRIDGE_OUT_OUTCOME_UNKNOWN: {\n phase: 'in_flight',\n template:\n 'GalaConnect accepted the bridge-out request, which may have locked the tokens, then the bridge-out failed at {step}. Check it before bridging again.',\n params: { step: BRIDGE_OUT_STEPS, bridgeRequestId: 'string' },\n unrendered: ['bridgeRequestId'],\n },\n BRIDGE_DEPOSIT_OUTCOME_UNKNOWN: {\n phase: 'in_flight',\n template:\n 'The {network} bridge deposit may have been sent, then its {step} failed. Check the deposit before sending another.',\n params: { network: BRIDGE_NETWORKS, step: BRIDGE_DEPOSIT_STEPS, transactionHash: 'string' },\n unrendered: ['transactionHash'],\n },\n BRIDGE_CHAIN_READ_FAILED: {\n phase: 'post_send',\n template: 'The {network} read {call} failed or answered something unusable; nothing was sent.',\n params: { network: BRIDGE_NETWORKS, call: 'string' },\n },\n INSUFFICIENT_BRIDGE_BALANCE: {\n phase: 'pre_send',\n template: 'The {network} balance of {symbol} is {available}; the bridge needs {needed}.',\n params: { network: BRIDGE_NETWORKS, symbol: 'string', needed: 'string', available: 'string' },\n },\n BRIDGE_STATUS_TIMEOUT: {\n phase: 'in_flight',\n template:\n 'The bridge transaction did not reach a final status within {timeoutMs} ms (last status {lastStatus}); it may still complete.',\n params: { transactionHash: 'string', timeoutMs: 'number', lastStatus: 'number' },\n unrendered: ['transactionHash'],\n },\n\n // ------------------------------------------------------------------- React context (`./react`)\n WALLET_CONTEXT_MISSING: {\n phase: 'pre_send',\n template: 'The wallet hooks and the wallet context need a WalletProvider above them.',\n params: {},\n },\n} as const satisfies Record<string, GalaErrorCatalogEntry>;\n\n/** Every error code the core SDK can throw. */\nexport type GalaErrorCode = keyof typeof GALA_ERROR_CATALOG;\n\ninterface KindToType {\n string: string;\n number: number;\n boolean: boolean;\n}\n\n/** The value type of a param kind: a primitive, or the union of a closed set's members. */\ntype ParamValue<K> = K extends readonly (infer Member)[]\n ? Member\n : K extends keyof KindToType\n ? KindToType[K]\n : never;\n\n/**\n * The named params of code `C` of ANY catalog object (`typeof SOME_CATALOG`): a flat object of\n * primitives (or closed string tokens). A product SDK derives its own params type from its\n * catalog with it, so every catalog types its params the same way.\n */\nexport type ErrorParamsOf<\n Catalog extends Readonly<Record<string, GalaErrorCatalogEntry>>,\n C extends keyof Catalog,\n> = {\n readonly [P in keyof Catalog[C]['params']]: ParamValue<Catalog[C]['params'][P]>;\n};\n\n/** The named params of one core error code. */\nexport type GalaErrorParams<C extends GalaErrorCode> = ErrorParamsOf<typeof GALA_ERROR_CATALOG, C>;\n\n/**\n * The English template of every core error code, `{placeholder}` markers included. An optional\n * seed or fallback for an app's own translations; the SDK's `message` is generated from it. A\n * product SDK exports the templates of its own codes next to it.\n */\nexport const galaErrorTemplates: { readonly [C in GalaErrorCode]: string } = Object.fromEntries(\n Object.entries(GALA_ERROR_CATALOG).map(([code, entry]) => [code, entry.template]),\n) as { readonly [C in GalaErrorCode]: string };\n\nconst PLACEHOLDER = /\\{([A-Za-z0-9_]+)\\}/gu;\n\n/** Fills a template's `{placeholders}` from `params`; an unknown placeholder is left as written. */\nexport function renderGalaErrorTemplate(\n template: string,\n params: Readonly<Record<string, unknown>>,\n): string {\n return template.replace(PLACEHOLDER, (whole, name: string) => {\n const value = params[name];\n return typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean'\n ? String(value)\n : whole;\n });\n}\n\n/** The placeholder names a template uses, in order of first appearance. */\nexport function templatePlaceholders(template: string): string[] {\n return [...new Set([...template.matchAll(PLACEHOLDER)].map((match) => match[1] as string))];\n}\n"],"mappings":"AA6DA,MAAaA,EAA8B,CACzC,eACA,eACA,eACA,iBACF,EAeaC,EAA0B,CAAC,gBAAiB,QAAQ,EAiBpDC,EAAkC,CAC7C,UACA,YACA,gBACA,cACF,EASaC,EAA4B,CACvC,eACA,QACA,iBACA,8BACA,mBACA,iBACA,kBACA,qBACF,EAoBaC,EAAiC,CAC5C,qBACA,eACA,UACA,gBACA,WACF,EAWaC,EAAyB,CACpC,SACA,iBACA,gBACA,mBACF,EAcaC,EAAwC,CAAC,UAAW,WAAW,EAU/DC,EAAwB,CAAC,iBAAkB,eAAe,EAY1DC,EAAsB,CAAC,QAAS,WAAY,WAAY,UAAU,EAclEC,EAA+B,CAC1C,gBACA,eACA,cACF,EAYaC,EAAoC,CAC/C,cACA,gBACA,QACF,EAYaC,EAAiC,CAC5C,mBACA,iCACF,EAeaC,EAAwB,CACnC,QACA,sBACA,wBACA,mBACF,EAMaC,EAAkB,CAAC,WAAY,QAAQ,EAYvCC,EAAyB,CACpC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5F,C"}
@@ -1,2 +1,2 @@
1
- const e={REQUEST_TIMEOUT:`in_flight`,TRANSPORT_ERROR:`in_flight`,INVALID_TIMEOUT:`pre_send`,GALA_WALLET_NOT_AVAILABLE:`pre_send`,WALLET_UNAVAILABLE:`pre_send`,MALFORMED_WALLET_REQUEST:`pre_send`,UNSUPPORTED_WALLET_METHOD:`pre_send`,INVALID_SIGNATURE:`pre_send`,INVALID_CHAIN_ID:`pre_send`,SIGNER_ADDRESS_MISMATCH:`pre_send`,INVALID_PRIVATE_KEY:`pre_send`,SIGNING_FAILED:`pre_send`,KEY_PROVIDER_FAILED:`pre_send`,INVALID_SIGNING_HASH_LENGTH:`pre_send`,INVALID_WALLET_ADDRESS:`pre_send`,INVALID_ETH_USER_REF_PREFIX:`pre_send`,INVALID_DECIMAL:`pre_send`,PERSONAL_SIGN_NOT_JSON:`pre_send`,PERSONAL_SIGN_NOT_OBJECT:`pre_send`,PERSONAL_SIGN_BAD_PREFIX:`pre_send`,PERSONAL_SIGN_ENVELOPE_FIELDS:`pre_send`,PERSONAL_SIGN_NOT_CANONICAL:`pre_send`,EIP712_NAME_COLLISION:`pre_send`,EIP712_UNSUPPORTED_VALUE:`pre_send`,TYPED_DATA_NOT_STRING:`pre_send`,TYPED_DATA_UNPAIRED_SURROGATE:`pre_send`,TYPED_DATA_NOT_HEX_BYTES:`pre_send`,TYPED_DATA_NOT_SAFE_INTEGER:`pre_send`,TYPED_DATA_NOT_INTEGER:`pre_send`,TYPED_DATA_NOT_BOOLEAN:`pre_send`,TYPED_DATA_BAD_ADDRESS:`pre_send`,TYPED_DATA_BAD_CHECKSUM:`pre_send`,TYPED_DATA_BYTES_LENGTH:`pre_send`,TYPED_DATA_OUT_OF_BOUNDS:`pre_send`,TYPED_DATA_UNSUPPORTED_TYPE:`pre_send`,TYPED_DATA_FIELDS_NOT_LIST:`pre_send`,TYPED_DATA_FIELD_MALFORMED:`pre_send`,TYPED_DATA_INVALID_FIELD_NAME:`pre_send`,TYPED_DATA_DUPLICATE_FIELD:`pre_send`,TYPED_DATA_INVALID_TYPE_NAME:`pre_send`,TYPED_DATA_CIRCULAR_TYPE:`pre_send`,TYPED_DATA_UNKNOWN_FIELD_TYPE:`pre_send`,TYPED_DATA_NO_PRIMARY_TYPE:`pre_send`,TYPED_DATA_AMBIGUOUS_PRIMARY_TYPE:`pre_send`,TYPED_DATA_ARRAY_EXPECTED:`pre_send`,TYPED_DATA_ARRAY_LENGTH_MISMATCH:`pre_send`,TYPED_DATA_STRUCT_NOT_OBJECT:`pre_send`,TYPED_DATA_MISSING_FIELD:`pre_send`,TYPED_DATA_DOMAIN_NOT_OBJECT:`pre_send`,TYPED_DATA_INVALID_DOMAIN_KEY:`pre_send`,INVALID_UNIQUE_KEY:`pre_send`,INVALID_UNIQUE_KEY_PREFIX:`pre_send`,CSPRNG_UNAVAILABLE:`pre_send`,INVALID_WRITES_OPTION:`pre_send`,INVALID_QUANTITY:`pre_send`,INVALID_TOKEN_REFERENCE:`pre_send`,INVALID_TOKEN_BATCH:`pre_send`,INVALID_LOCK_EXPIRES:`pre_send`,INVALID_LOCK_NAME:`pre_send`,INVALID_NFT_INPUT:`pre_send`,NO_TOKEN_NAME_RESOLVER:`pre_send`,TOKEN_NAME_RESOLUTION_FAILED:`pre_send`,GATEWAY_WRITE_OUTCOME_UNKNOWN:`in_flight`,GATEWAY_HTTP_ERROR:`post_send`,GATEWAY_WRITE_REJECTED:`post_send`,GATEWAY_RESPONSE_INVALID:`post_send`,INVALID_READS_OPTION:`pre_send`,INVALID_PAGE_REQUEST:`pre_send`,GATEWAY_READ_REJECTED:`post_send`,GATEWAY_READ_RESPONSE_INVALID:`post_send`,TOKEN_CLASS_NOT_FOUND:`post_send`,PAGINATION_LIMIT_EXCEEDED:`post_send`,WALLET_NOT_CONNECTED:`pre_send`,WALLET_CONNECTION_FAILED:`pre_send`,INVALID_WALLET_PROVIDER_CONFIG:`pre_send`,PRIVATE_KEY_NOT_ACCESSIBLE:`pre_send`,INVALID_WALLET_INPUT:`pre_send`,INVALID_BRIDGE_AMOUNT:`pre_send`,UNSUPPORTED_BRIDGE_TOKEN:`pre_send`,BRIDGE_NOT_CONFIGURED:`pre_send`,INVALID_TRANSACTION_HASH:`pre_send`,INVALID_BRIDGE_OPTION:`pre_send`,BRIDGE_RESPONSE_INVALID:`post_send`,BRIDGE_READ_RESPONSE_INVALID:`post_send`,BRIDGE_WRITE_OUTCOME_UNKNOWN:`in_flight`,GALACONNECT_HTTP_ERROR:`post_send`,BRIDGE_TOKEN_NOT_FOUND:`post_send`,TOKEN_NOT_WRAPPABLE:`post_send`,INVALID_WRAP_DIRECTION:`pre_send`,BRIDGE_REQUEST_REJECTED:`post_send`,BRIDGE_OUT_OUTCOME_UNKNOWN:`in_flight`,BRIDGE_DEPOSIT_OUTCOME_UNKNOWN:`in_flight`,BRIDGE_CHAIN_READ_FAILED:`post_send`,INSUFFICIENT_BRIDGE_BALANCE:`pre_send`,BRIDGE_STATUS_TIMEOUT:`in_flight`,WALLET_CONTEXT_MISSING:`pre_send`};function t(t){return Object.hasOwn(e,t)}export{e as GALA_ERROR_PHASE_BY_CODE,t as isGalaCatalogCode};
1
+ const e={REQUEST_TIMEOUT:`in_flight`,TRANSPORT_ERROR:`in_flight`,INVALID_TIMEOUT:`pre_send`,GALA_WALLET_NOT_AVAILABLE:`pre_send`,WALLET_UNAVAILABLE:`pre_send`,MALFORMED_WALLET_REQUEST:`pre_send`,UNSUPPORTED_WALLET_METHOD:`pre_send`,INVALID_SIGNATURE:`pre_send`,INVALID_CHAIN_ID:`pre_send`,SIGNER_ADDRESS_MISMATCH:`pre_send`,INVALID_PRIVATE_KEY:`pre_send`,SIGNING_FAILED:`pre_send`,KEY_PROVIDER_FAILED:`pre_send`,INVALID_SIGNING_HASH_LENGTH:`pre_send`,INVALID_WALLET_ADDRESS:`pre_send`,INVALID_ETH_USER_REF_PREFIX:`pre_send`,INVALID_DECIMAL:`pre_send`,PERSONAL_SIGN_NOT_JSON:`pre_send`,PERSONAL_SIGN_NOT_OBJECT:`pre_send`,PERSONAL_SIGN_BAD_PREFIX:`pre_send`,PERSONAL_SIGN_ENVELOPE_FIELDS:`pre_send`,PERSONAL_SIGN_NOT_CANONICAL:`pre_send`,EIP712_NAME_COLLISION:`pre_send`,EIP712_UNSUPPORTED_VALUE:`pre_send`,TYPED_DATA_NOT_STRING:`pre_send`,TYPED_DATA_UNPAIRED_SURROGATE:`pre_send`,TYPED_DATA_NOT_HEX_BYTES:`pre_send`,TYPED_DATA_NOT_SAFE_INTEGER:`pre_send`,TYPED_DATA_NOT_INTEGER:`pre_send`,TYPED_DATA_NOT_BOOLEAN:`pre_send`,TYPED_DATA_BAD_ADDRESS:`pre_send`,TYPED_DATA_BAD_CHECKSUM:`pre_send`,TYPED_DATA_BYTES_LENGTH:`pre_send`,TYPED_DATA_OUT_OF_BOUNDS:`pre_send`,TYPED_DATA_UNSUPPORTED_TYPE:`pre_send`,TYPED_DATA_FIELDS_NOT_LIST:`pre_send`,TYPED_DATA_FIELD_MALFORMED:`pre_send`,TYPED_DATA_INVALID_FIELD_NAME:`pre_send`,TYPED_DATA_DUPLICATE_FIELD:`pre_send`,TYPED_DATA_INVALID_TYPE_NAME:`pre_send`,TYPED_DATA_CIRCULAR_TYPE:`pre_send`,TYPED_DATA_UNKNOWN_FIELD_TYPE:`pre_send`,TYPED_DATA_NO_PRIMARY_TYPE:`pre_send`,TYPED_DATA_AMBIGUOUS_PRIMARY_TYPE:`pre_send`,TYPED_DATA_ARRAY_EXPECTED:`pre_send`,TYPED_DATA_ARRAY_LENGTH_MISMATCH:`pre_send`,TYPED_DATA_STRUCT_NOT_OBJECT:`pre_send`,TYPED_DATA_MISSING_FIELD:`pre_send`,TYPED_DATA_DOMAIN_NOT_OBJECT:`pre_send`,TYPED_DATA_INVALID_DOMAIN_KEY:`pre_send`,INVALID_UNIQUE_KEY:`pre_send`,INVALID_UNIQUE_KEY_PREFIX:`pre_send`,CSPRNG_UNAVAILABLE:`pre_send`,INVALID_WRITES_OPTION:`pre_send`,INVALID_QUANTITY:`pre_send`,INVALID_TOKEN_REFERENCE:`pre_send`,INVALID_TOKEN_BATCH:`pre_send`,INVALID_LOCK_EXPIRES:`pre_send`,INVALID_DTO_EXPIRES_AT:`pre_send`,INVALID_CONTRACT_PATH:`pre_send`,INVALID_LOCK_NAME:`pre_send`,INVALID_NFT_INPUT:`pre_send`,NO_TOKEN_NAME_RESOLVER:`pre_send`,TOKEN_NAME_RESOLUTION_FAILED:`pre_send`,GATEWAY_WRITE_OUTCOME_UNKNOWN:`in_flight`,GATEWAY_HTTP_ERROR:`post_send`,GATEWAY_WRITE_REJECTED:`post_send`,GATEWAY_RESPONSE_INVALID:`post_send`,INVALID_READS_OPTION:`pre_send`,INVALID_PAGE_REQUEST:`pre_send`,GATEWAY_READ_REJECTED:`post_send`,GATEWAY_READ_RESPONSE_INVALID:`post_send`,TOKEN_CLASS_NOT_FOUND:`post_send`,PAGINATION_LIMIT_EXCEEDED:`post_send`,WALLET_NOT_CONNECTED:`pre_send`,WALLET_CONNECTION_FAILED:`pre_send`,INVALID_WALLET_PROVIDER_CONFIG:`pre_send`,PRIVATE_KEY_NOT_ACCESSIBLE:`pre_send`,INVALID_WALLET_INPUT:`pre_send`,INVALID_BRIDGE_AMOUNT:`pre_send`,UNSUPPORTED_BRIDGE_TOKEN:`pre_send`,BRIDGE_NOT_CONFIGURED:`pre_send`,INVALID_TRANSACTION_HASH:`pre_send`,INVALID_BRIDGE_OPTION:`pre_send`,BRIDGE_RESPONSE_INVALID:`post_send`,BRIDGE_READ_RESPONSE_INVALID:`post_send`,BRIDGE_WRITE_OUTCOME_UNKNOWN:`in_flight`,GALACONNECT_HTTP_ERROR:`post_send`,BRIDGE_TOKEN_NOT_FOUND:`post_send`,TOKEN_NOT_WRAPPABLE:`post_send`,INVALID_WRAP_DIRECTION:`pre_send`,BRIDGE_REQUEST_REJECTED:`post_send`,BRIDGE_OUT_OUTCOME_UNKNOWN:`in_flight`,BRIDGE_DEPOSIT_OUTCOME_UNKNOWN:`in_flight`,BRIDGE_CHAIN_READ_FAILED:`post_send`,INSUFFICIENT_BRIDGE_BALANCE:`pre_send`,BRIDGE_STATUS_TIMEOUT:`in_flight`,WALLET_CONTEXT_MISSING:`pre_send`};function t(t){return Object.hasOwn(e,t)}export{e as GALA_ERROR_PHASE_BY_CODE,t as isGalaCatalogCode};
2
2
  //# sourceMappingURL=error_phase_table.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"error_phase_table.js","names":["GALA_ERROR_PHASE_BY_CODE","isGalaCatalogCode","code"],"sources":["../../../src/classes/error_phase_table.ts"],"sourcesContent":["import type { GALA_ERROR_CATALOG, GalaErrorCode } from './error_catalog.js';\n\n/**\n * The phase of every core catalog code, WITHOUT the catalog. A failure guard (a product SDK's\n * `classifyFailure`, `mayHaveBeenQueued`, ...) needs only a code's phase, and the catalog's English\n * templates are several kB: reading the phase from here keeps an app shell that imports a guard\n * from loading them. The catalog entry is still where a code is declared; this table is checked\n * against it AT COMPILE TIME, in both directions (a missing code, an extra code or a different\n * phase is a type error), so the two cannot drift. A product SDK keeps the same kind of table for\n * its own codes.\n */\nexport const GALA_ERROR_PHASE_BY_CODE = {\n REQUEST_TIMEOUT: 'in_flight',\n TRANSPORT_ERROR: 'in_flight',\n INVALID_TIMEOUT: 'pre_send',\n GALA_WALLET_NOT_AVAILABLE: 'pre_send',\n WALLET_UNAVAILABLE: 'pre_send',\n MALFORMED_WALLET_REQUEST: 'pre_send',\n UNSUPPORTED_WALLET_METHOD: 'pre_send',\n INVALID_SIGNATURE: 'pre_send',\n INVALID_CHAIN_ID: 'pre_send',\n SIGNER_ADDRESS_MISMATCH: 'pre_send',\n INVALID_PRIVATE_KEY: 'pre_send',\n SIGNING_FAILED: 'pre_send',\n KEY_PROVIDER_FAILED: 'pre_send',\n INVALID_SIGNING_HASH_LENGTH: 'pre_send',\n INVALID_WALLET_ADDRESS: 'pre_send',\n INVALID_ETH_USER_REF_PREFIX: 'pre_send',\n INVALID_DECIMAL: 'pre_send',\n PERSONAL_SIGN_NOT_JSON: 'pre_send',\n PERSONAL_SIGN_NOT_OBJECT: 'pre_send',\n PERSONAL_SIGN_BAD_PREFIX: 'pre_send',\n PERSONAL_SIGN_ENVELOPE_FIELDS: 'pre_send',\n PERSONAL_SIGN_NOT_CANONICAL: 'pre_send',\n EIP712_NAME_COLLISION: 'pre_send',\n EIP712_UNSUPPORTED_VALUE: 'pre_send',\n TYPED_DATA_NOT_STRING: 'pre_send',\n TYPED_DATA_UNPAIRED_SURROGATE: 'pre_send',\n TYPED_DATA_NOT_HEX_BYTES: 'pre_send',\n TYPED_DATA_NOT_SAFE_INTEGER: 'pre_send',\n TYPED_DATA_NOT_INTEGER: 'pre_send',\n TYPED_DATA_NOT_BOOLEAN: 'pre_send',\n TYPED_DATA_BAD_ADDRESS: 'pre_send',\n TYPED_DATA_BAD_CHECKSUM: 'pre_send',\n TYPED_DATA_BYTES_LENGTH: 'pre_send',\n TYPED_DATA_OUT_OF_BOUNDS: 'pre_send',\n TYPED_DATA_UNSUPPORTED_TYPE: 'pre_send',\n TYPED_DATA_FIELDS_NOT_LIST: 'pre_send',\n TYPED_DATA_FIELD_MALFORMED: 'pre_send',\n TYPED_DATA_INVALID_FIELD_NAME: 'pre_send',\n TYPED_DATA_DUPLICATE_FIELD: 'pre_send',\n TYPED_DATA_INVALID_TYPE_NAME: 'pre_send',\n TYPED_DATA_CIRCULAR_TYPE: 'pre_send',\n TYPED_DATA_UNKNOWN_FIELD_TYPE: 'pre_send',\n TYPED_DATA_NO_PRIMARY_TYPE: 'pre_send',\n TYPED_DATA_AMBIGUOUS_PRIMARY_TYPE: 'pre_send',\n TYPED_DATA_ARRAY_EXPECTED: 'pre_send',\n TYPED_DATA_ARRAY_LENGTH_MISMATCH: 'pre_send',\n TYPED_DATA_STRUCT_NOT_OBJECT: 'pre_send',\n TYPED_DATA_MISSING_FIELD: 'pre_send',\n TYPED_DATA_DOMAIN_NOT_OBJECT: 'pre_send',\n TYPED_DATA_INVALID_DOMAIN_KEY: 'pre_send',\n INVALID_UNIQUE_KEY: 'pre_send',\n INVALID_UNIQUE_KEY_PREFIX: 'pre_send',\n CSPRNG_UNAVAILABLE: 'pre_send',\n INVALID_WRITES_OPTION: 'pre_send',\n INVALID_QUANTITY: 'pre_send',\n INVALID_TOKEN_REFERENCE: 'pre_send',\n INVALID_TOKEN_BATCH: 'pre_send',\n INVALID_LOCK_EXPIRES: 'pre_send',\n INVALID_LOCK_NAME: 'pre_send',\n INVALID_NFT_INPUT: 'pre_send',\n NO_TOKEN_NAME_RESOLVER: 'pre_send',\n TOKEN_NAME_RESOLUTION_FAILED: 'pre_send',\n GATEWAY_WRITE_OUTCOME_UNKNOWN: 'in_flight',\n GATEWAY_HTTP_ERROR: 'post_send',\n GATEWAY_WRITE_REJECTED: 'post_send',\n GATEWAY_RESPONSE_INVALID: 'post_send',\n INVALID_READS_OPTION: 'pre_send',\n INVALID_PAGE_REQUEST: 'pre_send',\n GATEWAY_READ_REJECTED: 'post_send',\n GATEWAY_READ_RESPONSE_INVALID: 'post_send',\n TOKEN_CLASS_NOT_FOUND: 'post_send',\n PAGINATION_LIMIT_EXCEEDED: 'post_send',\n WALLET_NOT_CONNECTED: 'pre_send',\n WALLET_CONNECTION_FAILED: 'pre_send',\n INVALID_WALLET_PROVIDER_CONFIG: 'pre_send',\n PRIVATE_KEY_NOT_ACCESSIBLE: 'pre_send',\n INVALID_WALLET_INPUT: 'pre_send',\n INVALID_BRIDGE_AMOUNT: 'pre_send',\n UNSUPPORTED_BRIDGE_TOKEN: 'pre_send',\n BRIDGE_NOT_CONFIGURED: 'pre_send',\n INVALID_TRANSACTION_HASH: 'pre_send',\n INVALID_BRIDGE_OPTION: 'pre_send',\n BRIDGE_RESPONSE_INVALID: 'post_send',\n BRIDGE_READ_RESPONSE_INVALID: 'post_send',\n BRIDGE_WRITE_OUTCOME_UNKNOWN: 'in_flight',\n GALACONNECT_HTTP_ERROR: 'post_send',\n BRIDGE_TOKEN_NOT_FOUND: 'post_send',\n TOKEN_NOT_WRAPPABLE: 'post_send',\n INVALID_WRAP_DIRECTION: 'pre_send',\n BRIDGE_REQUEST_REJECTED: 'post_send',\n BRIDGE_OUT_OUTCOME_UNKNOWN: 'in_flight',\n BRIDGE_DEPOSIT_OUTCOME_UNKNOWN: 'in_flight',\n BRIDGE_CHAIN_READ_FAILED: 'post_send',\n INSUFFICIENT_BRIDGE_BALANCE: 'pre_send',\n BRIDGE_STATUS_TIMEOUT: 'in_flight',\n WALLET_CONTEXT_MISSING: 'pre_send',\n} as const satisfies {\n readonly [C in GalaErrorCode]: (typeof GALA_ERROR_CATALOG)[C]['phase'];\n};\n\n/** True for a code the CORE catalog defines (a product SDK's own codes are not). */\nexport function isGalaCatalogCode(code: string): code is GalaErrorCode {\n return Object.hasOwn(GALA_ERROR_PHASE_BY_CODE, code);\n}\n"],"mappings":"AAWA,MAAaA,EAA2B,CACtC,gBAAiB,YACjB,gBAAiB,YACjB,gBAAiB,WACjB,0BAA2B,WAC3B,mBAAoB,WACpB,yBAA0B,WAC1B,0BAA2B,WAC3B,kBAAmB,WACnB,iBAAkB,WAClB,wBAAyB,WACzB,oBAAqB,WACrB,eAAgB,WAChB,oBAAqB,WACrB,4BAA6B,WAC7B,uBAAwB,WACxB,4BAA6B,WAC7B,gBAAiB,WACjB,uBAAwB,WACxB,yBAA0B,WAC1B,yBAA0B,WAC1B,8BAA+B,WAC/B,4BAA6B,WAC7B,sBAAuB,WACvB,yBAA0B,WAC1B,sBAAuB,WACvB,8BAA+B,WAC/B,yBAA0B,WAC1B,4BAA6B,WAC7B,uBAAwB,WACxB,uBAAwB,WACxB,uBAAwB,WACxB,wBAAyB,WACzB,wBAAyB,WACzB,yBAA0B,WAC1B,4BAA6B,WAC7B,2BAA4B,WAC5B,2BAA4B,WAC5B,8BAA+B,WAC/B,2BAA4B,WAC5B,6BAA8B,WAC9B,yBAA0B,WAC1B,8BAA+B,WAC/B,2BAA4B,WAC5B,kCAAmC,WACnC,0BAA2B,WAC3B,iCAAkC,WAClC,6BAA8B,WAC9B,yBAA0B,WAC1B,6BAA8B,WAC9B,8BAA+B,WAC/B,mBAAoB,WACpB,0BAA2B,WAC3B,mBAAoB,WACpB,sBAAuB,WACvB,iBAAkB,WAClB,wBAAyB,WACzB,oBAAqB,WACrB,qBAAsB,WACtB,kBAAmB,WACnB,kBAAmB,WACnB,uBAAwB,WACxB,6BAA8B,WAC9B,8BAA+B,YAC/B,mBAAoB,YACpB,uBAAwB,YACxB,yBAA0B,YAC1B,qBAAsB,WACtB,qBAAsB,WACtB,sBAAuB,YACvB,8BAA+B,YAC/B,sBAAuB,YACvB,0BAA2B,YAC3B,qBAAsB,WACtB,yBAA0B,WAC1B,+BAAgC,WAChC,2BAA4B,WAC5B,qBAAsB,WACtB,sBAAuB,WACvB,yBAA0B,WAC1B,sBAAuB,WACvB,yBAA0B,WAC1B,sBAAuB,WACvB,wBAAyB,YACzB,6BAA8B,YAC9B,6BAA8B,YAC9B,uBAAwB,YACxB,uBAAwB,YACxB,oBAAqB,YACrB,uBAAwB,WACxB,wBAAyB,YACzB,2BAA4B,YAC5B,+BAAgC,YAChC,yBAA0B,YAC1B,4BAA6B,WAC7B,sBAAuB,YACvB,uBAAwB,UAC1B,EAKA,SAAgBC,EAAkB,EAAqC,CACrE,OAAO,OAAO,OAAOD,EAA0BE,CAAI,CACrD,C"}
1
+ {"version":3,"file":"error_phase_table.js","names":["GALA_ERROR_PHASE_BY_CODE","isGalaCatalogCode","code"],"sources":["../../../src/classes/error_phase_table.ts"],"sourcesContent":["import type { GALA_ERROR_CATALOG, GalaErrorCode } from './error_catalog.js';\n\n/**\n * The phase of every core catalog code, WITHOUT the catalog. A failure guard (a product SDK's\n * `classifyFailure`, `mayHaveBeenQueued`, ...) needs only a code's phase, and the catalog's English\n * templates are several kB: reading the phase from here keeps an app shell that imports a guard\n * from loading them. The catalog entry is still where a code is declared; this table is checked\n * against it AT COMPILE TIME, in both directions (a missing code, an extra code or a different\n * phase is a type error), so the two cannot drift. A product SDK keeps the same kind of table for\n * its own codes.\n */\nexport const GALA_ERROR_PHASE_BY_CODE = {\n REQUEST_TIMEOUT: 'in_flight',\n TRANSPORT_ERROR: 'in_flight',\n INVALID_TIMEOUT: 'pre_send',\n GALA_WALLET_NOT_AVAILABLE: 'pre_send',\n WALLET_UNAVAILABLE: 'pre_send',\n MALFORMED_WALLET_REQUEST: 'pre_send',\n UNSUPPORTED_WALLET_METHOD: 'pre_send',\n INVALID_SIGNATURE: 'pre_send',\n INVALID_CHAIN_ID: 'pre_send',\n SIGNER_ADDRESS_MISMATCH: 'pre_send',\n INVALID_PRIVATE_KEY: 'pre_send',\n SIGNING_FAILED: 'pre_send',\n KEY_PROVIDER_FAILED: 'pre_send',\n INVALID_SIGNING_HASH_LENGTH: 'pre_send',\n INVALID_WALLET_ADDRESS: 'pre_send',\n INVALID_ETH_USER_REF_PREFIX: 'pre_send',\n INVALID_DECIMAL: 'pre_send',\n PERSONAL_SIGN_NOT_JSON: 'pre_send',\n PERSONAL_SIGN_NOT_OBJECT: 'pre_send',\n PERSONAL_SIGN_BAD_PREFIX: 'pre_send',\n PERSONAL_SIGN_ENVELOPE_FIELDS: 'pre_send',\n PERSONAL_SIGN_NOT_CANONICAL: 'pre_send',\n EIP712_NAME_COLLISION: 'pre_send',\n EIP712_UNSUPPORTED_VALUE: 'pre_send',\n TYPED_DATA_NOT_STRING: 'pre_send',\n TYPED_DATA_UNPAIRED_SURROGATE: 'pre_send',\n TYPED_DATA_NOT_HEX_BYTES: 'pre_send',\n TYPED_DATA_NOT_SAFE_INTEGER: 'pre_send',\n TYPED_DATA_NOT_INTEGER: 'pre_send',\n TYPED_DATA_NOT_BOOLEAN: 'pre_send',\n TYPED_DATA_BAD_ADDRESS: 'pre_send',\n TYPED_DATA_BAD_CHECKSUM: 'pre_send',\n TYPED_DATA_BYTES_LENGTH: 'pre_send',\n TYPED_DATA_OUT_OF_BOUNDS: 'pre_send',\n TYPED_DATA_UNSUPPORTED_TYPE: 'pre_send',\n TYPED_DATA_FIELDS_NOT_LIST: 'pre_send',\n TYPED_DATA_FIELD_MALFORMED: 'pre_send',\n TYPED_DATA_INVALID_FIELD_NAME: 'pre_send',\n TYPED_DATA_DUPLICATE_FIELD: 'pre_send',\n TYPED_DATA_INVALID_TYPE_NAME: 'pre_send',\n TYPED_DATA_CIRCULAR_TYPE: 'pre_send',\n TYPED_DATA_UNKNOWN_FIELD_TYPE: 'pre_send',\n TYPED_DATA_NO_PRIMARY_TYPE: 'pre_send',\n TYPED_DATA_AMBIGUOUS_PRIMARY_TYPE: 'pre_send',\n TYPED_DATA_ARRAY_EXPECTED: 'pre_send',\n TYPED_DATA_ARRAY_LENGTH_MISMATCH: 'pre_send',\n TYPED_DATA_STRUCT_NOT_OBJECT: 'pre_send',\n TYPED_DATA_MISSING_FIELD: 'pre_send',\n TYPED_DATA_DOMAIN_NOT_OBJECT: 'pre_send',\n TYPED_DATA_INVALID_DOMAIN_KEY: 'pre_send',\n INVALID_UNIQUE_KEY: 'pre_send',\n INVALID_UNIQUE_KEY_PREFIX: 'pre_send',\n CSPRNG_UNAVAILABLE: 'pre_send',\n INVALID_WRITES_OPTION: 'pre_send',\n INVALID_QUANTITY: 'pre_send',\n INVALID_TOKEN_REFERENCE: 'pre_send',\n INVALID_TOKEN_BATCH: 'pre_send',\n INVALID_LOCK_EXPIRES: 'pre_send',\n INVALID_DTO_EXPIRES_AT: 'pre_send',\n INVALID_CONTRACT_PATH: 'pre_send',\n INVALID_LOCK_NAME: 'pre_send',\n INVALID_NFT_INPUT: 'pre_send',\n NO_TOKEN_NAME_RESOLVER: 'pre_send',\n TOKEN_NAME_RESOLUTION_FAILED: 'pre_send',\n GATEWAY_WRITE_OUTCOME_UNKNOWN: 'in_flight',\n GATEWAY_HTTP_ERROR: 'post_send',\n GATEWAY_WRITE_REJECTED: 'post_send',\n GATEWAY_RESPONSE_INVALID: 'post_send',\n INVALID_READS_OPTION: 'pre_send',\n INVALID_PAGE_REQUEST: 'pre_send',\n GATEWAY_READ_REJECTED: 'post_send',\n GATEWAY_READ_RESPONSE_INVALID: 'post_send',\n TOKEN_CLASS_NOT_FOUND: 'post_send',\n PAGINATION_LIMIT_EXCEEDED: 'post_send',\n WALLET_NOT_CONNECTED: 'pre_send',\n WALLET_CONNECTION_FAILED: 'pre_send',\n INVALID_WALLET_PROVIDER_CONFIG: 'pre_send',\n PRIVATE_KEY_NOT_ACCESSIBLE: 'pre_send',\n INVALID_WALLET_INPUT: 'pre_send',\n INVALID_BRIDGE_AMOUNT: 'pre_send',\n UNSUPPORTED_BRIDGE_TOKEN: 'pre_send',\n BRIDGE_NOT_CONFIGURED: 'pre_send',\n INVALID_TRANSACTION_HASH: 'pre_send',\n INVALID_BRIDGE_OPTION: 'pre_send',\n BRIDGE_RESPONSE_INVALID: 'post_send',\n BRIDGE_READ_RESPONSE_INVALID: 'post_send',\n BRIDGE_WRITE_OUTCOME_UNKNOWN: 'in_flight',\n GALACONNECT_HTTP_ERROR: 'post_send',\n BRIDGE_TOKEN_NOT_FOUND: 'post_send',\n TOKEN_NOT_WRAPPABLE: 'post_send',\n INVALID_WRAP_DIRECTION: 'pre_send',\n BRIDGE_REQUEST_REJECTED: 'post_send',\n BRIDGE_OUT_OUTCOME_UNKNOWN: 'in_flight',\n BRIDGE_DEPOSIT_OUTCOME_UNKNOWN: 'in_flight',\n BRIDGE_CHAIN_READ_FAILED: 'post_send',\n INSUFFICIENT_BRIDGE_BALANCE: 'pre_send',\n BRIDGE_STATUS_TIMEOUT: 'in_flight',\n WALLET_CONTEXT_MISSING: 'pre_send',\n} as const satisfies {\n readonly [C in GalaErrorCode]: (typeof GALA_ERROR_CATALOG)[C]['phase'];\n};\n\n/** True for a code the CORE catalog defines (a product SDK's own codes are not). */\nexport function isGalaCatalogCode(code: string): code is GalaErrorCode {\n return Object.hasOwn(GALA_ERROR_PHASE_BY_CODE, code);\n}\n"],"mappings":"AAW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1B,sBAAuB,WACvB,yBAA0B,WAC1B,sBAAuB,WACvB,wBAAyB,YACzB,6BAA8B,YAC9B,6BAA8B,YAC9B,uBAAwB,YACxB,uBAAwB,YACxB,oBAAqB,YACrB,uBAAwB,WACxB,wBAAyB,YACzB,2BAA4B,YAC5B,+BAAgC,YAChC,yBAA0B,YAC1B,4BAA6B,WAC7B,sBAAuB,YACvB,uBAAwB,UAC1B,EAKA,SAAgBC,EAAkB,EAAqC,CACrE,OAAO,OAAO,OAAOD,EAA0BE,CAAI,CACrD,C"}
@@ -1 +1 @@
1
- import{BRIDGE_AMOUNT_PROBLEMS as e,BRIDGE_DEPOSIT_STEPS as t,BRIDGE_NETWORKS as n,BRIDGE_OUT_STEPS as r,GALA_ERROR_CATALOG as i,GATEWAY_READS_OPTIONS as a,GATEWAY_WRITES_OPTIONS as o,GATEWAY_WRITE_OUTCOME_UNKNOWN_REASONS as s,INVALID_NFT_INPUT_REASONS as c,INVALID_PRIVATE_KEY_REASONS as l,INVALID_TOKEN_REFERENCE_REASONS as u,PAGE_REQUEST_FIELDS as d,SIGNING_FAILURE_REASONS as f,WALLET_CONNECTION_FAILURE_REASONS as p,WALLET_INPUT_PROBLEMS as m,WALLET_NOT_CONNECTED_REASONS as h,WALLET_PROVIDER_CONFIG_MISSING as g,WRAP_DIRECTIONS as _,WRAP_REFUSAL_REASONS as v,galaErrorTemplates as y,renderGalaErrorTemplate as b,templatePlaceholders as x}from"./classes/error_catalog.js";import{GALA_ERROR_PHASE_BY_CODE as S,isGalaCatalogCode as C}from"./classes/error_phase_table.js";import{GALA_ERROR_PHASES as w}from"./classes/error_phases.js";import{hasGalaErrorBrand as T,isGalaErrorLike as E}from"./utils/error_brand.js";import{GalaSDKError as D,isGalaError as O,parseJson as k}from"./classes/gala_sdk_error.js";import{checksumEthereumAddress as A}from"./utils/eth_address.js";import{galaChainUserRef as j}from"./writes/identity.js";import{EIP712_CAPABLE_METHODS as M,buildEIP712Payload as N,eip712DomainFor as P,generateEIP712Types as F}from"./utils/eip712.js";import{calculatePersonalSignPrefix as I,ethAddressOfPrivateKey as L,fixpointPrefixFor as R,getPayloadToSign as z,normalizePrivateKey as B,personalSignPrefixFor as V,serialize as H,signNative as U,signPersonalMessage as W,signSerializedNative as G}from"./utils/signing.js";import{BrowserWalletSigner as K,GalaWalletSigner as q,PrivateKeySigner as J,createLazyPrivateKeySigner as Y,ethereumAddressOfAccount as X,withGalaWalletIdentity as Z}from"./classes/signers.js";import{canonicalDecimalString as Q,resolvePersonalSignChainDtoPayload as $,signChainDtoHash as ee,signChainDtoNative as te,signChainDtoPersonalSign as ne,signRawObject as re,stripEip712DomainType as ie,tokenClassDollarKey as ae,withPrivateKey as oe}from"./utils/chain_dto_signing.js";import{hashTypedData as se,signTypedDataPayload as ce}from"./utils/typed_data.js";import{CHAIN_CONTRACT_OPERATION_PREFIXES as le,CHAIN_METHOD_OPERATIONS as ue,dtoOperationOf as de,withDtoOperation as fe}from"./utils/dto_operation.js";import{isWalletUserRejection as pe,walletDeclineCode as me}from"./utils/wallet_rejection.js";import{signPreSend as he,signPreSendFor as ge}from"./utils/pre_send.js";import{GALA_CORE_SDK_VERSION as _e}from"./version.js";import{armTimeout as ve,buildQueryString as ye,buildRequestHeaders as be,fetchRequestor as xe,readBlockNumberHeader as Se,readHeader as Ce,readResponseBody as we,readRetryAfter as Te,requestWithTimeout as Ee,validateTimeoutMs as De}from"./utils/transport.js";import{httpRequestorFromAxios as Oe}from"./utils/axios_requestor.js";import{eip1193ProviderFromEthers as ke}from"./utils/ethers_provider.js";import{isFetchTransportFailure as Ae}from"./utils/fetch_failure.js";import{FAILURE_OUTCOMES as je}from"./utils/failure_outcomes.js";import{isWriteView as Me,numberParamOf as Ne,stringParamOf as Pe,toFailureView as Fe}from"./utils/failure_view.js";import{compositeKeyOf as Ie,isTokenClassKey as Le,splitClassKey as Re,tryParseCompositeKey as ze,tryParseTokenClassKey as Be}from"./utils/class_key.js";import{isValidUniqueKey as Ve}from"./utils/unique_key_syntax.js";import{DEFAULT_UNIQUE_KEY_PREFIX as He,assertUniqueKey as Ue,createUniqueKey as We,resolveUniqueKeyPrefix as Ge}from"./utils/unique_key.js";import{createWallet as Ke,getEthereumAddressFromPrivateKey as qe,getPublicKeyFromPrivateKey as Je,validateWalletInput as Ye}from"./utils/wallet_keys.js";import{NFT_DEFAULT_ADDITIONAL_KEY as Xe,NFT_MINT_LIMIT as Ze,NFT_WRITE_METHODS as Qe}from"./writes/nft.js";import{GALA_TOKEN_CLASS_KEY as $e}from"./writes/transfer.js";import{GATEWAY_WRITE_BATCH_LIMITS as et,GATEWAY_WRITE_METHODS as tt}from"./writes/types.js";import{GatewayWrites as nt}from"./writes/gateway_writes.js";import{GATEWAY_READ_LIMITS as rt,GATEWAY_READ_METHODS as it}from"./reads/types.js";import{GatewayReads as at,tokenDetailsOf as ot}from"./reads/gateway_reads.js";import{NftCollectionReads as st}from"./reads/nft_collections.js";import{estimateNftOperationFees as ct,getNftCollectionClaimFee as lt,getNftTokenClassCreateFee as ut}from"./reads/nft_fees.js";import{GALA_CHAIN_ENVIRONMENTS as dt}from"./config/environments.js";export{e as BRIDGE_AMOUNT_PROBLEMS,t as BRIDGE_DEPOSIT_STEPS,n as BRIDGE_NETWORKS,r as BRIDGE_OUT_STEPS,K as BrowserWalletSigner,le as CHAIN_CONTRACT_OPERATION_PREFIXES,ue as CHAIN_METHOD_OPERATIONS,He as DEFAULT_UNIQUE_KEY_PREFIX,M as EIP712_CAPABLE_METHODS,je as FAILURE_OUTCOMES,dt as GALA_CHAIN_ENVIRONMENTS,_e as GALA_CORE_SDK_VERSION,i as GALA_ERROR_CATALOG,w as GALA_ERROR_PHASES,S as GALA_ERROR_PHASE_BY_CODE,$e as GALA_TOKEN_CLASS_KEY,a as GATEWAY_READS_OPTIONS,rt as GATEWAY_READ_LIMITS,it as GATEWAY_READ_METHODS,o as GATEWAY_WRITES_OPTIONS,et as GATEWAY_WRITE_BATCH_LIMITS,tt as GATEWAY_WRITE_METHODS,s as GATEWAY_WRITE_OUTCOME_UNKNOWN_REASONS,D as GalaSDKError,q as GalaWalletSigner,at as GatewayReads,nt as GatewayWrites,c as INVALID_NFT_INPUT_REASONS,l as INVALID_PRIVATE_KEY_REASONS,u as INVALID_TOKEN_REFERENCE_REASONS,Xe as NFT_DEFAULT_ADDITIONAL_KEY,Ze as NFT_MINT_LIMIT,Qe as NFT_WRITE_METHODS,st as NftCollectionReads,d as PAGE_REQUEST_FIELDS,J as PrivateKeySigner,f as SIGNING_FAILURE_REASONS,p as WALLET_CONNECTION_FAILURE_REASONS,m as WALLET_INPUT_PROBLEMS,h as WALLET_NOT_CONNECTED_REASONS,g as WALLET_PROVIDER_CONFIG_MISSING,_ as WRAP_DIRECTIONS,v as WRAP_REFUSAL_REASONS,ve as armTimeout,Ue as assertUniqueKey,N as buildEIP712Payload,ye as buildQueryString,be as buildRequestHeaders,I as calculatePersonalSignPrefix,Q as canonicalDecimalString,A as checksumEthereumAddress,Ie as compositeKeyOf,Y as createLazyPrivateKeySigner,We as createUniqueKey,Ke as createWallet,de as dtoOperationOf,ke as eip1193ProviderFromEthers,P as eip712DomainFor,ct as estimateNftOperationFees,L as ethAddressOfPrivateKey,X as ethereumAddressOfAccount,xe as fetchRequestor,R as fixpointPrefixFor,j as galaChainUserRef,y as galaErrorTemplates,F as generateEIP712Types,qe as getEthereumAddressFromPrivateKey,lt as getNftCollectionClaimFee,ut as getNftTokenClassCreateFee,z as getPayloadToSign,Je as getPublicKeyFromPrivateKey,T as hasGalaErrorBrand,se as hashTypedData,Oe as httpRequestorFromAxios,Ae as isFetchTransportFailure,C as isGalaCatalogCode,O as isGalaError,E as isGalaErrorLike,Le as isTokenClassKey,Ve as isValidUniqueKey,pe as isWalletUserRejection,Me as isWriteView,B as normalizePrivateKey,Ne as numberParamOf,k as parseJson,V as personalSignPrefixFor,Se as readBlockNumberHeader,Ce as readHeader,we as readResponseBody,Te as readRetryAfter,b as renderGalaErrorTemplate,Ee as requestWithTimeout,$ as resolvePersonalSignChainDtoPayload,Ge as resolveUniqueKeyPrefix,H as serialize,ee as signChainDtoHash,te as signChainDtoNative,ne as signChainDtoPersonalSign,U as signNative,W as signPersonalMessage,he as signPreSend,ge as signPreSendFor,re as signRawObject,G as signSerializedNative,ce as signTypedDataPayload,Re as splitClassKey,Pe as stringParamOf,ie as stripEip712DomainType,x as templatePlaceholders,Fe as toFailureView,ae as tokenClassDollarKey,ot as tokenDetailsOf,ze as tryParseCompositeKey,Be as tryParseTokenClassKey,De as validateTimeoutMs,Ye as validateWalletInput,me as walletDeclineCode,fe as withDtoOperation,Z as withGalaWalletIdentity,oe as withPrivateKey};
1
+ import{BRIDGE_AMOUNT_PROBLEMS as e,BRIDGE_DEPOSIT_STEPS as t,BRIDGE_NETWORKS as n,BRIDGE_OUT_STEPS as r,GALA_ERROR_CATALOG as i,GATEWAY_READS_OPTIONS as a,GATEWAY_WRITES_OPTIONS as o,GATEWAY_WRITE_OUTCOME_UNKNOWN_REASONS as s,INVALID_DTO_EXPIRES_AT_REASONS as c,INVALID_NFT_INPUT_REASONS as l,INVALID_PRIVATE_KEY_REASONS as u,INVALID_TOKEN_REFERENCE_REASONS as d,PAGE_REQUEST_FIELDS as f,SIGNING_FAILURE_REASONS as p,WALLET_CONNECTION_FAILURE_REASONS as m,WALLET_INPUT_PROBLEMS as h,WALLET_NOT_CONNECTED_REASONS as g,WALLET_PROVIDER_CONFIG_MISSING as _,WRAP_DIRECTIONS as v,WRAP_REFUSAL_REASONS as y,galaErrorTemplates as b,renderGalaErrorTemplate as x,templatePlaceholders as S}from"./classes/error_catalog.js";import{GALA_ERROR_PHASE_BY_CODE as C,isGalaCatalogCode as w}from"./classes/error_phase_table.js";import{GALA_ERROR_PHASES as T}from"./classes/error_phases.js";import{hasGalaErrorBrand as E,isGalaErrorLike as D}from"./utils/error_brand.js";import{GalaSDKError as O,isGalaError as k,parseJson as A}from"./classes/gala_sdk_error.js";import{checksumEthereumAddress as j}from"./utils/eth_address.js";import{galaChainUserRef as M}from"./writes/identity.js";import{EIP712_CAPABLE_METHODS as N,buildEIP712Payload as P,eip712DomainFor as F,generateEIP712Types as I}from"./utils/eip712.js";import{calculatePersonalSignPrefix as L,ethAddressOfPrivateKey as R,fixpointPrefixFor as z,getPayloadToSign as B,normalizePrivateKey as V,personalSignPrefixFor as H,serialize as U,signNative as W,signPersonalMessage as G,signSerializedNative as K}from"./utils/signing.js";import{BrowserWalletSigner as q,GalaWalletSigner as J,PrivateKeySigner as Y,createLazyPrivateKeySigner as X,ethereumAddressOfAccount as Z,withGalaWalletIdentity as Q}from"./classes/signers.js";import{canonicalDecimalString as $,resolvePersonalSignChainDtoPayload as ee,signChainDtoHash as te,signChainDtoNative as ne,signChainDtoPersonalSign as re,signRawObject as ie,stripEip712DomainType as ae,tokenClassDollarKey as oe,withPrivateKey as se}from"./utils/chain_dto_signing.js";import{hashTypedData as ce,signTypedDataPayload as le}from"./utils/typed_data.js";import{CHAIN_CONTRACT_OPERATION_PREFIXES as ue,CHAIN_METHOD_OPERATIONS as de,checkContractPath as fe,dtoOperationOf as pe,withDtoOperation as me}from"./utils/dto_operation.js";import{isWalletUserRejection as he,walletDeclineCode as ge}from"./utils/wallet_rejection.js";import{signPreSend as _e,signPreSendFor as ve}from"./utils/pre_send.js";import{GALA_CORE_SDK_VERSION as ye}from"./version.js";import{armTimeout as be,buildQueryString as xe,buildRequestHeaders as Se,fetchRequestor as Ce,readBlockNumberHeader as we,readHeader as Te,readResponseBody as Ee,readRetryAfter as De,requestWithTimeout as Oe,validateTimeoutMs as ke}from"./utils/transport.js";import{httpRequestorFromAxios as Ae}from"./utils/axios_requestor.js";import{eip1193ProviderFromEthers as je}from"./utils/ethers_provider.js";import{isFetchTransportFailure as Me}from"./utils/fetch_failure.js";import{FAILURE_OUTCOMES as Ne}from"./utils/failure_outcomes.js";import{isWriteView as Pe,numberParamOf as Fe,stringParamOf as Ie,toFailureView as Le}from"./utils/failure_view.js";import{compositeKeyOf as Re,isTokenClassKey as ze,splitClassKey as Be,tryParseCompositeKey as Ve,tryParseTokenClassKey as He}from"./utils/class_key.js";import{isValidUniqueKey as Ue}from"./utils/unique_key_syntax.js";import{DEFAULT_UNIQUE_KEY_PREFIX as We,assertUniqueKey as Ge,createUniqueKey as Ke,resolveUniqueKeyPrefix as qe}from"./utils/unique_key.js";import{createWallet as Je,getEthereumAddressFromPrivateKey as Ye,getPublicKeyFromPrivateKey as Xe,validateWalletInput as Ze}from"./utils/wallet_keys.js";import{checkDtoExpiresAt as Qe}from"./writes/dto_expiry.js";import{NFT_DEFAULT_ADDITIONAL_KEY as $e,NFT_MINT_LIMIT as et,NFT_WRITE_METHODS as tt}from"./writes/nft.js";import{writeQuantity as nt}from"./writes/token_ref.js";import{GALA_TOKEN_CLASS_KEY as rt}from"./writes/transfer.js";import{GATEWAY_WRITE_BATCH_LIMITS as it,GATEWAY_WRITE_METHODS as at}from"./writes/types.js";import{GatewayWrites as ot}from"./writes/gateway_writes.js";import{GATEWAY_READ_LIMITS as st,GATEWAY_READ_METHODS as ct}from"./reads/types.js";import{GatewayReads as lt,tokenDetailsOf as ut}from"./reads/gateway_reads.js";import{NftCollectionReads as dt}from"./reads/nft_collections.js";import{estimateNftOperationFees as ft,getNftCollectionClaimFee as pt,getNftTokenClassCreateFee as mt}from"./reads/nft_fees.js";import{GALA_CHAIN_ENVIRONMENTS as ht}from"./config/environments.js";export{e as BRIDGE_AMOUNT_PROBLEMS,t as BRIDGE_DEPOSIT_STEPS,n as BRIDGE_NETWORKS,r as BRIDGE_OUT_STEPS,q as BrowserWalletSigner,ue as CHAIN_CONTRACT_OPERATION_PREFIXES,de as CHAIN_METHOD_OPERATIONS,We as DEFAULT_UNIQUE_KEY_PREFIX,N as EIP712_CAPABLE_METHODS,Ne as FAILURE_OUTCOMES,ht as GALA_CHAIN_ENVIRONMENTS,ye as GALA_CORE_SDK_VERSION,i as GALA_ERROR_CATALOG,T as GALA_ERROR_PHASES,C as GALA_ERROR_PHASE_BY_CODE,rt as GALA_TOKEN_CLASS_KEY,a as GATEWAY_READS_OPTIONS,st as GATEWAY_READ_LIMITS,ct as GATEWAY_READ_METHODS,o as GATEWAY_WRITES_OPTIONS,it as GATEWAY_WRITE_BATCH_LIMITS,at as GATEWAY_WRITE_METHODS,s as GATEWAY_WRITE_OUTCOME_UNKNOWN_REASONS,O as GalaSDKError,J as GalaWalletSigner,lt as GatewayReads,ot as GatewayWrites,c as INVALID_DTO_EXPIRES_AT_REASONS,l as INVALID_NFT_INPUT_REASONS,u as INVALID_PRIVATE_KEY_REASONS,d as INVALID_TOKEN_REFERENCE_REASONS,$e as NFT_DEFAULT_ADDITIONAL_KEY,et as NFT_MINT_LIMIT,tt as NFT_WRITE_METHODS,dt as NftCollectionReads,f as PAGE_REQUEST_FIELDS,Y as PrivateKeySigner,p as SIGNING_FAILURE_REASONS,m as WALLET_CONNECTION_FAILURE_REASONS,h as WALLET_INPUT_PROBLEMS,g as WALLET_NOT_CONNECTED_REASONS,_ as WALLET_PROVIDER_CONFIG_MISSING,v as WRAP_DIRECTIONS,y as WRAP_REFUSAL_REASONS,be as armTimeout,Ge as assertUniqueKey,P as buildEIP712Payload,xe as buildQueryString,Se as buildRequestHeaders,L as calculatePersonalSignPrefix,$ as canonicalDecimalString,fe as checkContractPath,Qe as checkDtoExpiresAt,j as checksumEthereumAddress,Re as compositeKeyOf,X as createLazyPrivateKeySigner,Ke as createUniqueKey,Je as createWallet,pe as dtoOperationOf,je as eip1193ProviderFromEthers,F as eip712DomainFor,ft as estimateNftOperationFees,R as ethAddressOfPrivateKey,Z as ethereumAddressOfAccount,Ce as fetchRequestor,z as fixpointPrefixFor,M as galaChainUserRef,b as galaErrorTemplates,I as generateEIP712Types,Ye as getEthereumAddressFromPrivateKey,pt as getNftCollectionClaimFee,mt as getNftTokenClassCreateFee,B as getPayloadToSign,Xe as getPublicKeyFromPrivateKey,E as hasGalaErrorBrand,ce as hashTypedData,Ae as httpRequestorFromAxios,Me as isFetchTransportFailure,w as isGalaCatalogCode,k as isGalaError,D as isGalaErrorLike,ze as isTokenClassKey,Ue as isValidUniqueKey,he as isWalletUserRejection,Pe as isWriteView,V as normalizePrivateKey,Fe as numberParamOf,A as parseJson,H as personalSignPrefixFor,we as readBlockNumberHeader,Te as readHeader,Ee as readResponseBody,De as readRetryAfter,x as renderGalaErrorTemplate,Oe as requestWithTimeout,ee as resolvePersonalSignChainDtoPayload,qe as resolveUniqueKeyPrefix,U as serialize,te as signChainDtoHash,ne as signChainDtoNative,re as signChainDtoPersonalSign,W as signNative,G as signPersonalMessage,_e as signPreSend,ve as signPreSendFor,ie as signRawObject,K as signSerializedNative,le as signTypedDataPayload,Be as splitClassKey,Ie as stringParamOf,ae as stripEip712DomainType,S as templatePlaceholders,Le as toFailureView,oe as tokenClassDollarKey,ut as tokenDetailsOf,Ve as tryParseCompositeKey,He as tryParseTokenClassKey,ke as validateTimeoutMs,Ze as validateWalletInput,ge as walletDeclineCode,me as withDtoOperation,Q as withGalaWalletIdentity,se as withPrivateKey,nt as writeQuantity};
@@ -1,2 +1,2 @@
1
- import{GalaSDKError as e}from"../classes/gala_sdk_error.js";const t={"asset/public-key-contract":`asset-channel_basic-asset_PublicKeyContract`,"asset/token-contract":`asset-channel_basic-asset_GalaChainToken`,"asset/fee-contract":`asset-channel_basic-asset_GalaChainFee`,"asset/launchpad-contract":`asset-channel_basic-asset_Launchpad`,"asset/dexv3-contract":`asset-channel_basic-asset_DexV3Contract`,"asset/dex-contract":`asset-channel_basic-asset_GalaChainDex`,"asset/registrar-contract":`asset-channel_basic-asset_RegistrarContract`,"asset/staking-contract":`asset-channel_basic-asset_StakingContract`,"asset/wallet-attributes-contract":`asset-channel_basic-asset_WalletAttributesContract`,"asset/bridge-contract":`asset-channel_bridge-chaincode_BridgeContract`,"asset/bridge-public-key-contract":`asset-channel_bridge-chaincode_PublicKeyContract`,"asset/alm-contract":`asset-channel_basic-asset_ALMContract`,"spidertanks/contract":`spidertanks-channel_spidertanks_SpiderTanks`,"music/public-key-contract":`music_music_PublicKeyContract`,"music/music-contract":`music_music_GalaMusic`,"music/token-contract":`music_music_GalaChainToken`,"pokergo/pokergo-contract":`pokergo_pokergo_PokerGo`,"pokergo/public-key-contract":`pokergo_pokergo_PublicKeyContract`,"pokergo/token-contract":`pokergo_pokergo_GalaChainToken`,"championsarena/public-key-contract":`championsarena_championsarena_PublicKeyContract`,"championsarena/champions-arena":`championsarena_championsarena_ChampionsArenaContract`,"championsarena/token-contract":`championsarena_championsarena_GalaChainToken`,"superior/public-key-contract":`superior_superior_PublicKeyContract`,"superior/token-contract":`superior_superior_GalaChainToken`,"superior/superior":`superior_superior_Product`,"legacy/public-key-contract":`legacy_legacy_PublicKeyContract`,"legacy/token-contract":`legacy_legacy_GalaChainToken`,"legacy/legacy":`legacy_legacy_Legacy`,"eternalparadox/public-key-contract":`eternalparadox_eternalparadox_PublicKeyContract`,"eternalparadox/token-contract":`eternalparadox_eternalparadox_GalaChainToken`,"eternalparadox/eternalparadox":`eternalparadox_eternalparadox_EternalParadox`,"echoesofempire/public-key-contract":`echoesofempire_echoesofempire_PublicKeyContract`,"echoesofempire/token-contract":`echoesofempire_echoesofempire_GalaChainToken`,"echoesofempire/echoesofempire-contract":`echoesofempire_echoesofempire_EchoesOfEmpire`,"node/public-key-contract":`node_node_PublicKeyContract`,"node/token-contract":`node_node_GalaChainToken`,"node/node-contract":`node_node_Product`,"townstar/product-contract":`townstar_townstar_TownStar`,"townstar/token-contract":`townstar_townstar_GalaChainToken`,"townstar/public-key-contract":`townstar_townstar_PublicKeyContract`,"mirandus/public-key-contract":`mirandus_mirandus_PublicKeyContract`,"mirandus/token-contract":`mirandus_mirandus_GalaChainToken`,"mirandus/mirandus-contract":`mirandus_mirandus_Product`,"galafilm/public-key-contract":`galafilm_galafilm_PublicKeyContract`,"galafilm/token-contract":`galafilm_galafilm_GalaChainToken`,"galafilm/galafilm-contract":`galafilm_galafilm_Product`,"lastexpedition/public-key-contract":`lastexpedition_lastexpedition_PublicKeyContract`,"lastexpedition/token-contract":`lastexpedition_lastexpedition_GalaChainToken`,"lastexpedition/lastexpedition-contract":`lastexpedition_lastexpedition_Product`,"legendsreborn/public-key-contract":`legendsreborn_legendsreborn_PublicKeyContract`,"legendsreborn/token-contract":`legendsreborn_legendsreborn_GalaChainToken`,"legendsreborn/legendsreborn-contract":`legendsreborn_legendsreborn_Product`,"thewalkingdeadempires/public-key-contract":`thewalkingdeadempires_thewalkingdeadempires_PublicKeyContract`,"thewalkingdeadempires/token-contract":`thewalkingdeadempires_thewalkingdeadempires_GalaChainToken`,"thewalkingdeadempires/thewalkingdeadempires-contract":`thewalkingdeadempires_thewalkingdeadempires_Product`,"vox/public-key-contract":`vox_vox_PublicKeyContract`,"vox/token-contract":`vox_vox_GalaChainToken`,"vox/auction-contract":`vox_vox_AuctionContract`,"vox/phase-contract":`vox_vox_PhaseContract`,"vox/vox-contract":`vox_vox_VOXTokenContract`,"vox/resources-contract":`vox_vox_VOXResourceToken`},n={"asset/bridge-contract:RequestTokenBridgeOut":`asset-channel_basic-asset_GalaChainToken:RequestTokenBridgeOut`,"asset/bridge-contract:GrantAllowance":`asset-channel_bridge-chaincode_GalaChainToken:GrantAllowance`};function r(r,i){let a=`${r}:${i}`;if(Object.prototype.hasOwnProperty.call(n,a))return n[a];let o=Object.prototype.hasOwnProperty.call(t,r)?t[r]:void 0;if(o===void 0)throw new e(`SIGNING_FAILED`,{method:i,reason:`failed`},{cause:{contractPath:r,reason:`unknown contract path: no dtoOperation is known for it`}});return`${o}:${i}`}function i(t,n,i){let a=r(t,n),o=i.dtoOperation;if(o!==void 0&&o!==a)throw new e(`SIGNING_FAILED`,{method:n,reason:`failed`},{cause:{dtoOperation:o,expected:a}});return{...i,dtoOperation:a}}export{t as CHAIN_CONTRACT_OPERATION_PREFIXES,n as CHAIN_METHOD_OPERATIONS,r as dtoOperationOf,i as withDtoOperation};
1
+ import{GalaSDKError as e}from"../classes/gala_sdk_error.js";const t={"asset/public-key-contract":`asset-channel_basic-asset_PublicKeyContract`,"asset/token-contract":`asset-channel_basic-asset_GalaChainToken`,"asset/fee-contract":`asset-channel_basic-asset_GalaChainFee`,"asset/launchpad-contract":`asset-channel_basic-asset_Launchpad`,"asset/dexv3-contract":`asset-channel_basic-asset_DexV3Contract`,"asset/dex-contract":`asset-channel_basic-asset_GalaChainDex`,"asset/registrar-contract":`asset-channel_basic-asset_RegistrarContract`,"asset/staking-contract":`asset-channel_basic-asset_StakingContract`,"asset/wallet-attributes-contract":`asset-channel_basic-asset_WalletAttributesContract`,"asset/bridge-contract":`asset-channel_bridge-chaincode_BridgeContract`,"asset/bridge-public-key-contract":`asset-channel_bridge-chaincode_PublicKeyContract`,"asset/alm-contract":`asset-channel_basic-asset_ALMContract`,"spidertanks/contract":`spidertanks-channel_spidertanks_SpiderTanks`,"music/public-key-contract":`music_music_PublicKeyContract`,"music/music-contract":`music_music_GalaMusic`,"music/token-contract":`music_music_GalaChainToken`,"pokergo/pokergo-contract":`pokergo_pokergo_PokerGo`,"pokergo/public-key-contract":`pokergo_pokergo_PublicKeyContract`,"pokergo/token-contract":`pokergo_pokergo_GalaChainToken`,"championsarena/public-key-contract":`championsarena_championsarena_PublicKeyContract`,"championsarena/champions-arena":`championsarena_championsarena_ChampionsArenaContract`,"championsarena/token-contract":`championsarena_championsarena_GalaChainToken`,"superior/public-key-contract":`superior_superior_PublicKeyContract`,"superior/token-contract":`superior_superior_GalaChainToken`,"superior/superior":`superior_superior_Product`,"legacy/public-key-contract":`legacy_legacy_PublicKeyContract`,"legacy/token-contract":`legacy_legacy_GalaChainToken`,"legacy/legacy":`legacy_legacy_Legacy`,"eternalparadox/public-key-contract":`eternalparadox_eternalparadox_PublicKeyContract`,"eternalparadox/token-contract":`eternalparadox_eternalparadox_GalaChainToken`,"eternalparadox/eternalparadox":`eternalparadox_eternalparadox_EternalParadox`,"echoesofempire/public-key-contract":`echoesofempire_echoesofempire_PublicKeyContract`,"echoesofempire/token-contract":`echoesofempire_echoesofempire_GalaChainToken`,"echoesofempire/echoesofempire-contract":`echoesofempire_echoesofempire_EchoesOfEmpire`,"node/public-key-contract":`node_node_PublicKeyContract`,"node/token-contract":`node_node_GalaChainToken`,"node/node-contract":`node_node_Product`,"townstar/product-contract":`townstar_townstar_TownStar`,"townstar/token-contract":`townstar_townstar_GalaChainToken`,"townstar/public-key-contract":`townstar_townstar_PublicKeyContract`,"mirandus/public-key-contract":`mirandus_mirandus_PublicKeyContract`,"mirandus/token-contract":`mirandus_mirandus_GalaChainToken`,"mirandus/mirandus-contract":`mirandus_mirandus_Product`,"galafilm/public-key-contract":`galafilm_galafilm_PublicKeyContract`,"galafilm/token-contract":`galafilm_galafilm_GalaChainToken`,"galafilm/galafilm-contract":`galafilm_galafilm_Product`,"lastexpedition/public-key-contract":`lastexpedition_lastexpedition_PublicKeyContract`,"lastexpedition/token-contract":`lastexpedition_lastexpedition_GalaChainToken`,"lastexpedition/lastexpedition-contract":`lastexpedition_lastexpedition_Product`,"legendsreborn/public-key-contract":`legendsreborn_legendsreborn_PublicKeyContract`,"legendsreborn/token-contract":`legendsreborn_legendsreborn_GalaChainToken`,"legendsreborn/legendsreborn-contract":`legendsreborn_legendsreborn_Product`,"thewalkingdeadempires/public-key-contract":`thewalkingdeadempires_thewalkingdeadempires_PublicKeyContract`,"thewalkingdeadempires/token-contract":`thewalkingdeadempires_thewalkingdeadempires_GalaChainToken`,"thewalkingdeadempires/thewalkingdeadempires-contract":`thewalkingdeadempires_thewalkingdeadempires_Product`,"vox/public-key-contract":`vox_vox_PublicKeyContract`,"vox/token-contract":`vox_vox_GalaChainToken`,"vox/auction-contract":`vox_vox_AuctionContract`,"vox/phase-contract":`vox_vox_PhaseContract`,"vox/vox-contract":`vox_vox_VOXTokenContract`,"vox/resources-contract":`vox_vox_VOXResourceToken`},n={"asset/bridge-contract:RequestTokenBridgeOut":`asset-channel_basic-asset_GalaChainToken:RequestTokenBridgeOut`,"asset/bridge-contract:GrantAllowance":`asset-channel_bridge-chaincode_GalaChainToken:GrantAllowance`};function r(n,r){if(typeof n==`string`&&Object.prototype.hasOwnProperty.call(t,n))return n;throw new e(`INVALID_CONTRACT_PATH`,{field:r})}function i(r,i){let a=`${r}:${i}`;if(Object.prototype.hasOwnProperty.call(n,a))return n[a];let o=Object.prototype.hasOwnProperty.call(t,r)?t[r]:void 0;if(o===void 0)throw new e(`SIGNING_FAILED`,{method:i,reason:`failed`},{cause:{contractPath:r,reason:`unknown contract path: no dtoOperation is known for it`}});return`${o}:${i}`}function a(t,n,r){let a=i(t,n),o=r.dtoOperation;if(o!==void 0&&o!==a)throw new e(`SIGNING_FAILED`,{method:n,reason:`failed`},{cause:{dtoOperation:o,expected:a}});return{...r,dtoOperation:a}}export{t as CHAIN_CONTRACT_OPERATION_PREFIXES,n as CHAIN_METHOD_OPERATIONS,r as checkContractPath,i as dtoOperationOf,a as withDtoOperation};
2
2
  //# sourceMappingURL=dto_operation.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"dto_operation.js","names":["CHAIN_CONTRACT_OPERATION_PREFIXES","CHAIN_METHOD_OPERATIONS","dtoOperationOf","methodKey","contractPath","method","prefix","GalaSDKError","withDtoOperation","dtoOperation","present","dto","\"dtoOperation\""],"sources":["../../../src/utils/dto_operation.ts"],"sourcesContent":["/**\n * The chain's operation ids for the GalaChain contracts the gateway routes, from the gateway's\n * `dtoOperationMap` (the `dtoOperation` / API path table of the GalaChain platform team,\n * 2026-10-27). The chain refuses a signed DTO whose `dtoOperation` is not exactly the operation it\n * is called through (\"The dto was signed to call X operation, but the current operation is Y\"), so\n * the URL a write is POSTed to and the `dtoOperation` it carries both come from this one table\n * (the platform's rows, plus the chain's own deviations in `CHAIN_METHOD_OPERATIONS`).\n *\n * `dtoOperation` is a SIGNED field: it is part of the DTO before the signer sees it, never added by\n * a signer or after the signature.\n */\n\nimport { GalaSDKError } from '../classes/gala_sdk_error.js';\n\n/** `<channel>/<contract route>`: the path after `/api/` (or `/v1/chain/`) a contract is served at. */\nexport const CHAIN_CONTRACT_OPERATION_PREFIXES = {\n 'asset/public-key-contract': 'asset-channel_basic-asset_PublicKeyContract',\n 'asset/token-contract': 'asset-channel_basic-asset_GalaChainToken',\n 'asset/fee-contract': 'asset-channel_basic-asset_GalaChainFee',\n 'asset/launchpad-contract': 'asset-channel_basic-asset_Launchpad',\n 'asset/dexv3-contract': 'asset-channel_basic-asset_DexV3Contract',\n 'asset/dex-contract': 'asset-channel_basic-asset_GalaChainDex',\n 'asset/registrar-contract': 'asset-channel_basic-asset_RegistrarContract',\n 'asset/staking-contract': 'asset-channel_basic-asset_StakingContract',\n 'asset/wallet-attributes-contract': 'asset-channel_basic-asset_WalletAttributesContract',\n // The platform table's bridge contract. Three bridge writes do NOT follow it; they are in\n // `CHAIN_METHOD_OPERATIONS` below.\n 'asset/bridge-contract': 'asset-channel_bridge-chaincode_BridgeContract',\n 'asset/bridge-public-key-contract': 'asset-channel_bridge-chaincode_PublicKeyContract',\n 'asset/alm-contract': 'asset-channel_basic-asset_ALMContract',\n 'spidertanks/contract': 'spidertanks-channel_spidertanks_SpiderTanks',\n 'music/public-key-contract': 'music_music_PublicKeyContract',\n 'music/music-contract': 'music_music_GalaMusic',\n 'music/token-contract': 'music_music_GalaChainToken',\n 'pokergo/pokergo-contract': 'pokergo_pokergo_PokerGo',\n 'pokergo/public-key-contract': 'pokergo_pokergo_PublicKeyContract',\n 'pokergo/token-contract': 'pokergo_pokergo_GalaChainToken',\n 'championsarena/public-key-contract': 'championsarena_championsarena_PublicKeyContract',\n 'championsarena/champions-arena': 'championsarena_championsarena_ChampionsArenaContract',\n 'championsarena/token-contract': 'championsarena_championsarena_GalaChainToken',\n 'superior/public-key-contract': 'superior_superior_PublicKeyContract',\n 'superior/token-contract': 'superior_superior_GalaChainToken',\n 'superior/superior': 'superior_superior_Product',\n 'legacy/public-key-contract': 'legacy_legacy_PublicKeyContract',\n 'legacy/token-contract': 'legacy_legacy_GalaChainToken',\n 'legacy/legacy': 'legacy_legacy_Legacy',\n 'eternalparadox/public-key-contract': 'eternalparadox_eternalparadox_PublicKeyContract',\n 'eternalparadox/token-contract': 'eternalparadox_eternalparadox_GalaChainToken',\n 'eternalparadox/eternalparadox': 'eternalparadox_eternalparadox_EternalParadox',\n 'echoesofempire/public-key-contract': 'echoesofempire_echoesofempire_PublicKeyContract',\n 'echoesofempire/token-contract': 'echoesofempire_echoesofempire_GalaChainToken',\n 'echoesofempire/echoesofempire-contract': 'echoesofempire_echoesofempire_EchoesOfEmpire',\n 'node/public-key-contract': 'node_node_PublicKeyContract',\n 'node/token-contract': 'node_node_GalaChainToken',\n 'node/node-contract': 'node_node_Product',\n 'townstar/product-contract': 'townstar_townstar_TownStar',\n 'townstar/token-contract': 'townstar_townstar_GalaChainToken',\n 'townstar/public-key-contract': 'townstar_townstar_PublicKeyContract',\n 'mirandus/public-key-contract': 'mirandus_mirandus_PublicKeyContract',\n 'mirandus/token-contract': 'mirandus_mirandus_GalaChainToken',\n 'mirandus/mirandus-contract': 'mirandus_mirandus_Product',\n 'galafilm/public-key-contract': 'galafilm_galafilm_PublicKeyContract',\n 'galafilm/token-contract': 'galafilm_galafilm_GalaChainToken',\n 'galafilm/galafilm-contract': 'galafilm_galafilm_Product',\n 'lastexpedition/public-key-contract': 'lastexpedition_lastexpedition_PublicKeyContract',\n 'lastexpedition/token-contract': 'lastexpedition_lastexpedition_GalaChainToken',\n 'lastexpedition/lastexpedition-contract': 'lastexpedition_lastexpedition_Product',\n 'legendsreborn/public-key-contract': 'legendsreborn_legendsreborn_PublicKeyContract',\n 'legendsreborn/token-contract': 'legendsreborn_legendsreborn_GalaChainToken',\n 'legendsreborn/legendsreborn-contract': 'legendsreborn_legendsreborn_Product',\n 'thewalkingdeadempires/public-key-contract':\n 'thewalkingdeadempires_thewalkingdeadempires_PublicKeyContract',\n 'thewalkingdeadempires/token-contract':\n 'thewalkingdeadempires_thewalkingdeadempires_GalaChainToken',\n 'thewalkingdeadempires/thewalkingdeadempires-contract':\n 'thewalkingdeadempires_thewalkingdeadempires_Product',\n 'vox/public-key-contract': 'vox_vox_PublicKeyContract',\n 'vox/token-contract': 'vox_vox_GalaChainToken',\n 'vox/auction-contract': 'vox_vox_AuctionContract',\n 'vox/phase-contract': 'vox_vox_PhaseContract',\n 'vox/vox-contract': 'vox_vox_VOXTokenContract',\n 'vox/resources-contract': 'vox_vox_VOXResourceToken',\n} as const;\n\n/**\n * Where the chain enforces an operation other than the platform table's, keyed `<contract path>:<method>`. The ONE\n * place such a deviation lives: every consumer (core's bridge-out signing, the wrap flow, Connect, the product SDKs)\n * asks `dtoOperationOf`, so nobody hard-codes the exception.\n *\n * - `RequestTokenBridgeOut`: the table maps `asset/bridge-contract` to bridge-chaincode, but a RequestTokenBridgeOut\n * is a TOKEN contract call. Verified on stage (2026-11-02): signed under\n * `asset-channel_bridge-chaincode_BridgeContract:RequestTokenBridgeOut` the chain answers \"signed to call ...\n * BridgeContract:RequestTokenBridgeOut, but the current operation is\n * asset-channel_basic-asset_GalaChainToken:RequestTokenBridgeOut\", and it accepts the token contract's.\n * - `GrantAllowance`: the grants embedded in a `BridgeTokenOut` are signed as\n * `asset-channel_bridge-chaincode_GalaChainToken:GrantAllowance`, which the table has no row for. Observed in\n * GalaConnect-signed stage traffic and verified against the chain with real signed writes (2026-11-05):\n * a bridge-out with the grants signed this way is accepted, the same DTO with the grants signed as\n * `BridgeContract:GrantAllowance` or `basic-asset_GalaChainToken:GrantAllowance` is refused at batch index 0. A\n * standalone GrantAllowance is a different route and keeps `basic-asset_GalaChainToken`. This SDK does not sign\n * the embedded grant itself.\n *\n * `asset/bridge-contract:BridgeTokenOut` is NOT here: the table's `BridgeContract:BridgeTokenOut` is accepted by the\n * chain for the external-chain bridge (verified 2026-11-05). The token contracts' own `BridgeTokenOut`\n * (`asset/token-contract`, `music/token-contract`, the channel move) is their plain prefix.\n */\nexport const CHAIN_METHOD_OPERATIONS = {\n 'asset/bridge-contract:RequestTokenBridgeOut':\n 'asset-channel_basic-asset_GalaChainToken:RequestTokenBridgeOut',\n 'asset/bridge-contract:GrantAllowance':\n 'asset-channel_bridge-chaincode_GalaChainToken:GrantAllowance',\n} as const;\n\n/** An API path of a GalaChain contract (`asset/token-contract`, `asset/dex-contract`, ...). */\nexport type ChainContractPath = keyof typeof CHAIN_CONTRACT_OPERATION_PREFIXES;\n\n/**\n * The `dtoOperation` of `method` on the contract served at `contractPath`: the chain's own\n * (`CHAIN_METHOD_OPERATIONS`) where it deviates from the platform table, else the table's prefix plus `:<method>`.\n *\n * `ChainContractPath` is only a type: a plain-JS caller, or a path built at runtime\n * (`${channel}/${contract}`), can name a contract the table does not have. That is refused here, before\n * anything is signed, instead of becoming `undefined:<method>` that the chain would refuse after the\n * signature.\n *\n * @throws GalaSDKError SIGNING_FAILED when `contractPath` is not in the table.\n */\nexport function dtoOperationOf(contractPath: ChainContractPath, method: string): string {\n const methodKey = `${contractPath}:${method}`;\n if (Object.prototype.hasOwnProperty.call(CHAIN_METHOD_OPERATIONS, methodKey)) {\n return CHAIN_METHOD_OPERATIONS[methodKey as keyof typeof CHAIN_METHOD_OPERATIONS];\n }\n const prefix = Object.prototype.hasOwnProperty.call(\n CHAIN_CONTRACT_OPERATION_PREFIXES,\n contractPath,\n )\n ? CHAIN_CONTRACT_OPERATION_PREFIXES[contractPath]\n : undefined;\n if (prefix === undefined) {\n throw new GalaSDKError(\n 'SIGNING_FAILED',\n { method, reason: 'failed' },\n { cause: { contractPath, reason: 'unknown contract path: no dtoOperation is known for it' } },\n );\n }\n return `${prefix}:${method}`;\n}\n\n/**\n * `dto` with its `dtoOperation` set for `method` on `contractPath`. A DTO that already names a\n * different operation is refused: it was built for another call, and sending it would be rejected\n * by the chain after the signer had already signed it.\n *\n * @throws GalaSDKError SIGNING_FAILED when `dto.dtoOperation` is set and is not the operation of this call.\n */\nexport function withDtoOperation<T extends Record<string, unknown>>(\n contractPath: ChainContractPath,\n method: string,\n dto: T,\n): T & { readonly dtoOperation: string } {\n const dtoOperation = dtoOperationOf(contractPath, method);\n const present = dto['dtoOperation'];\n if (present !== undefined && present !== dtoOperation) {\n throw new GalaSDKError(\n 'SIGNING_FAILED',\n { method, reason: 'failed' },\n { cause: { dtoOperation: present, expected: dtoOperation } },\n );\n }\n return { ...dto, dtoOperation };\n}\n"],"mappings":"A,4DAeA,MAAaA,EAAoC,CAC/C,4BAA6B,8CAC7B,uBAAwB,2CACxB,qBAAsB,yCACtB,2BAA4B,sCAC5B,uBAAwB,0CACxB,qBAAsB,yCACtB,2BAA4B,8CAC5B,yBAA0B,4CAC1B,mCAAoC,qDAGpC,wBAAyB,gDACzB,mCAAoC,mDACpC,qBAAsB,wCACtB,uBAAwB,8CACxB,4BAA6B,gCAC7B,uBAAwB,wBACxB,uBAAwB,6BACxB,2BAA4B,0BAC5B,8BAA+B,oCAC/B,yBAA0B,iCAC1B,qCAAsC,kDACtC,iCAAkC,uDAClC,gCAAiC,+CACjC,+BAAgC,sCAChC,0BAA2B,mCAC3B,oBAAqB,4BACrB,6BAA8B,kCAC9B,wBAAyB,+BACzB,gBAAiB,uBACjB,qCAAsC,kDACtC,gCAAiC,+CACjC,gCAAiC,+CACjC,qCAAsC,kDACtC,gCAAiC,+CACjC,yCAA0C,+CAC1C,2BAA4B,8BAC5B,sBAAuB,2BACvB,qBAAsB,oBACtB,4BAA6B,6BAC7B,0BAA2B,mCAC3B,+BAAgC,sCAChC,+BAAgC,sCAChC,0BAA2B,mCAC3B,6BAA8B,4BAC9B,+BAAgC,sCAChC,0BAA2B,mCAC3B,6BAA8B,4BAC9B,qCAAsC,kDACtC,gCAAiC,+CACjC,yCAA0C,wCAC1C,oCAAqC,gDACrC,+BAAgC,6CAChC,uCAAwC,sCACxC,4CACE,gEACF,uCACE,6DACF,uDACE,sDACF,0BAA2B,4BAC3B,qBAAsB,yBACtB,uBAAwB,0BACxB,qBAAsB,wBACtB,mBAAoB,2BACpB,yBAA0B,0BAC5B,EAwBaC,EAA0B,CACrC,8CACE,iEACF,uCACE,8DACJ,EAgBA,SAAgBC,EAAe,EAAiC,EAAwB,CACtF,IAAMC,EAAY,GAAGC,EAAa,GAAGC,IACrC,GAAI,OAAO,UAAU,eAAe,KAAKJ,EAAyBE,CAAS,EACzE,OAAOF,EAAwBE,GAEjC,IAAMG,EAAS,OAAO,UAAU,eAAe,KAC7CN,EACAI,CACF,EACIJ,EAAkCI,GAClC,IAAA,GACJ,GAAIE,IAAW,IAAA,GACb,MAAM,IAAIC,EACR,iBACA,CAAE,SAAQ,OAAQ,QAAS,EAC3B,CAAE,MAAO,CAAE,eAAc,OAAQ,wDAAyD,CAAE,CAC9F,EAEF,MAAO,GAAGD,EAAO,GAAGD,GACtB,CASA,SAAgBG,EACd,EACA,EACA,EACuC,CACvC,IAAMC,EAAeP,EAAeE,EAAcC,CAAM,EAClDK,EAAUC,EAAIC,aACpB,GAAIF,IAAY,IAAA,IAAaA,IAAYD,EACvC,MAAM,IAAIF,EACR,iBACA,CAAE,SAAQ,OAAQ,QAAS,EAC3B,CAAE,MAAO,CAAE,aAAcG,EAAS,SAAUD,CAAa,CAAE,CAC7D,EAEF,MAAO,CAAE,GAAGE,EAAK,cAAa,CAChC,C"}
1
+ {"version":3,"file":"dto_operation.js","names":["CHAIN_CONTRACT_OPERATION_PREFIXES","CHAIN_METHOD_OPERATIONS","checkContractPath","value","GalaSDKError","dtoOperationOf","methodKey","contractPath","method","prefix","withDtoOperation","dtoOperation","present","dto","\"dtoOperation\""],"sources":["../../../src/utils/dto_operation.ts"],"sourcesContent":["/**\n * The chain's operation ids for the GalaChain contracts the gateway routes, from the gateway's\n * `dtoOperationMap` (the `dtoOperation` / API path table of the GalaChain platform team,\n * 2026-10-27). The chain refuses a signed DTO whose `dtoOperation` is not exactly the operation it\n * is called through (\"The dto was signed to call X operation, but the current operation is Y\"), so\n * the URL a write is POSTed to and the `dtoOperation` it carries both come from this one table\n * (the platform's rows, plus the chain's own deviations in `CHAIN_METHOD_OPERATIONS`).\n *\n * `dtoOperation` is a SIGNED field: it is part of the DTO before the signer sees it, never added by\n * a signer or after the signature.\n */\n\nimport { GalaSDKError } from '../classes/gala_sdk_error.js';\n\n/** `<channel>/<contract route>`: the path after `/api/` (or `/v1/chain/`) a contract is served at. */\nexport const CHAIN_CONTRACT_OPERATION_PREFIXES = {\n 'asset/public-key-contract': 'asset-channel_basic-asset_PublicKeyContract',\n 'asset/token-contract': 'asset-channel_basic-asset_GalaChainToken',\n 'asset/fee-contract': 'asset-channel_basic-asset_GalaChainFee',\n 'asset/launchpad-contract': 'asset-channel_basic-asset_Launchpad',\n 'asset/dexv3-contract': 'asset-channel_basic-asset_DexV3Contract',\n 'asset/dex-contract': 'asset-channel_basic-asset_GalaChainDex',\n 'asset/registrar-contract': 'asset-channel_basic-asset_RegistrarContract',\n 'asset/staking-contract': 'asset-channel_basic-asset_StakingContract',\n 'asset/wallet-attributes-contract': 'asset-channel_basic-asset_WalletAttributesContract',\n // The platform table's bridge contract. Three bridge writes do NOT follow it; they are in\n // `CHAIN_METHOD_OPERATIONS` below.\n 'asset/bridge-contract': 'asset-channel_bridge-chaincode_BridgeContract',\n 'asset/bridge-public-key-contract': 'asset-channel_bridge-chaincode_PublicKeyContract',\n 'asset/alm-contract': 'asset-channel_basic-asset_ALMContract',\n 'spidertanks/contract': 'spidertanks-channel_spidertanks_SpiderTanks',\n 'music/public-key-contract': 'music_music_PublicKeyContract',\n 'music/music-contract': 'music_music_GalaMusic',\n 'music/token-contract': 'music_music_GalaChainToken',\n 'pokergo/pokergo-contract': 'pokergo_pokergo_PokerGo',\n 'pokergo/public-key-contract': 'pokergo_pokergo_PublicKeyContract',\n 'pokergo/token-contract': 'pokergo_pokergo_GalaChainToken',\n 'championsarena/public-key-contract': 'championsarena_championsarena_PublicKeyContract',\n 'championsarena/champions-arena': 'championsarena_championsarena_ChampionsArenaContract',\n 'championsarena/token-contract': 'championsarena_championsarena_GalaChainToken',\n 'superior/public-key-contract': 'superior_superior_PublicKeyContract',\n 'superior/token-contract': 'superior_superior_GalaChainToken',\n 'superior/superior': 'superior_superior_Product',\n 'legacy/public-key-contract': 'legacy_legacy_PublicKeyContract',\n 'legacy/token-contract': 'legacy_legacy_GalaChainToken',\n 'legacy/legacy': 'legacy_legacy_Legacy',\n 'eternalparadox/public-key-contract': 'eternalparadox_eternalparadox_PublicKeyContract',\n 'eternalparadox/token-contract': 'eternalparadox_eternalparadox_GalaChainToken',\n 'eternalparadox/eternalparadox': 'eternalparadox_eternalparadox_EternalParadox',\n 'echoesofempire/public-key-contract': 'echoesofempire_echoesofempire_PublicKeyContract',\n 'echoesofempire/token-contract': 'echoesofempire_echoesofempire_GalaChainToken',\n 'echoesofempire/echoesofempire-contract': 'echoesofempire_echoesofempire_EchoesOfEmpire',\n 'node/public-key-contract': 'node_node_PublicKeyContract',\n 'node/token-contract': 'node_node_GalaChainToken',\n 'node/node-contract': 'node_node_Product',\n 'townstar/product-contract': 'townstar_townstar_TownStar',\n 'townstar/token-contract': 'townstar_townstar_GalaChainToken',\n 'townstar/public-key-contract': 'townstar_townstar_PublicKeyContract',\n 'mirandus/public-key-contract': 'mirandus_mirandus_PublicKeyContract',\n 'mirandus/token-contract': 'mirandus_mirandus_GalaChainToken',\n 'mirandus/mirandus-contract': 'mirandus_mirandus_Product',\n 'galafilm/public-key-contract': 'galafilm_galafilm_PublicKeyContract',\n 'galafilm/token-contract': 'galafilm_galafilm_GalaChainToken',\n 'galafilm/galafilm-contract': 'galafilm_galafilm_Product',\n 'lastexpedition/public-key-contract': 'lastexpedition_lastexpedition_PublicKeyContract',\n 'lastexpedition/token-contract': 'lastexpedition_lastexpedition_GalaChainToken',\n 'lastexpedition/lastexpedition-contract': 'lastexpedition_lastexpedition_Product',\n 'legendsreborn/public-key-contract': 'legendsreborn_legendsreborn_PublicKeyContract',\n 'legendsreborn/token-contract': 'legendsreborn_legendsreborn_GalaChainToken',\n 'legendsreborn/legendsreborn-contract': 'legendsreborn_legendsreborn_Product',\n 'thewalkingdeadempires/public-key-contract':\n 'thewalkingdeadempires_thewalkingdeadempires_PublicKeyContract',\n 'thewalkingdeadempires/token-contract':\n 'thewalkingdeadempires_thewalkingdeadempires_GalaChainToken',\n 'thewalkingdeadempires/thewalkingdeadempires-contract':\n 'thewalkingdeadempires_thewalkingdeadempires_Product',\n 'vox/public-key-contract': 'vox_vox_PublicKeyContract',\n 'vox/token-contract': 'vox_vox_GalaChainToken',\n 'vox/auction-contract': 'vox_vox_AuctionContract',\n 'vox/phase-contract': 'vox_vox_PhaseContract',\n 'vox/vox-contract': 'vox_vox_VOXTokenContract',\n 'vox/resources-contract': 'vox_vox_VOXResourceToken',\n} as const;\n\n/**\n * Where the chain enforces an operation other than the platform table's, keyed `<contract path>:<method>`. The ONE\n * place such a deviation lives: every consumer (core's bridge-out signing, the wrap flow, Connect, the product SDKs)\n * asks `dtoOperationOf`, so nobody hard-codes the exception.\n *\n * - `RequestTokenBridgeOut`: the table maps `asset/bridge-contract` to bridge-chaincode, but a RequestTokenBridgeOut\n * is a TOKEN contract call. Verified on stage (2026-11-02): signed under\n * `asset-channel_bridge-chaincode_BridgeContract:RequestTokenBridgeOut` the chain answers \"signed to call ...\n * BridgeContract:RequestTokenBridgeOut, but the current operation is\n * asset-channel_basic-asset_GalaChainToken:RequestTokenBridgeOut\", and it accepts the token contract's.\n * - `GrantAllowance`: the grants embedded in a `BridgeTokenOut` are signed as\n * `asset-channel_bridge-chaincode_GalaChainToken:GrantAllowance`, which the table has no row for. Observed in\n * GalaConnect-signed stage traffic and verified against the chain with real signed writes (2026-11-05):\n * a bridge-out with the grants signed this way is accepted, the same DTO with the grants signed as\n * `BridgeContract:GrantAllowance` or `basic-asset_GalaChainToken:GrantAllowance` is refused at batch index 0. A\n * standalone GrantAllowance is a different route and keeps `basic-asset_GalaChainToken`. This SDK does not sign\n * the embedded grant itself.\n *\n * `asset/bridge-contract:BridgeTokenOut` is NOT here: the table's `BridgeContract:BridgeTokenOut` is accepted by the\n * chain for the external-chain bridge (verified 2026-11-05). The token contracts' own `BridgeTokenOut`\n * (`asset/token-contract`, `music/token-contract`, the channel move) is their plain prefix.\n */\nexport const CHAIN_METHOD_OPERATIONS = {\n 'asset/bridge-contract:RequestTokenBridgeOut':\n 'asset-channel_basic-asset_GalaChainToken:RequestTokenBridgeOut',\n 'asset/bridge-contract:GrantAllowance':\n 'asset-channel_bridge-chaincode_GalaChainToken:GrantAllowance',\n} as const;\n\n/** An API path of a GalaChain contract (`asset/token-contract`, `asset/dex-contract`, ...). */\nexport type ChainContractPath = keyof typeof CHAIN_CONTRACT_OPERATION_PREFIXES;\n\n/**\n * `value` as a {@link ChainContractPath}: a string naming a contract in the operation table (an\n * own key, so `toString` or a polluted prototype never counts). Checked before anything is built\n * or signed.\n *\n * @throws GalaSDKError `INVALID_CONTRACT_PATH` (`params.field` = `field`; the value is never\n * echoed).\n */\nexport function checkContractPath(value: unknown, field: string): ChainContractPath {\n if (\n typeof value === 'string' &&\n Object.prototype.hasOwnProperty.call(CHAIN_CONTRACT_OPERATION_PREFIXES, value)\n ) {\n return value as ChainContractPath;\n }\n throw new GalaSDKError('INVALID_CONTRACT_PATH', { field });\n}\n\n/**\n * The `dtoOperation` of `method` on the contract served at `contractPath`: the chain's own\n * (`CHAIN_METHOD_OPERATIONS`) where it deviates from the platform table, else the table's prefix plus `:<method>`.\n *\n * `ChainContractPath` is only a type: a plain-JS caller, or a path built at runtime\n * (`${channel}/${contract}`), can name a contract the table does not have. That is refused here, before\n * anything is signed, instead of becoming `undefined:<method>` that the chain would refuse after the\n * signature.\n *\n * @throws GalaSDKError SIGNING_FAILED when `contractPath` is not in the table.\n */\nexport function dtoOperationOf(contractPath: ChainContractPath, method: string): string {\n const methodKey = `${contractPath}:${method}`;\n if (Object.prototype.hasOwnProperty.call(CHAIN_METHOD_OPERATIONS, methodKey)) {\n return CHAIN_METHOD_OPERATIONS[methodKey as keyof typeof CHAIN_METHOD_OPERATIONS];\n }\n const prefix = Object.prototype.hasOwnProperty.call(\n CHAIN_CONTRACT_OPERATION_PREFIXES,\n contractPath,\n )\n ? CHAIN_CONTRACT_OPERATION_PREFIXES[contractPath]\n : undefined;\n if (prefix === undefined) {\n throw new GalaSDKError(\n 'SIGNING_FAILED',\n { method, reason: 'failed' },\n { cause: { contractPath, reason: 'unknown contract path: no dtoOperation is known for it' } },\n );\n }\n return `${prefix}:${method}`;\n}\n\n/**\n * `dto` with its `dtoOperation` set for `method` on `contractPath`. A DTO that already names a\n * different operation is refused: it was built for another call, and sending it would be rejected\n * by the chain after the signer had already signed it.\n *\n * @throws GalaSDKError SIGNING_FAILED when `dto.dtoOperation` is set and is not the operation of this call.\n */\nexport function withDtoOperation<T extends Record<string, unknown>>(\n contractPath: ChainContractPath,\n method: string,\n dto: T,\n): T & { readonly dtoOperation: string } {\n const dtoOperation = dtoOperationOf(contractPath, method);\n const present = dto['dtoOperation'];\n if (present !== undefined && present !== dtoOperation) {\n throw new GalaSDKError(\n 'SIGNING_FAILED',\n { method, reason: 'failed' },\n { cause: { dtoOperation: present, expected: dtoOperation } },\n );\n }\n return { ...dto, dtoOperation };\n}\n"],"mappings":"A,4DAeA,MAAaA,EAAoC,CAC/C,4BAA6B,8CAC7B,uBAAwB,2CACxB,qBAAsB,yCACtB,2BAA4B,sCAC5B,uBAAwB,0CACxB,qBAAsB,yCACtB,2BAA4B,8CAC5B,yBAA0B,4CAC1B,mCAAoC,qDAGpC,wBAAyB,gDACzB,mCAAoC,mDACpC,qBAAsB,wCACtB,uBAAwB,8CACxB,4BAA6B,gCAC7B,uBAAwB,wBACxB,uBAAwB,6BACxB,2BAA4B,0BAC5B,8BAA+B,oCAC/B,yBAA0B,iCAC1B,qCAAsC,kDACtC,iCAAkC,uDAClC,gCAAiC,+CACjC,+BAAgC,sCAChC,0BAA2B,mCAC3B,oBAAqB,4BACrB,6BAA8B,kCAC9B,wBAAyB,+BACzB,gBAAiB,uBACjB,qCAAsC,kDACtC,gCAAiC,+CACjC,gCAAiC,+CACjC,qCAAsC,kDACtC,gCAAiC,+CACjC,y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