@gala-chain/gala-core-sdk 1.0.0-rc.7 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/wallet.cjs CHANGED
@@ -54,7 +54,7 @@ const REJECTION_NAME = "UserRejectedRequestError";
54
54
  /**
55
55
  * Wordings of a decline, matched case-insensitively as substrings. This is a LAST RESORT for
56
56
  * wallets that set neither a `code` nor a `name`: it reads a third party's text, so it is broad on
57
- * purpose (a superset of the matchers the Gala wallet and frontend_v2 used) and can in principle
57
+ * purpose (a superset of the matchers the Gala wallet and gSwap web app used) and can in principle
58
58
  * match an unrelated message that uses these words.
59
59
  */
60
60
  const REJECTION_PHRASES = [
@@ -1 +1 @@
1
- {"version":3,"file":"wallet.cjs","names":["isRecord"],"sources":["../src/utils/error_brand.ts","../src/utils/wallet_rejection.ts"],"sourcesContent":["/**\n * The brand every `GalaSDKError` (and so every product SDK's error) carries, and the duck-type\n * check for the \"failure shape\". This module has NO imports on purpose: it is part of the light\n * `@gala-chain/gala-core-sdk/wallet` entry, which must never pull the error catalog or the main\n * bundle in.\n */\n\n/**\n * The brand of an SDK error: `error[GALA_ERROR_BRAND] === true`. It is a registered symbol\n * (`Symbol.for`), so two copies of the SDK in one page (a wallet bundle and an app bundle) still\n * recognise each other's errors, which `instanceof` cannot do.\n */\nexport const GALA_ERROR_BRAND: unique symbol = Symbol.for('@gala-chain/gala-core-sdk/error');\n\n/** The least an object must have to be read as an SDK error or its plain-object view. */\nexport interface GalaErrorShape {\n readonly code: string;\n readonly params: Readonly<Record<string, unknown>>;\n}\n\nfunction isRecord(value: unknown): value is Record<PropertyKey, unknown> {\n return typeof value === 'object' && value !== null;\n}\n\n/** True when `value` carries the SDK error brand (a real `GalaSDKError`, from any copy of the SDK). */\nexport function hasGalaErrorBrand(value: unknown): boolean {\n return isRecord(value) && value[GALA_ERROR_BRAND] === true;\n}\n\n/**\n * True when `value` is an SDK error (it carries the brand) or a plain-object VIEW of one: a string\n * `code` and an object `params`, which is the shape of `GalaSDKError` and of the wrapper objects\n * an app builds from one (`{ code, params, status?, phase?, ... }`). A wallet's own error (an\n * EIP-1193 numeric `code`, an ethers error with a string `code` and no `params`) is neither. It\n * says the value has the SDK's shape, not that `code` is a code the SDK knows.\n *\n * @example\n * ```ts\n * if (isGalaErrorLike(error)) report(error.code, error.params); // no `instanceof`, no SDK import\n * ```\n */\nexport function isGalaErrorLike(value: unknown): value is GalaErrorShape {\n if (hasGalaErrorBrand(value)) return true;\n return (\n isRecord(value) &&\n typeof value['code'] === 'string' &&\n isRecord(value['params']) &&\n !Array.isArray(value['params'])\n );\n}\n","/**\n * What the SDK knows about a failure thrown by a WALLET (the signer an app supplies, or wallet\n * code of the app's own): the code the wallet put on it, and whether it means the person declined.\n * Both read only the wallet's own error value; neither shows or forwards its text.\n */\n\nimport { hasGalaErrorBrand, isGalaErrorLike } from './error_brand.js';\n\n// This module is the whole of the light `@gala-chain/gala-core-sdk/wallet` entry (and the main\n// entry re-exports it, so there is one implementation). It must stay dependency-free: it may\n// import only `./error_brand.js`, never the error catalog, `GalaSDKError` or the main index.\n\n/** Codes the EIP-1193 / ethers / viem families use for \"the person declined in the wallet\". */\nconst REJECTION_CODES: readonly unknown[] = [4001, 'ACTION_REJECTED', 'USER_REJECTED'];\n\n/** The `name` viem / wagmi give the error of a declined request. */\nconst REJECTION_NAME = 'UserRejectedRequestError';\n\n/**\n * Wordings of a decline, matched case-insensitively as substrings. This is a LAST RESORT for\n * wallets that set neither a `code` nor a `name`: it reads a third party's text, so it is broad on\n * purpose (a superset of the matchers the Gala wallet and frontend_v2 used) and can in principle\n * match an unrelated message that uses these words.\n */\nconst REJECTION_PHRASES: readonly string[] = [\n 'user rejected',\n 'user denied',\n 'user cancel',\n 'rejected the request',\n 'request rejected',\n 'rejected by user',\n 'action_rejected',\n 'cancelled',\n 'canceled',\n];\n\n/** Properties wallets nest their text under (EIP-1193, ethers, viem, Gala wallet). */\nconst TEXT_KEYS: readonly string[] = [\n 'message',\n 'Message',\n 'shortMessage',\n 'details',\n 'errorDetails',\n 'reason',\n];\n\n/** Wallet errors nest their text at most a level or two deep; the bound also stops a cyclic object. */\nconst MAX_TEXT_DEPTH = 3;\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null;\n}\n\nfunction textsOf(value: unknown, depth = 0): string[] {\n if (typeof value === 'string') return [value];\n if (!isRecord(value) || depth >= MAX_TEXT_DEPTH) return [];\n return TEXT_KEYS.flatMap((key) => textsOf(value[key], depth + 1));\n}\n\nfunction wordsADecline(text: string): boolean {\n const lower = text.toLowerCase();\n return (\n REJECTION_PHRASES.some((phrase) => lower.includes(phrase)) ||\n (lower.includes('signature') && lower.includes('cancel'))\n );\n}\n\n/**\n * True when a wallet's error (or just its message text) says the person DECLINED the request in\n * their wallet. This is exactly the test behind `SIGNING_FAILED` with `params.reason ===\n * 'user_rejected'`, exported for wallet code outside the SDK (connect and registration flows, a\n * v1 write path) so an app keeps no matcher of its own.\n *\n * It is decided from the wallet's own fields first: a `code` of `4001` (EIP-1193), `'ACTION_REJECTED'`\n * (ethers) or `'USER_REJECTED'`, or `name === 'UserRejectedRequestError'` (viem). Only when those are\n * absent is the wallet's TEXT read (`message`, `Message`, `shortMessage`, `details`, `errorDetails`,\n * `reason`, up to three levels deep, or a bare string): \"user rejected\", \"user denied\", \"user\n * cancelled\", \"request rejected\", \"rejected by user\", \"rejected the request\", \"cancelled\" /\n * \"canceled\", or a \"signature ... cancel\" sentence. The wording fallback is a last resort for\n * wallets that do not set codes; prefer `code` and `name` wherever you control the wallet.\n *\n * An SDK error is never read by its text: a `SIGNING_FAILED` is a decline exactly when its\n * `params.reason` is `user_rejected`, and every other SDK error is not one. The same holds for a\n * plain-object VIEW of an SDK error (`{ code: 'SIGNING_FAILED', params: { reason } }`, the shape\n * of an app's wrapper): a string `code` plus an object `params` is decided by the code alone, with\n * the wallet code list above still honoured for a view that is not branded, and its English is\n * never read. This works without `instanceof`, so it is safe across two copies of the SDK.\n *\n * @example\n * ```ts\n * try {\n * await wallet.connect();\n * } catch (error) {\n * if (isWalletUserRejection(error)) return; // the person said no: not an error to report\n * report(error);\n * }\n * ```\n */\nexport function isWalletUserRejection(value: unknown): boolean {\n if (isGalaErrorLike(value)) {\n if (value.code === 'SIGNING_FAILED') return value.params['reason'] === 'user_rejected';\n return !hasGalaErrorBrand(value) && REJECTION_CODES.includes(value.code);\n }\n if (isRecord(value)) {\n if (REJECTION_CODES.includes(value['code']) || value['name'] === REJECTION_NAME) return true;\n }\n return textsOf(value).some(wordsADecline);\n}\n\n/** The longest wallet code kept: real ones (`4001`, `ACTION_REJECTED`) are short. */\nconst MAX_WALLET_CODE_LENGTH = 64;\n\n/**\n * The code a wallet put on its error: an EIP-1193 / JSON-RPC number (`4001`, `-32603`) or an\n * ethers / viem string (`'ACTION_REJECTED'`), read from the error's own top-level `code`. Anything\n * else (no code, a non-finite number, an empty or very long string, an object) is `undefined`, so\n * the value is always a safe primitive. Used for `GalaSDKError.walletCode`.\n *\n * @example\n * ```ts\n * walletDeclineCode({ code: 4001, message: 'User rejected the request.' }); // 4001\n * walletDeclineCode(new Error('locked')); // undefined\n * ```\n */\nexport function walletDeclineCode(value: unknown): number | string | undefined {\n if (typeof value !== 'object' || value === null) return undefined;\n const { code } = value as { code?: unknown };\n if (typeof code === 'number') return Number.isFinite(code) ? code : undefined;\n if (typeof code === 'string' && code.length > 0 && code.length <= MAX_WALLET_CODE_LENGTH) {\n return code;\n }\n return undefined;\n}\n"],"mappings":";;;;;;;;;;;;;AAYA,MAAa,mBAAkC,OAAO,IAAI,iCAAiC;AAQ3F,SAASA,WAAS,OAAuD;CACvE,OAAO,OAAO,UAAU,YAAY,UAAU;AAChD;;AAGA,SAAgB,kBAAkB,OAAyB;CACzD,OAAOA,WAAS,KAAK,KAAK,MAAM,sBAAsB;AACxD;;;;;;;;;;;;;AAcA,SAAgB,gBAAgB,OAAyC;CACvE,IAAI,kB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AAGA,MAAM,yBAAyB;;;;;;;;;;;;;AAc/B,SAAgB,kBAAkB,OAA6C;CAC7E,IAAI,OAAO,UAAU,YAAY,UAAU,MAAM,OAAO;CACxD,MAAM,EAAE,SAAS;CACjB,IAAI,OAAO,SAAS,UAAU,OAAO,OAAO,SAAS,IAAI,IAAI,OAAO;CACpE,IAAI,OAAO,SAAS,YAAY,KAAK,SAAS,KAAK,KAAK,UAAU,wBAChE,OAAO;AAGX"}
1
+ {"version":3,"file":"wallet.cjs","names":["isRecord"],"sources":["../src/utils/error_brand.ts","../src/utils/wallet_rejection.ts"],"sourcesContent":["/**\n * The brand every `GalaSDKError` (and so every product SDK's error) carries, and the duck-type\n * check for the \"failure shape\". This module has NO imports on purpose: it is part of the light\n * `@gala-chain/gala-core-sdk/wallet` entry, which must never pull the error catalog or the main\n * bundle in.\n */\n\n/**\n * The brand of an SDK error: `error[GALA_ERROR_BRAND] === true`. It is a registered symbol\n * (`Symbol.for`), so two copies of the SDK in one page (a wallet bundle and an app bundle) still\n * recognise each other's errors, which `instanceof` cannot do.\n */\nexport const GALA_ERROR_BRAND: unique symbol = Symbol.for('@gala-chain/gala-core-sdk/error');\n\n/** The least an object must have to be read as an SDK error or its plain-object view. */\nexport interface GalaErrorShape {\n readonly code: string;\n readonly params: Readonly<Record<string, unknown>>;\n}\n\nfunction isRecord(value: unknown): value is Record<PropertyKey, unknown> {\n return typeof value === 'object' && value !== null;\n}\n\n/** True when `value` carries the SDK error brand (a real `GalaSDKError`, from any copy of the SDK). */\nexport function hasGalaErrorBrand(value: unknown): boolean {\n return isRecord(value) && value[GALA_ERROR_BRAND] === true;\n}\n\n/**\n * True when `value` is an SDK error (it carries the brand) or a plain-object VIEW of one: a string\n * `code` and an object `params`, which is the shape of `GalaSDKError` and of the wrapper objects\n * an app builds from one (`{ code, params, status?, phase?, ... }`). A wallet's own error (an\n * EIP-1193 numeric `code`, an ethers error with a string `code` and no `params`) is neither. It\n * says the value has the SDK's shape, not that `code` is a code the SDK knows.\n *\n * @example\n * ```ts\n * if (isGalaErrorLike(error)) report(error.code, error.params); // no `instanceof`, no SDK import\n * ```\n */\nexport function isGalaErrorLike(value: unknown): value is GalaErrorShape {\n if (hasGalaErrorBrand(value)) return true;\n return (\n isRecord(value) &&\n typeof value['code'] === 'string' &&\n isRecord(value['params']) &&\n !Array.isArray(value['params'])\n );\n}\n","/**\n * What the SDK knows about a failure thrown by a WALLET (the signer an app supplies, or wallet\n * code of the app's own): the code the wallet put on it, and whether it means the person declined.\n * Both read only the wallet's own error value; neither shows or forwards its text.\n */\n\nimport { hasGalaErrorBrand, isGalaErrorLike } from './error_brand.js';\n\n// This module is the whole of the light `@gala-chain/gala-core-sdk/wallet` entry (and the main\n// entry re-exports it, so there is one implementation). It must stay dependency-free: it may\n// import only `./error_brand.js`, never the error catalog, `GalaSDKError` or the main index.\n\n/** Codes the EIP-1193 / ethers / viem families use for \"the person declined in the wallet\". */\nconst REJECTION_CODES: readonly unknown[] = [4001, 'ACTION_REJECTED', 'USER_REJECTED'];\n\n/** The `name` viem / wagmi give the error of a declined request. */\nconst REJECTION_NAME = 'UserRejectedRequestError';\n\n/**\n * Wordings of a decline, matched case-insensitively as substrings. This is a LAST RESORT for\n * wallets that set neither a `code` nor a `name`: it reads a third party's text, so it is broad on\n * purpose (a superset of the matchers the Gala wallet and gSwap web app used) and can in principle\n * match an unrelated message that uses these words.\n */\nconst REJECTION_PHRASES: readonly string[] = [\n 'user rejected',\n 'user denied',\n 'user cancel',\n 'rejected the request',\n 'request rejected',\n 'rejected by user',\n 'action_rejected',\n 'cancelled',\n 'canceled',\n];\n\n/** Properties wallets nest their text under (EIP-1193, ethers, viem, Gala wallet). */\nconst TEXT_KEYS: readonly string[] = [\n 'message',\n 'Message',\n 'shortMessage',\n 'details',\n 'errorDetails',\n 'reason',\n];\n\n/** Wallet errors nest their text at most a level or two deep; the bound also stops a cyclic object. */\nconst MAX_TEXT_DEPTH = 3;\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null;\n}\n\nfunction textsOf(value: unknown, depth = 0): string[] {\n if (typeof value === 'string') return [value];\n if (!isRecord(value) || depth >= MAX_TEXT_DEPTH) return [];\n return TEXT_KEYS.flatMap((key) => textsOf(value[key], depth + 1));\n}\n\nfunction wordsADecline(text: string): boolean {\n const lower = text.toLowerCase();\n return (\n REJECTION_PHRASES.some((phrase) => lower.includes(phrase)) ||\n (lower.includes('signature') && lower.includes('cancel'))\n );\n}\n\n/**\n * True when a wallet's error (or just its message text) says the person DECLINED the request in\n * their wallet. This is exactly the test behind `SIGNING_FAILED` with `params.reason ===\n * 'user_rejected'`, exported for wallet code outside the SDK (connect and registration flows, a\n * v1 write path) so an app keeps no matcher of its own.\n *\n * It is decided from the wallet's own fields first: a `code` of `4001` (EIP-1193), `'ACTION_REJECTED'`\n * (ethers) or `'USER_REJECTED'`, or `name === 'UserRejectedRequestError'` (viem). Only when those are\n * absent is the wallet's TEXT read (`message`, `Message`, `shortMessage`, `details`, `errorDetails`,\n * `reason`, up to three levels deep, or a bare string): \"user rejected\", \"user denied\", \"user\n * cancelled\", \"request rejected\", \"rejected by user\", \"rejected the request\", \"cancelled\" /\n * \"canceled\", or a \"signature ... cancel\" sentence. The wording fallback is a last resort for\n * wallets that do not set codes; prefer `code` and `name` wherever you control the wallet.\n *\n * An SDK error is never read by its text: a `SIGNING_FAILED` is a decline exactly when its\n * `params.reason` is `user_rejected`, and every other SDK error is not one. The same holds for a\n * plain-object VIEW of an SDK error (`{ code: 'SIGNING_FAILED', params: { reason } }`, the shape\n * of an app's wrapper): a string `code` plus an object `params` is decided by the code alone, with\n * the wallet code list above still honoured for a view that is not branded, and its English is\n * never read. This works without `instanceof`, so it is safe across two copies of the SDK.\n *\n * @example\n * ```ts\n * try {\n * await wallet.connect();\n * } catch (error) {\n * if (isWalletUserRejection(error)) return; // the person said no: not an error to report\n * report(error);\n * }\n * ```\n */\nexport function isWalletUserRejection(value: unknown): boolean {\n if (isGalaErrorLike(value)) {\n if (value.code === 'SIGNING_FAILED') return value.params['reason'] === 'user_rejected';\n return !hasGalaErrorBrand(value) && REJECTION_CODES.includes(value.code);\n }\n if (isRecord(value)) {\n if (REJECTION_CODES.includes(value['code']) || value['name'] === REJECTION_NAME) return true;\n }\n return textsOf(value).some(wordsADecline);\n}\n\n/** The longest wallet code kept: real ones (`4001`, `ACTION_REJECTED`) are short. */\nconst MAX_WALLET_CODE_LENGTH = 64;\n\n/**\n * The code a wallet put on its error: an EIP-1193 / JSON-RPC number (`4001`, `-32603`) or an\n * ethers / viem string (`'ACTION_REJECTED'`), read from the error's own top-level `code`. Anything\n * else (no code, a non-finite number, an empty or very long string, an object) is `undefined`, so\n * the value is always a safe primitive. Used for `GalaSDKError.walletCode`.\n *\n * @example\n * ```ts\n * walletDeclineCode({ code: 4001, message: 'User rejected the request.' }); // 4001\n * walletDeclineCode(new Error('locked')); // undefined\n * ```\n */\nexport function walletDeclineCode(value: unknown): number | string | undefined {\n if (typeof value !== 'object' || value === null) return undefined;\n const { code } = value as { code?: unknown };\n if (typeof code === 'number') return Number.isFinite(code) ? code : undefined;\n if (typeof code === 'string' && code.length > 0 && code.length <= MAX_WALLET_CODE_LENGTH) {\n return code;\n }\n return undefined;\n}\n"],"mappings":";;;;;;;;;;;;;AAYA,MAAa,mBAAkC,OAAO,IAAI,iCAAiC;AAQ3F,SAASA,WAAS,OAAuD;CACvE,OAAO,OAAO,UAAU,YAAY,UAAU;AAChD;;AAGA,SAAgB,kBAAkB,OAAyB;CACzD,OAAOA,WAAS,KAAK,KAAK,MAAM,sBAAsB;AACxD;;;;;;;;;;;;;AAcA,SAAgB,gBAAgB,OAAyC;CACvE,IAAI,kBAAkB,KAAK,GAAG,OAAO;CACrC,OACEA,WAAS,KAAK,KACd,OAAO,MAAM,YAAY,YACzBA,WAAS,MAAM,SAAS,KACxB,CAAC,MAAM,QAAQ,MAAM,SAAS;AAElC;;;;;;;;;;ACpCA,MAAM,kBAAsC;CAAC;C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,SAAS,IAAI,IAAI,OAAO;CACpE,IAAI,OAAO,SAAS,YAAY,KAAK,SAAS,KAAK,KAAK,UAAU,wBAChE,OAAO;AAGX"}
package/dist/wallet.mjs CHANGED
@@ -53,7 +53,7 @@ const REJECTION_NAME = "UserRejectedRequestError";
53
53
  /**
54
54
  * Wordings of a decline, matched case-insensitively as substrings. This is a LAST RESORT for
55
55
  * wallets that set neither a `code` nor a `name`: it reads a third party's text, so it is broad on
56
- * purpose (a superset of the matchers the Gala wallet and frontend_v2 used) and can in principle
56
+ * purpose (a superset of the matchers the Gala wallet and gSwap web app used) and can in principle
57
57
  * match an unrelated message that uses these words.
58
58
  */
59
59
  const REJECTION_PHRASES = [
@@ -1 +1 @@
1
- {"version":3,"file":"wallet.mjs","names":["isRecord"],"sources":["../src/utils/error_brand.ts","../src/utils/wallet_rejection.ts"],"sourcesContent":["/**\n * The brand every `GalaSDKError` (and so every product SDK's error) carries, and the duck-type\n * check for the \"failure shape\". This module has NO imports on purpose: it is part of the light\n * `@gala-chain/gala-core-sdk/wallet` entry, which must never pull the error catalog or the main\n * bundle in.\n */\n\n/**\n * The brand of an SDK error: `error[GALA_ERROR_BRAND] === true`. It is a registered symbol\n * (`Symbol.for`), so two copies of the SDK in one page (a wallet bundle and an app bundle) still\n * recognise each other's errors, which `instanceof` cannot do.\n */\nexport const GALA_ERROR_BRAND: unique symbol = Symbol.for('@gala-chain/gala-core-sdk/error');\n\n/** The least an object must have to be read as an SDK error or its plain-object view. */\nexport interface GalaErrorShape {\n readonly code: string;\n readonly params: Readonly<Record<string, unknown>>;\n}\n\nfunction isRecord(value: unknown): value is Record<PropertyKey, unknown> {\n return typeof value === 'object' && value !== null;\n}\n\n/** True when `value` carries the SDK error brand (a real `GalaSDKError`, from any copy of the SDK). */\nexport function hasGalaErrorBrand(value: unknown): boolean {\n return isRecord(value) && value[GALA_ERROR_BRAND] === true;\n}\n\n/**\n * True when `value` is an SDK error (it carries the brand) or a plain-object VIEW of one: a string\n * `code` and an object `params`, which is the shape of `GalaSDKError` and of the wrapper objects\n * an app builds from one (`{ code, params, status?, phase?, ... }`). A wallet's own error (an\n * EIP-1193 numeric `code`, an ethers error with a string `code` and no `params`) is neither. It\n * says the value has the SDK's shape, not that `code` is a code the SDK knows.\n *\n * @example\n * ```ts\n * if (isGalaErrorLike(error)) report(error.code, error.params); // no `instanceof`, no SDK import\n * ```\n */\nexport function isGalaErrorLike(value: unknown): value is GalaErrorShape {\n if (hasGalaErrorBrand(value)) return true;\n return (\n isRecord(value) &&\n typeof value['code'] === 'string' &&\n isRecord(value['params']) &&\n !Array.isArray(value['params'])\n );\n}\n","/**\n * What the SDK knows about a failure thrown by a WALLET (the signer an app supplies, or wallet\n * code of the app's own): the code the wallet put on it, and whether it means the person declined.\n * Both read only the wallet's own error value; neither shows or forwards its text.\n */\n\nimport { hasGalaErrorBrand, isGalaErrorLike } from './error_brand.js';\n\n// This module is the whole of the light `@gala-chain/gala-core-sdk/wallet` entry (and the main\n// entry re-exports it, so there is one implementation). It must stay dependency-free: it may\n// import only `./error_brand.js`, never the error catalog, `GalaSDKError` or the main index.\n\n/** Codes the EIP-1193 / ethers / viem families use for \"the person declined in the wallet\". */\nconst REJECTION_CODES: readonly unknown[] = [4001, 'ACTION_REJECTED', 'USER_REJECTED'];\n\n/** The `name` viem / wagmi give the error of a declined request. */\nconst REJECTION_NAME = 'UserRejectedRequestError';\n\n/**\n * Wordings of a decline, matched case-insensitively as substrings. This is a LAST RESORT for\n * wallets that set neither a `code` nor a `name`: it reads a third party's text, so it is broad on\n * purpose (a superset of the matchers the Gala wallet and frontend_v2 used) and can in principle\n * match an unrelated message that uses these words.\n */\nconst REJECTION_PHRASES: readonly string[] = [\n 'user rejected',\n 'user denied',\n 'user cancel',\n 'rejected the request',\n 'request rejected',\n 'rejected by user',\n 'action_rejected',\n 'cancelled',\n 'canceled',\n];\n\n/** Properties wallets nest their text under (EIP-1193, ethers, viem, Gala wallet). */\nconst TEXT_KEYS: readonly string[] = [\n 'message',\n 'Message',\n 'shortMessage',\n 'details',\n 'errorDetails',\n 'reason',\n];\n\n/** Wallet errors nest their text at most a level or two deep; the bound also stops a cyclic object. */\nconst MAX_TEXT_DEPTH = 3;\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null;\n}\n\nfunction textsOf(value: unknown, depth = 0): string[] {\n if (typeof value === 'string') return [value];\n if (!isRecord(value) || depth >= MAX_TEXT_DEPTH) return [];\n return TEXT_KEYS.flatMap((key) => textsOf(value[key], depth + 1));\n}\n\nfunction wordsADecline(text: string): boolean {\n const lower = text.toLowerCase();\n return (\n REJECTION_PHRASES.some((phrase) => lower.includes(phrase)) ||\n (lower.includes('signature') && lower.includes('cancel'))\n );\n}\n\n/**\n * True when a wallet's error (or just its message text) says the person DECLINED the request in\n * their wallet. This is exactly the test behind `SIGNING_FAILED` with `params.reason ===\n * 'user_rejected'`, exported for wallet code outside the SDK (connect and registration flows, a\n * v1 write path) so an app keeps no matcher of its own.\n *\n * It is decided from the wallet's own fields first: a `code` of `4001` (EIP-1193), `'ACTION_REJECTED'`\n * (ethers) or `'USER_REJECTED'`, or `name === 'UserRejectedRequestError'` (viem). Only when those are\n * absent is the wallet's TEXT read (`message`, `Message`, `shortMessage`, `details`, `errorDetails`,\n * `reason`, up to three levels deep, or a bare string): \"user rejected\", \"user denied\", \"user\n * cancelled\", \"request rejected\", \"rejected by user\", \"rejected the request\", \"cancelled\" /\n * \"canceled\", or a \"signature ... cancel\" sentence. The wording fallback is a last resort for\n * wallets that do not set codes; prefer `code` and `name` wherever you control the wallet.\n *\n * An SDK error is never read by its text: a `SIGNING_FAILED` is a decline exactly when its\n * `params.reason` is `user_rejected`, and every other SDK error is not one. The same holds for a\n * plain-object VIEW of an SDK error (`{ code: 'SIGNING_FAILED', params: { reason } }`, the shape\n * of an app's wrapper): a string `code` plus an object `params` is decided by the code alone, with\n * the wallet code list above still honoured for a view that is not branded, and its English is\n * never read. This works without `instanceof`, so it is safe across two copies of the SDK.\n *\n * @example\n * ```ts\n * try {\n * await wallet.connect();\n * } catch (error) {\n * if (isWalletUserRejection(error)) return; // the person said no: not an error to report\n * report(error);\n * }\n * ```\n */\nexport function isWalletUserRejection(value: unknown): boolean {\n if (isGalaErrorLike(value)) {\n if (value.code === 'SIGNING_FAILED') return value.params['reason'] === 'user_rejected';\n return !hasGalaErrorBrand(value) && REJECTION_CODES.includes(value.code);\n }\n if (isRecord(value)) {\n if (REJECTION_CODES.includes(value['code']) || value['name'] === REJECTION_NAME) return true;\n }\n return textsOf(value).some(wordsADecline);\n}\n\n/** The longest wallet code kept: real ones (`4001`, `ACTION_REJECTED`) are short. */\nconst MAX_WALLET_CODE_LENGTH = 64;\n\n/**\n * The code a wallet put on its error: an EIP-1193 / JSON-RPC number (`4001`, `-32603`) or an\n * ethers / viem string (`'ACTION_REJECTED'`), read from the error's own top-level `code`. Anything\n * else (no code, a non-finite number, an empty or very long string, an object) is `undefined`, so\n * the value is always a safe primitive. Used for `GalaSDKError.walletCode`.\n *\n * @example\n * ```ts\n * walletDeclineCode({ code: 4001, message: 'User rejected the request.' }); // 4001\n * walletDeclineCode(new Error('locked')); // undefined\n * ```\n */\nexport function walletDeclineCode(value: unknown): number | string | undefined {\n if (typeof value !== 'object' || value === null) return undefined;\n const { code } = value as { code?: unknown };\n if (typeof code === 'number') return Number.isFinite(code) ? code : undefined;\n if (typeof code === 'string' && code.length > 0 && code.length <= MAX_WALLET_CODE_LENGTH) {\n return code;\n }\n return undefined;\n}\n"],"mappings":";;;;;;;;;;;;AAYA,MAAa,mBAAkC,OAAO,IAAI,iCAAiC;AAQ3F,SAASA,WAAS,OAAuD;CACvE,OAAO,OAAO,UAAU,YAAY,UAAU;AAChD;;AAGA,SAAgB,kBAAkB,OAAyB;CACzD,OAAOA,WAAS,KAAK,KAAK,MAAM,sBAAsB;AACxD;;;;;;;;;;;;;AAcA,SAAgB,gBAAgB,OAAyC;CACvE,IAAI,kBAAkB,KAAK,GAAG,O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;;;;;;;;;;;;;AAc/B,SAAgB,kBAAkB,OAA6C;CAC7E,IAAI,OAAO,UAAU,YAAY,UAAU,MAAM,OAAO;CACxD,MAAM,EAAE,SAAS;CACjB,IAAI,OAAO,SAAS,UAAU,OAAO,OAAO,SAAS,IAAI,IAAI,OAAO;CACpE,IAAI,OAAO,SAAS,YAAY,KAAK,SAAS,KAAK,KAAK,UAAU,wBAChE,OAAO;AAGX"}
1
+ {"version":3,"file":"wallet.mjs","names":["isRecord"],"sources":["../src/utils/error_brand.ts","../src/utils/wallet_rejection.ts"],"sourcesContent":["/**\n * The brand every `GalaSDKError` (and so every product SDK's error) carries, and the duck-type\n * check for the \"failure shape\". This module has NO imports on purpose: it is part of the light\n * `@gala-chain/gala-core-sdk/wallet` entry, which must never pull the error catalog or the main\n * bundle in.\n */\n\n/**\n * The brand of an SDK error: `error[GALA_ERROR_BRAND] === true`. It is a registered symbol\n * (`Symbol.for`), so two copies of the SDK in one page (a wallet bundle and an app bundle) still\n * recognise each other's errors, which `instanceof` cannot do.\n */\nexport const GALA_ERROR_BRAND: unique symbol = Symbol.for('@gala-chain/gala-core-sdk/error');\n\n/** The least an object must have to be read as an SDK error or its plain-object view. */\nexport interface GalaErrorShape {\n readonly code: string;\n readonly params: Readonly<Record<string, unknown>>;\n}\n\nfunction isRecord(value: unknown): value is Record<PropertyKey, unknown> {\n return typeof value === 'object' && value !== null;\n}\n\n/** True when `value` carries the SDK error brand (a real `GalaSDKError`, from any copy of the SDK). */\nexport function hasGalaErrorBrand(value: unknown): boolean {\n return isRecord(value) && value[GALA_ERROR_BRAND] === true;\n}\n\n/**\n * True when `value` is an SDK error (it carries the brand) or a plain-object VIEW of one: a string\n * `code` and an object `params`, which is the shape of `GalaSDKError` and of the wrapper objects\n * an app builds from one (`{ code, params, status?, phase?, ... }`). A wallet's own error (an\n * EIP-1193 numeric `code`, an ethers error with a string `code` and no `params`) is neither. It\n * says the value has the SDK's shape, not that `code` is a code the SDK knows.\n *\n * @example\n * ```ts\n * if (isGalaErrorLike(error)) report(error.code, error.params); // no `instanceof`, no SDK import\n * ```\n */\nexport function isGalaErrorLike(value: unknown): value is GalaErrorShape {\n if (hasGalaErrorBrand(value)) return true;\n return (\n isRecord(value) &&\n typeof value['code'] === 'string' &&\n isRecord(value['params']) &&\n !Array.isArray(value['params'])\n );\n}\n","/**\n * What the SDK knows about a failure thrown by a WALLET (the signer an app supplies, or wallet\n * code of the app's own): the code the wallet put on it, and whether it means the person declined.\n * Both read only the wallet's own error value; neither shows or forwards its text.\n */\n\nimport { hasGalaErrorBrand, isGalaErrorLike } from './error_brand.js';\n\n// This module is the whole of the light `@gala-chain/gala-core-sdk/wallet` entry (and the main\n// entry re-exports it, so there is one implementation). It must stay dependency-free: it may\n// import only `./error_brand.js`, never the error catalog, `GalaSDKError` or the main index.\n\n/** Codes the EIP-1193 / ethers / viem families use for \"the person declined in the wallet\". */\nconst REJECTION_CODES: readonly unknown[] = [4001, 'ACTION_REJECTED', 'USER_REJECTED'];\n\n/** The `name` viem / wagmi give the error of a declined request. */\nconst REJECTION_NAME = 'UserRejectedRequestError';\n\n/**\n * Wordings of a decline, matched case-insensitively as substrings. This is a LAST RESORT for\n * wallets that set neither a `code` nor a `name`: it reads a third party's text, so it is broad on\n * purpose (a superset of the matchers the Gala wallet and gSwap web app used) and can in principle\n * match an unrelated message that uses these words.\n */\nconst REJECTION_PHRASES: readonly string[] = [\n 'user rejected',\n 'user denied',\n 'user cancel',\n 'rejected the request',\n 'request rejected',\n 'rejected by user',\n 'action_rejected',\n 'cancelled',\n 'canceled',\n];\n\n/** Properties wallets nest their text under (EIP-1193, ethers, viem, Gala wallet). */\nconst TEXT_KEYS: readonly string[] = [\n 'message',\n 'Message',\n 'shortMessage',\n 'details',\n 'errorDetails',\n 'reason',\n];\n\n/** Wallet errors nest their text at most a level or two deep; the bound also stops a cyclic object. */\nconst MAX_TEXT_DEPTH = 3;\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null;\n}\n\nfunction textsOf(value: unknown, depth = 0): string[] {\n if (typeof value === 'string') return [value];\n if (!isRecord(value) || depth >= MAX_TEXT_DEPTH) return [];\n return TEXT_KEYS.flatMap((key) => textsOf(value[key], depth + 1));\n}\n\nfunction wordsADecline(text: string): boolean {\n const lower = text.toLowerCase();\n return (\n REJECTION_PHRASES.some((phrase) => lower.includes(phrase)) ||\n (lower.includes('signature') && lower.includes('cancel'))\n );\n}\n\n/**\n * True when a wallet's error (or just its message text) says the person DECLINED the request in\n * their wallet. This is exactly the test behind `SIGNING_FAILED` with `params.reason ===\n * 'user_rejected'`, exported for wallet code outside the SDK (connect and registration flows, a\n * v1 write path) so an app keeps no matcher of its own.\n *\n * It is decided from the wallet's own fields first: a `code` of `4001` (EIP-1193), `'ACTION_REJECTED'`\n * (ethers) or `'USER_REJECTED'`, or `name === 'UserRejectedRequestError'` (viem). Only when those are\n * absent is the wallet's TEXT read (`message`, `Message`, `shortMessage`, `details`, `errorDetails`,\n * `reason`, up to three levels deep, or a bare string): \"user rejected\", \"user denied\", \"user\n * cancelled\", \"request rejected\", \"rejected by user\", \"rejected the request\", \"cancelled\" /\n * \"canceled\", or a \"signature ... cancel\" sentence. The wording fallback is a last resort for\n * wallets that do not set codes; prefer `code` and `name` wherever you control the wallet.\n *\n * An SDK error is never read by its text: a `SIGNING_FAILED` is a decline exactly when its\n * `params.reason` is `user_rejected`, and every other SDK error is not one. The same holds for a\n * plain-object VIEW of an SDK error (`{ code: 'SIGNING_FAILED', params: { reason } }`, the shape\n * of an app's wrapper): a string `code` plus an object `params` is decided by the code alone, with\n * the wallet code list above still honoured for a view that is not branded, and its English is\n * never read. This works without `instanceof`, so it is safe across two copies of the SDK.\n *\n * @example\n * ```ts\n * try {\n * await wallet.connect();\n * } catch (error) {\n * if (isWalletUserRejection(error)) return; // the person said no: not an error to report\n * report(error);\n * }\n * ```\n */\nexport function isWalletUserRejection(value: unknown): boolean {\n if (isGalaErrorLike(value)) {\n if (value.code === 'SIGNING_FAILED') return value.params['reason'] === 'user_rejected';\n return !hasGalaErrorBrand(value) && REJECTION_CODES.includes(value.code);\n }\n if (isRecord(value)) {\n if (REJECTION_CODES.includes(value['code']) || value['name'] === REJECTION_NAME) return true;\n }\n return textsOf(value).some(wordsADecline);\n}\n\n/** The longest wallet code kept: real ones (`4001`, `ACTION_REJECTED`) are short. */\nconst MAX_WALLET_CODE_LENGTH = 64;\n\n/**\n * The code a wallet put on its error: an EIP-1193 / JSON-RPC number (`4001`, `-32603`) or an\n * ethers / viem string (`'ACTION_REJECTED'`), read from the error's own top-level `code`. Anything\n * else (no code, a non-finite number, an empty or very long string, an object) is `undefined`, so\n * the value is always a safe primitive. Used for `GalaSDKError.walletCode`.\n *\n * @example\n * ```ts\n * walletDeclineCode({ code: 4001, message: 'User rejected the request.' }); // 4001\n * walletDeclineCode(new Error('locked')); // undefined\n * ```\n */\nexport function walletDeclineCode(value: unknown): number | string | undefined {\n if (typeof value !== 'object' || value === null) return undefined;\n const { code } = value as { code?: unknown };\n if (typeof code === 'number') return Number.isFinite(code) ? code : undefined;\n if (typeof code === 'string' && code.length > 0 && code.length <= MAX_WALLET_CODE_LENGTH) {\n return code;\n }\n return undefined;\n}\n"],"mappings":";;;;;;;;;;;;AAYA,MAAa,mBAAkC,OAAO,IAAI,iCAAiC;AAQ3F,SAASA,WAAS,OAAuD;CACvE,OAAO,OAAO,UAAU,YAAY,UAAU;AAChD;;AAGA,SAAgB,kBAAkB,OAAyB;CACzD,OAAOA,WAAS,KAAK,KAAK,MAAM,sBAAsB;AACxD;;;;;;;;;;;;;AAcA,SAAgB,gBAAgB,OAAyC;CACvE,IAAI,kBAAkB,KAAK,GAAG,OAAO;CACrC,OACEA,WAAS,KAAK,KACd,OAAO,MAAM,YAAY,YACzBA,WAAS,MAAM,SAAS,KACxB,CAAC,MAAM,QAAQ,MAAM,SAAS;AAElC;;;;;;;;;;ACpCA,MAAM,kBAAsC;CAAC;CAAM;CAAmB;AAAe;;A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AAO;CACpE,IAAI,OAAO,SAAS,YAAY,KAAK,SAAS,KAAK,KAAK,UAAU,wBAChE,OAAO;AAGX"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gala-chain/gala-core-sdk",
3
- "version": "1.0.0-rc.7",
3
+ "version": "1.0.0",
4
4
  "description": "The GalaChain core SDK: signing (native, personal-sign, EIP-712), the gateway transport, the gateway token reads (balances, token classes, NFT collections) and writes (transfer, burn, lock, unlock) and the shared error model, for every product SDK and app. React Native safe.",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.mjs",
@@ -134,7 +134,7 @@
134
134
  "bs58": "^6.0.0",
135
135
  "c8": "^12.0.0",
136
136
  "chai": "^6.2.2",
137
- "eslint": "^10.10.0",
137
+ "eslint": "^10.13.0",
138
138
  "eslint-config-prettier": "^10.1.5",
139
139
  "eslint-plugin-unused-imports": "^4.4.1",
140
140
  "ethers": "^6.17.0",
@@ -142,8 +142,8 @@
142
142
  "jsdom": "^27.4.0",
143
143
  "mocha": "^12.0.0",
144
144
  "prettier": "^3.5.3",
145
- "react": "^19.3.0",
146
- "react-dom": "^19.3.0",
145
+ "react": "^19.3.1",
146
+ "react-dom": "^19.3.1",
147
147
  "rolldown": "1.2.10",
148
148
  "tsdown": "^0.23.0",
149
149
  "tsx": "^4.23.13",
@@ -175,10 +175,17 @@
175
175
  "check:coverage:goal": "pnpm run test:cov && pnpm run coverage:goal",
176
176
  "check:clones": "jscpd src tests --min-lines 12 --min-tokens 70 --threshold 0 --reporters console --ignore \"tests/fixtures/*-signing-golden.json,tests/fixtures/*-recorded.json\"",
177
177
  "check:rn-safety": "tsx scripts/rn-safety.ts",
178
- "check:strict": "pnpm run typecheck && pnpm run typecheck:tests && pnpm run lint && pnpm run check:clones && pnpm run check:rn-safety",
178
+ "check:strict": "pnpm run typecheck && pnpm run typecheck:tests && pnpm run lint && pnpm run check:clones && pnpm run check:rn-safety && pnpm run docs:check:contract",
179
179
  "check:all": "pnpm run check:strict && pnpm run check:coverage:goal && pnpm run build && pnpm run check:pack",
180
180
  "check:pack": "tsx scripts/packed-smoke.ts",
181
181
  "clean": "rm -rf dist",
182
- "docs:error-catalog": "tsx scripts/error-catalog-docs.ts"
182
+ "docs:error-catalog": "tsx scripts/error-catalog-docs.ts",
183
+ "docs:error-catalog-json": "tsx scripts/error-catalog-json.ts",
184
+ "docs:generate": "pnpm run docs:error-catalog && pnpm run docs:error-catalog-json",
185
+ "docs:build": "tsx ../docs-tools/src/cli.ts build",
186
+ "docs:check": "pnpm run build && pnpm run docs:build && tsx ../docs-tools/src/cli.ts check",
187
+ "docs:check:contract": "tsx ../docs-tools/src/cli.ts contract",
188
+ "docs:exports:update": "tsx ../docs-tools/src/cli.ts exports-update",
189
+ "docs:sync": "tsx ../docs-tools/src/cli.ts sync"
183
190
  }
184
191
  }