@gala-chain/gswap-sdk 2.1.0-beta.2 → 2.1.0-beta.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -1197,7 +1197,10 @@ export interface DexFeeQuote {
1197
1197
  }
1198
1198
  /**
1199
1199
  * Reduces an EIP-712 approval `message` to the DTO the chain actually receives: drops the signing
1200
- * envelope (`signature`, `prefix`, `types`, `domain`) and transport metadata (`trace`).
1200
+ * envelope (`signature`, `prefix`, `types`, `domain`), the `dtoOperation` it was signed to call (a
1201
+ * DryRun runs the DTO inside a wrapper signed for `DryRun`; left inside, the chain refuses it:
1202
+ * "signed to call ...:RequestTrade, but the current operation is ...:DryRun") and transport
1203
+ * metadata (`trace`).
1201
1204
  */
1202
1205
  export declare function toChainDto(message: Record<string, unknown>): Record<string, unknown>;
1203
1206
  /**
@@ -1205,7 +1208,9 @@ export declare function toChainDto(message: Record<string, unknown>): Record<str
1205
1208
  * `{ callerPublicKey, method, dto: <inner DTO object>, uniqueKey, signature }`. The inner DTO
1206
1209
  * travels unsigned and as an object; no `signerPublicKey` is sent because the signature already
1207
1210
  * recovers it (the gateway rejects it as REDUNDANT_SIGNER_PUBLIC_KEY). The wrapper carries its own
1208
- * `uniqueKey`, distinct from the DTO's.
1211
+ * `uniqueKey`, distinct from the DTO's, and its own `dtoOperation` (`<Contract>:DryRun`); the inner DTO
1212
+ * carries none of the signing envelope or the `dtoOperation` of the call it simulates (see
1213
+ * {@link toChainDto}), whatever the caller passes, so a signed DTO can be handed in as is.
1209
1214
  */
1210
1215
  export declare function buildDryRunWrapper(signer: GalaChainSigner, callerPublicKey: string, method: string, dto: Record<string, unknown>, uniqueKeyPrefix?: string, contractPath?: ChainContractPath): Promise<Record<string, unknown>>;
1211
1216
  /** The transport and backend a fee quote reads from. */
package/dist/index.d.ts CHANGED
@@ -1197,7 +1197,10 @@ export interface DexFeeQuote {
1197
1197
  }
1198
1198
  /**
1199
1199
  * Reduces an EIP-712 approval `message` to the DTO the chain actually receives: drops the signing
1200
- * envelope (`signature`, `prefix`, `types`, `domain`) and transport metadata (`trace`).
1200
+ * envelope (`signature`, `prefix`, `types`, `domain`), the `dtoOperation` it was signed to call (a
1201
+ * DryRun runs the DTO inside a wrapper signed for `DryRun`; left inside, the chain refuses it:
1202
+ * "signed to call ...:RequestTrade, but the current operation is ...:DryRun") and transport
1203
+ * metadata (`trace`).
1201
1204
  */
1202
1205
  export declare function toChainDto(message: Record<string, unknown>): Record<string, unknown>;
1203
1206
  /**
@@ -1205,7 +1208,9 @@ export declare function toChainDto(message: Record<string, unknown>): Record<str
1205
1208
  * `{ callerPublicKey, method, dto: <inner DTO object>, uniqueKey, signature }`. The inner DTO
1206
1209
  * travels unsigned and as an object; no `signerPublicKey` is sent because the signature already
1207
1210
  * recovers it (the gateway rejects it as REDUNDANT_SIGNER_PUBLIC_KEY). The wrapper carries its own
1208
- * `uniqueKey`, distinct from the DTO's.
1211
+ * `uniqueKey`, distinct from the DTO's, and its own `dtoOperation` (`<Contract>:DryRun`); the inner DTO
1212
+ * carries none of the signing envelope or the `dtoOperation` of the call it simulates (see
1213
+ * {@link toChainDto}), whatever the caller passes, so a signed DTO can be handed in as is.
1209
1214
  */
1210
1215
  export declare function buildDryRunWrapper(signer: GalaChainSigner, callerPublicKey: string, method: string, dto: Record<string, unknown>, uniqueKeyPrefix?: string, contractPath?: ChainContractPath): Promise<Record<string, unknown>>;
1211
1216
  /** The transport and backend a fee quote reads from. */
package/dist/index.mjs CHANGED
@@ -1702,7 +1702,10 @@ function isCurrentContractDexMessage(message, method) {
1702
1702
  }
1703
1703
  /**
1704
1704
  * Reduces an EIP-712 approval `message` to the DTO the chain actually receives: drops the signing
1705
- * envelope (`signature`, `prefix`, `types`, `domain`) and transport metadata (`trace`).
1705
+ * envelope (`signature`, `prefix`, `types`, `domain`), the `dtoOperation` it was signed to call (a
1706
+ * DryRun runs the DTO inside a wrapper signed for `DryRun`; left inside, the chain refuses it:
1707
+ * "signed to call ...:RequestTrade, but the current operation is ...:DryRun") and transport
1708
+ * metadata (`trace`).
1706
1709
  */
1707
1710
  function toChainDto(message) {
1708
1711
  const chainDto = { ...message };
@@ -1711,6 +1714,7 @@ function toChainDto(message) {
1711
1714
  "prefix",
1712
1715
  "types",
1713
1716
  "domain",
1717
+ "dtoOperation",
1714
1718
  "trace"
1715
1719
  ]) delete chainDto[field];
1716
1720
  return chainDto;
@@ -1720,13 +1724,15 @@ function toChainDto(message) {
1720
1724
  * `{ callerPublicKey, method, dto: <inner DTO object>, uniqueKey, signature }`. The inner DTO
1721
1725
  * travels unsigned and as an object; no `signerPublicKey` is sent because the signature already
1722
1726
  * recovers it (the gateway rejects it as REDUNDANT_SIGNER_PUBLIC_KEY). The wrapper carries its own
1723
- * `uniqueKey`, distinct from the DTO's.
1727
+ * `uniqueKey`, distinct from the DTO's, and its own `dtoOperation` (`<Contract>:DryRun`); the inner DTO
1728
+ * carries none of the signing envelope or the `dtoOperation` of the call it simulates (see
1729
+ * {@link toChainDto}), whatever the caller passes, so a signed DTO can be handed in as is.
1724
1730
  */
1725
1731
  function buildDryRunWrapper(signer, callerPublicKey, method, dto, uniqueKeyPrefix = DRY_RUN_UNIQUE_KEY_PREFIX, contractPath = "asset/dexv3-contract") {
1726
1732
  return signPreSend(signer, contractPath, DRY_RUN_METHOD, {
1727
1733
  callerPublicKey,
1728
1734
  method,
1729
- dto,
1735
+ dto: toChainDto(dto),
1730
1736
  uniqueKey: createUniqueKey(uniqueKeyPrefix)
1731
1737
  });
1732
1738
  }