@gala-chain/gswap-sdk 2.0.0-rc.2 → 2.0.0-rc.3
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 +1 -1
- package/dist/browser/classes/gswap.js.map +1 -1
- package/dist/browser/utils/validation.js +1 -1
- package/dist/browser/utils/validation.js.map +1 -1
- package/dist/index.cjs +13 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +15 -9
- package/dist/index.d.ts +15 -9
- package/dist/index.mjs +13 -7
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.d.cts
CHANGED
|
@@ -3329,9 +3329,10 @@ export interface GSwapOptions {
|
|
|
3329
3329
|
/**
|
|
3330
3330
|
* The selected account, sent as `X-Wallet-Address` on writes (attribution only; the chain
|
|
3331
3331
|
* recovers the signer from the signature). Required for shadow writes. Any spelling of an
|
|
3332
|
-
* Ethereum account (`eth|<40 hex>` in any casing, `
|
|
3333
|
-
* `
|
|
3334
|
-
*
|
|
3332
|
+
* Ethereum account (`eth|<40 hex>` in any casing, `0x...`, bare hex) is sent as `eth|<EIP-55>`,
|
|
3333
|
+
* `client|<id>` as written; a mixed-case spelling that is not the checksum is refused at
|
|
3334
|
+
* construction (`INVALID_WALLET_ADDRESS`), and `eth|0x...` (not an address form) is refused as
|
|
3335
|
+
* core's `INVALID_ETH_USER_REF_PREFIX`.
|
|
3335
3336
|
*/
|
|
3336
3337
|
walletAddress?: string | undefined;
|
|
3337
3338
|
/** `'stage'` or `'prod'` swap backend preset; defaults to `'prod'`. */
|
|
@@ -4436,22 +4437,27 @@ export declare function validateTickSpacing(tickSpacing: number): void;
|
|
|
4436
4437
|
/**
|
|
4437
4438
|
* The GalaChain user reference an owner, user or wallet address names, in the one spelling the
|
|
4438
4439
|
* gateway and the swap backend accept: `eth|<EIP-55 checksummed digits>` for an Ethereum account
|
|
4439
|
-
* (given as `eth|<40 hex>` in any casing, `
|
|
4440
|
-
*
|
|
4441
|
-
*
|
|
4440
|
+
* (given as `eth|<40 hex>` in any casing, `0x<40 hex>` or bare hex), `client|<id>` as written.
|
|
4441
|
+
* `eth|0x<hex>` is not an address form. This is `galaChainUserRef` of
|
|
4442
|
+
* `@gala-chain/gala-core-sdk`, the one implementation; only the error for a spelling that is no
|
|
4443
|
+
* address at all is this package's. Every place this SDK puts a user identity on the wire goes
|
|
4442
4444
|
* through it, so what is signed, sent and compared on the backend (`owner === position.owner`,
|
|
4443
4445
|
* strict) is always the chain's own spelling.
|
|
4444
4446
|
*
|
|
4445
4447
|
* @param value - The identity the caller gave.
|
|
4446
4448
|
* @param field - The field name reported in the error's `params.field`.
|
|
4447
|
-
* @throws
|
|
4448
|
-
*
|
|
4449
|
+
* @throws GalaSDKError core's `INVALID_ETH_USER_REF_PREFIX` (passed through as it is: its message
|
|
4450
|
+
* says an `eth|` reference takes the 40 hex digits with no `0x` and names the correct spelling,
|
|
4451
|
+
* `params.expected`) for `eth|0x...`; GSwapSDKError `INVALID_WALLET_ADDRESS` for anything else, a
|
|
4452
|
+
* mixed-case spelling whose casing is not the EIP-55 checksum included (a typo); nothing is
|
|
4453
|
+
* signed or sent.
|
|
4449
4454
|
*/
|
|
4450
4455
|
export declare function userRef(value: unknown, field: string): string;
|
|
4451
4456
|
/**
|
|
4452
4457
|
* {@link userRef} of an address that must be there.
|
|
4453
4458
|
*
|
|
4454
|
-
* @throws GSwapSDKError `MISSING_WALLET_ADDRESS` (undefined) or `INVALID_WALLET_ADDRESS
|
|
4459
|
+
* @throws GSwapSDKError `MISSING_WALLET_ADDRESS` (undefined) or `INVALID_WALLET_ADDRESS`; core's
|
|
4460
|
+
* `INVALID_ETH_USER_REF_PREFIX` for `eth|0x...` (see {@link userRef}).
|
|
4455
4461
|
*/
|
|
4456
4462
|
export declare function requireUserRef(address: string | undefined, field: string): string;
|
|
4457
4463
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -3329,9 +3329,10 @@ export interface GSwapOptions {
|
|
|
3329
3329
|
/**
|
|
3330
3330
|
* The selected account, sent as `X-Wallet-Address` on writes (attribution only; the chain
|
|
3331
3331
|
* recovers the signer from the signature). Required for shadow writes. Any spelling of an
|
|
3332
|
-
* Ethereum account (`eth|<40 hex>` in any casing, `
|
|
3333
|
-
* `
|
|
3334
|
-
*
|
|
3332
|
+
* Ethereum account (`eth|<40 hex>` in any casing, `0x...`, bare hex) is sent as `eth|<EIP-55>`,
|
|
3333
|
+
* `client|<id>` as written; a mixed-case spelling that is not the checksum is refused at
|
|
3334
|
+
* construction (`INVALID_WALLET_ADDRESS`), and `eth|0x...` (not an address form) is refused as
|
|
3335
|
+
* core's `INVALID_ETH_USER_REF_PREFIX`.
|
|
3335
3336
|
*/
|
|
3336
3337
|
walletAddress?: string | undefined;
|
|
3337
3338
|
/** `'stage'` or `'prod'` swap backend preset; defaults to `'prod'`. */
|
|
@@ -4436,22 +4437,27 @@ export declare function validateTickSpacing(tickSpacing: number): void;
|
|
|
4436
4437
|
/**
|
|
4437
4438
|
* The GalaChain user reference an owner, user or wallet address names, in the one spelling the
|
|
4438
4439
|
* gateway and the swap backend accept: `eth|<EIP-55 checksummed digits>` for an Ethereum account
|
|
4439
|
-
* (given as `eth|<40 hex>` in any casing, `
|
|
4440
|
-
*
|
|
4441
|
-
*
|
|
4440
|
+
* (given as `eth|<40 hex>` in any casing, `0x<40 hex>` or bare hex), `client|<id>` as written.
|
|
4441
|
+
* `eth|0x<hex>` is not an address form. This is `galaChainUserRef` of
|
|
4442
|
+
* `@gala-chain/gala-core-sdk`, the one implementation; only the error for a spelling that is no
|
|
4443
|
+
* address at all is this package's. Every place this SDK puts a user identity on the wire goes
|
|
4442
4444
|
* through it, so what is signed, sent and compared on the backend (`owner === position.owner`,
|
|
4443
4445
|
* strict) is always the chain's own spelling.
|
|
4444
4446
|
*
|
|
4445
4447
|
* @param value - The identity the caller gave.
|
|
4446
4448
|
* @param field - The field name reported in the error's `params.field`.
|
|
4447
|
-
* @throws
|
|
4448
|
-
*
|
|
4449
|
+
* @throws GalaSDKError core's `INVALID_ETH_USER_REF_PREFIX` (passed through as it is: its message
|
|
4450
|
+
* says an `eth|` reference takes the 40 hex digits with no `0x` and names the correct spelling,
|
|
4451
|
+
* `params.expected`) for `eth|0x...`; GSwapSDKError `INVALID_WALLET_ADDRESS` for anything else, a
|
|
4452
|
+
* mixed-case spelling whose casing is not the EIP-55 checksum included (a typo); nothing is
|
|
4453
|
+
* signed or sent.
|
|
4449
4454
|
*/
|
|
4450
4455
|
export declare function userRef(value: unknown, field: string): string;
|
|
4451
4456
|
/**
|
|
4452
4457
|
* {@link userRef} of an address that must be there.
|
|
4453
4458
|
*
|
|
4454
|
-
* @throws GSwapSDKError `MISSING_WALLET_ADDRESS` (undefined) or `INVALID_WALLET_ADDRESS
|
|
4459
|
+
* @throws GSwapSDKError `MISSING_WALLET_ADDRESS` (undefined) or `INVALID_WALLET_ADDRESS`; core's
|
|
4460
|
+
* `INVALID_ETH_USER_REF_PREFIX` for `eth|0x...` (see {@link userRef}).
|
|
4455
4461
|
*/
|
|
4456
4462
|
export declare function requireUserRef(address: string | undefined, field: string): string;
|
|
4457
4463
|
/**
|
package/dist/index.mjs
CHANGED
|
@@ -1539,21 +1539,26 @@ function validateTickSpacing(tickSpacing) {
|
|
|
1539
1539
|
/**
|
|
1540
1540
|
* The GalaChain user reference an owner, user or wallet address names, in the one spelling the
|
|
1541
1541
|
* gateway and the swap backend accept: `eth|<EIP-55 checksummed digits>` for an Ethereum account
|
|
1542
|
-
* (given as `eth|<40 hex>` in any casing, `
|
|
1543
|
-
*
|
|
1544
|
-
*
|
|
1542
|
+
* (given as `eth|<40 hex>` in any casing, `0x<40 hex>` or bare hex), `client|<id>` as written.
|
|
1543
|
+
* `eth|0x<hex>` is not an address form. This is `galaChainUserRef` of
|
|
1544
|
+
* `@gala-chain/gala-core-sdk`, the one implementation; only the error for a spelling that is no
|
|
1545
|
+
* address at all is this package's. Every place this SDK puts a user identity on the wire goes
|
|
1545
1546
|
* through it, so what is signed, sent and compared on the backend (`owner === position.owner`,
|
|
1546
1547
|
* strict) is always the chain's own spelling.
|
|
1547
1548
|
*
|
|
1548
1549
|
* @param value - The identity the caller gave.
|
|
1549
1550
|
* @param field - The field name reported in the error's `params.field`.
|
|
1550
|
-
* @throws
|
|
1551
|
-
*
|
|
1551
|
+
* @throws GalaSDKError core's `INVALID_ETH_USER_REF_PREFIX` (passed through as it is: its message
|
|
1552
|
+
* says an `eth|` reference takes the 40 hex digits with no `0x` and names the correct spelling,
|
|
1553
|
+
* `params.expected`) for `eth|0x...`; GSwapSDKError `INVALID_WALLET_ADDRESS` for anything else, a
|
|
1554
|
+
* mixed-case spelling whose casing is not the EIP-55 checksum included (a typo); nothing is
|
|
1555
|
+
* signed or sent.
|
|
1552
1556
|
*/
|
|
1553
1557
|
function userRef(value, field) {
|
|
1554
1558
|
try {
|
|
1555
1559
|
return galaChainUserRef(value, field);
|
|
1556
|
-
} catch {
|
|
1560
|
+
} catch (cause) {
|
|
1561
|
+
if (isGalaError(cause) && cause.code === "INVALID_ETH_USER_REF_PREFIX") throw cause;
|
|
1557
1562
|
throw new GSwapSDKError("INVALID_WALLET_ADDRESS", {
|
|
1558
1563
|
field,
|
|
1559
1564
|
value: String(value)
|
|
@@ -1563,7 +1568,8 @@ function userRef(value, field) {
|
|
|
1563
1568
|
/**
|
|
1564
1569
|
* {@link userRef} of an address that must be there.
|
|
1565
1570
|
*
|
|
1566
|
-
* @throws GSwapSDKError `MISSING_WALLET_ADDRESS` (undefined) or `INVALID_WALLET_ADDRESS
|
|
1571
|
+
* @throws GSwapSDKError `MISSING_WALLET_ADDRESS` (undefined) or `INVALID_WALLET_ADDRESS`; core's
|
|
1572
|
+
* `INVALID_ETH_USER_REF_PREFIX` for `eth|0x...` (see {@link userRef}).
|
|
1567
1573
|
*/
|
|
1568
1574
|
function requireUserRef(address, field) {
|
|
1569
1575
|
if (address === void 0) throw new GSwapSDKError("MISSING_WALLET_ADDRESS", {});
|