@symmio/trading-core 1.0.0 → 1.1.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.
Files changed (72) hide show
  1. package/dist/core/config/create-config.d.ts +14 -4
  2. package/dist/core/config/create-config.d.ts.map +1 -1
  3. package/dist/core/config/create-config.js +22 -26
  4. package/dist/core/config/create-config.js.map +1 -1
  5. package/dist/index.d.ts +1 -1
  6. package/dist/index.d.ts.map +1 -1
  7. package/dist/index.js +279 -267
  8. package/dist/solvers/instant-close/instant-close-auto/instant-close-auto.d.ts +1 -1
  9. package/dist/solvers/instant-close/instant-close-auto/instant-close-auto.js.map +1 -1
  10. package/dist/solvers/instant-close/instant-close-bulk-auto/instant-close-bulk-auto.d.ts +2 -2
  11. package/dist/solvers/instant-close/instant-close-bulk-auto/instant-close-bulk-auto.js.map +1 -1
  12. package/dist/symmio-contracts/account-layer/actions/cancel-registration.d.ts +38 -0
  13. package/dist/symmio-contracts/account-layer/actions/cancel-registration.d.ts.map +1 -0
  14. package/dist/symmio-contracts/account-layer/actions/cancel-registration.js +26 -0
  15. package/dist/symmio-contracts/account-layer/actions/cancel-registration.js.map +1 -0
  16. package/dist/symmio-contracts/account-layer/actions/deposit-and-allocate-for-account.d.ts +4 -3
  17. package/dist/symmio-contracts/account-layer/actions/deposit-and-allocate-for-account.d.ts.map +1 -1
  18. package/dist/symmio-contracts/account-layer/actions/deposit-and-allocate-for-account.js.map +1 -1
  19. package/dist/symmio-contracts/account-layer/actions/deposit-for-account.d.ts +4 -3
  20. package/dist/symmio-contracts/account-layer/actions/deposit-for-account.d.ts.map +1 -1
  21. package/dist/symmio-contracts/account-layer/actions/deposit-for-account.js.map +1 -1
  22. package/dist/symmio-contracts/account-layer/actions/generate-account-manager-address.d.ts +39 -0
  23. package/dist/symmio-contracts/account-layer/actions/generate-account-manager-address.d.ts.map +1 -0
  24. package/dist/symmio-contracts/account-layer/actions/generate-account-manager-address.js +15 -0
  25. package/dist/symmio-contracts/account-layer/actions/generate-account-manager-address.js.map +1 -0
  26. package/dist/symmio-contracts/account-layer/actions/get-affiliate-state.d.ts +35 -0
  27. package/dist/symmio-contracts/account-layer/actions/get-affiliate-state.d.ts.map +1 -0
  28. package/dist/symmio-contracts/account-layer/actions/get-affiliate-state.js +15 -0
  29. package/dist/symmio-contracts/account-layer/actions/get-affiliate-state.js.map +1 -0
  30. package/dist/symmio-contracts/account-layer/actions/request-to-register-affiliate.d.ts +56 -0
  31. package/dist/symmio-contracts/account-layer/actions/request-to-register-affiliate.d.ts.map +1 -0
  32. package/dist/symmio-contracts/account-layer/actions/request-to-register-affiliate.js +26 -0
  33. package/dist/symmio-contracts/account-layer/actions/request-to-register-affiliate.js.map +1 -0
  34. package/dist/symmio-contracts/account-layer/actions/simulate-cancel-registration.d.ts +31 -0
  35. package/dist/symmio-contracts/account-layer/actions/simulate-cancel-registration.d.ts.map +1 -0
  36. package/dist/symmio-contracts/account-layer/actions/simulate-cancel-registration.js +16 -0
  37. package/dist/symmio-contracts/account-layer/actions/simulate-cancel-registration.js.map +1 -0
  38. package/dist/symmio-contracts/account-layer/actions/simulate-request-to-register-affiliate.d.ts +33 -0
  39. package/dist/symmio-contracts/account-layer/actions/simulate-request-to-register-affiliate.d.ts.map +1 -0
  40. package/dist/symmio-contracts/account-layer/actions/simulate-request-to-register-affiliate.js +16 -0
  41. package/dist/symmio-contracts/account-layer/actions/simulate-request-to-register-affiliate.js.map +1 -0
  42. package/dist/symmio-contracts/account-layer/index.d.ts +12 -0
  43. package/dist/symmio-contracts/account-layer/index.d.ts.map +1 -1
  44. package/dist/symmio-contracts/account-layer/query/cancel-registration.d.ts +22 -0
  45. package/dist/symmio-contracts/account-layer/query/cancel-registration.d.ts.map +1 -0
  46. package/dist/symmio-contracts/account-layer/query/cancel-registration.js +12 -0
  47. package/dist/symmio-contracts/account-layer/query/cancel-registration.js.map +1 -0
  48. package/dist/symmio-contracts/account-layer/query/generate-account-manager-address.d.ts +39 -0
  49. package/dist/symmio-contracts/account-layer/query/generate-account-manager-address.d.ts.map +1 -0
  50. package/dist/symmio-contracts/account-layer/query/generate-account-manager-address.js +30 -0
  51. package/dist/symmio-contracts/account-layer/query/generate-account-manager-address.js.map +1 -0
  52. package/dist/symmio-contracts/account-layer/query/get-affiliate-state.d.ts +38 -0
  53. package/dist/symmio-contracts/account-layer/query/get-affiliate-state.d.ts.map +1 -0
  54. package/dist/symmio-contracts/account-layer/query/get-affiliate-state.js +29 -0
  55. package/dist/symmio-contracts/account-layer/query/get-affiliate-state.js.map +1 -0
  56. package/dist/symmio-contracts/account-layer/query/request-to-register-affiliate.d.ts +22 -0
  57. package/dist/symmio-contracts/account-layer/query/request-to-register-affiliate.d.ts.map +1 -0
  58. package/dist/symmio-contracts/account-layer/query/request-to-register-affiliate.js +12 -0
  59. package/dist/symmio-contracts/account-layer/query/request-to-register-affiliate.js.map +1 -0
  60. package/dist/symmio-contracts/account-layer/query/simulate-cancel-registration.d.ts +19 -0
  61. package/dist/symmio-contracts/account-layer/query/simulate-cancel-registration.d.ts.map +1 -0
  62. package/dist/symmio-contracts/account-layer/query/simulate-cancel-registration.js +12 -0
  63. package/dist/symmio-contracts/account-layer/query/simulate-cancel-registration.js.map +1 -0
  64. package/dist/symmio-contracts/account-layer/query/simulate-request-to-register-affiliate.d.ts +19 -0
  65. package/dist/symmio-contracts/account-layer/query/simulate-request-to-register-affiliate.d.ts.map +1 -0
  66. package/dist/symmio-contracts/account-layer/query/simulate-request-to-register-affiliate.js +12 -0
  67. package/dist/symmio-contracts/account-layer/query/simulate-request-to-register-affiliate.js.map +1 -0
  68. package/dist/symmio-contracts/account-layer/types.d.ts +68 -0
  69. package/dist/symmio-contracts/account-layer/types.d.ts.map +1 -1
  70. package/dist/symmio-contracts/account-layer/types.js +3 -1
  71. package/dist/symmio-contracts/account-layer/types.js.map +1 -1
  72. package/package.json +1 -1
@@ -18,7 +18,7 @@ import { InstantCloseReturnType } from '../shared/types.js';
18
18
  * positionType: PositionType.LONG,
19
19
  * quoteId: 42n,
20
20
  * quantityToClose: "0.5",
21
- * slippage: 1,
21
+ * slippage: 5, // percent — source from the user; hardcode ≥5% (1% often fails to fill)
22
22
  * });
23
23
  * ```
24
24
  */
@@ -1 +1 @@
1
- {"version":3,"file":"instant-close-auto.js","names":[],"sources":["../../../../src/solvers/instant-close/instant-close-auto/instant-close-auto.ts"],"sourcesContent":["import type { Config } from \"../../../core/config\";\nimport { instantClose } from \"../instant-close/instant-close\";\nimport {\n prepareInstantCloseParams,\n type PrepareInstantCloseParameters,\n} from \"../prepare-instant-close-params/prepare-instant-close-params\";\nimport type { InstantCloseReturnType } from \"../shared/types\";\n\n/**\n * Resolve missing inputs via {@link prepareInstantCloseParams} and immediately\n * submit through {@link instantClose}.\n *\n * Friendly default for callers that have the close intent and trust the SDK\n * to fetch the rest. For full control — inspect / mutate resolved params\n * between fetch and submit — call `prepareInstantCloseParams` + `instantClose`\n * separately.\n *\n * @example\n * ```ts\n * await instantCloseAuto(config, {\n * partyA,\n * market: { id: 1 },\n * positionType: PositionType.LONG,\n * quoteId: 42n,\n * quantityToClose: \"0.5\",\n * slippage: 1,\n * });\n * ```\n */\nexport async function instantCloseAuto(\n config: Config,\n parameters: PrepareInstantCloseParameters,\n): Promise<InstantCloseReturnType> {\n const resolved = await prepareInstantCloseParams(config, parameters);\n return instantClose(config, resolved);\n}\n"],"mappings":";;;AA6BA,eAAsB,EACpB,GACA,GACiC;CAEjC,OAAO,EAAa,GAAQ,MADL,EAA0B,GAAQ,CAAU,CAC/B;AACtC"}
1
+ {"version":3,"file":"instant-close-auto.js","names":[],"sources":["../../../../src/solvers/instant-close/instant-close-auto/instant-close-auto.ts"],"sourcesContent":["import type { Config } from \"../../../core/config\";\nimport { instantClose } from \"../instant-close/instant-close\";\nimport {\n prepareInstantCloseParams,\n type PrepareInstantCloseParameters,\n} from \"../prepare-instant-close-params/prepare-instant-close-params\";\nimport type { InstantCloseReturnType } from \"../shared/types\";\n\n/**\n * Resolve missing inputs via {@link prepareInstantCloseParams} and immediately\n * submit through {@link instantClose}.\n *\n * Friendly default for callers that have the close intent and trust the SDK\n * to fetch the rest. For full control — inspect / mutate resolved params\n * between fetch and submit — call `prepareInstantCloseParams` + `instantClose`\n * separately.\n *\n * @example\n * ```ts\n * await instantCloseAuto(config, {\n * partyA,\n * market: { id: 1 },\n * positionType: PositionType.LONG,\n * quoteId: 42n,\n * quantityToClose: \"0.5\",\n * slippage: 5, // percent — source from the user; hardcode ≥5% (1% often fails to fill)\n * });\n * ```\n */\nexport async function instantCloseAuto(\n config: Config,\n parameters: PrepareInstantCloseParameters,\n): Promise<InstantCloseReturnType> {\n const resolved = await prepareInstantCloseParams(config, parameters);\n return instantClose(config, resolved);\n}\n"],"mappings":";;;AA6BA,eAAsB,EACpB,GACA,GACiC;CAEjC,OAAO,EAAa,GAAQ,MADL,EAA0B,GAAQ,CAAU,CAC/B;AACtC"}
@@ -49,8 +49,8 @@ export type InstantCloseBulkAutoParameters = Compute<WriteSolverParameter & {
49
49
  * await instantCloseBulkAuto(config, {
50
50
  * from: sessionKey,
51
51
  * orders: [
52
- * { partyA: vaA, market: { id: 1 }, positionType: PositionType.LONG, quoteId: 1n, quantityToClose: "0.5", slippage: 1 },
53
- * { partyA: vaB, market: { id: 2 }, positionType: PositionType.SHORT, quoteId: 2n, quantityToClose: "1.0", slippage: 1 },
52
+ * { partyA: vaA, market: { id: 1 }, positionType: PositionType.LONG, quoteId: 1n, quantityToClose: "0.5", slippage: 5 },
53
+ * { partyA: vaB, market: { id: 2 }, positionType: PositionType.SHORT, quoteId: 2n, quantityToClose: "1.0", slippage: 5 },
54
54
  * ],
55
55
  * });
56
56
  * ```
@@ -1 +1 @@
1
- {"version":3,"file":"instant-close-bulk-auto.js","names":[],"sources":["../../../../src/solvers/instant-close/instant-close-bulk-auto/instant-close-bulk-auto.ts"],"sourcesContent":["import type { Address, Hex } from \"viem\";\nimport type { Config } from \"../../../core/config\";\nimport type { Compute, WriteSolverParameter } from \"../../../shared/types/properties\";\nimport {\n instantCloseBulk,\n type InstantCloseBulkOrder,\n type InstantCloseBulkReturnType,\n} from \"../instant-close-bulk/instant-close-bulk\";\nimport { prepareInstantCloseParams } from \"../prepare-instant-close-params/prepare-instant-close-params\";\nimport { type InstantCloseMarketData, type PositionType } from \"../shared/types\";\n\n/**\n * One UI-shape close intent inside an {@link instantCloseBulkAuto} batch. Each\n * entry mirrors `prepareInstantCloseParams` minus the per-call `from`/`chainId`\n * — those are hoisted to the batch parameters because the whole batch shares\n * one signer and chain.\n */\nexport interface InstantCloseBulkAutoOrder {\n /** PartyA — the VA that owns the position. */\n partyA: Address;\n /** Market identification + optional pre-fetched precision metadata. */\n market: InstantCloseMarketData;\n /** Side of the position being closed. */\n positionType: PositionType;\n /** Quote id of the position. */\n quoteId: bigint;\n /** Quantity to close as decimal string (base-token units). */\n quantityToClose: string;\n /** Slippage tolerance percent (e.g. `5` for 5%). */\n slippage: number;\n /** Pre-fetched mark price as decimal string. */\n markPrice?: string;\n /** Override the EIP-712 salt for this order. */\n salt?: Hex;\n /** Override the unix-seconds deadline for this order. */\n deadline?: bigint;\n}\n\n/**\n * Parameters for {@link instantCloseBulkAuto}.\n */\nexport type InstantCloseBulkAutoParameters = Compute<\n WriteSolverParameter & {\n orders: readonly InstantCloseBulkAutoOrder[];\n }\n>;\n\n/**\n * Resolve every order's missing wei fields via\n * `prepareInstantCloseParams` (parallel) and submit them in one\n * `instantCloseBulk` round-trip.\n *\n * Friendly default for callers that have a list of close intents and trust the\n * SDK to fetch market/price metadata. For full control, call\n * `prepareInstantCloseParams` per order + `instantCloseBulk` directly.\n *\n * @example\n * ```ts\n * await instantCloseBulkAuto(config, {\n * from: sessionKey,\n * orders: [\n * { partyA: vaA, market: { id: 1 }, positionType: PositionType.LONG, quoteId: 1n, quantityToClose: \"0.5\", slippage: 1 },\n * { partyA: vaB, market: { id: 2 }, positionType: PositionType.SHORT, quoteId: 2n, quantityToClose: \"1.0\", slippage: 1 },\n * ],\n * });\n * ```\n */\nexport async function instantCloseBulkAuto(\n config: Config,\n parameters: InstantCloseBulkAutoParameters,\n): Promise<InstantCloseBulkReturnType> {\n const resolved = await Promise.all(\n parameters.orders.map(async (intent): Promise<InstantCloseBulkOrder> => {\n const prepared = await prepareInstantCloseParams(config, {\n chainId: parameters.chainId,\n from: parameters.from,\n partyA: intent.partyA,\n market: intent.market,\n positionType: intent.positionType,\n quoteId: intent.quoteId,\n quantityToClose: intent.quantityToClose,\n slippage: intent.slippage,\n markPrice: intent.markPrice,\n salt: intent.salt,\n deadline: intent.deadline,\n });\n return {\n partyA: prepared.partyA,\n order: prepared.order,\n salt: prepared.salt,\n deadline: prepared.deadline,\n };\n }),\n );\n\n return instantCloseBulk(config, {\n chainId: parameters.chainId,\n from: parameters.from,\n orders: resolved,\n });\n}\n"],"mappings":";;;AAmEA,eAAsB,EACpB,GACA,GACqC;CACrC,IAAM,IAAW,MAAM,QAAQ,IAC7B,EAAW,OAAO,IAAI,OAAO,MAA2C;EACtE,IAAM,IAAW,MAAM,EAA0B,GAAQ;GACvD,SAAS,EAAW;GACpB,MAAM,EAAW;GACjB,QAAQ,EAAO;GACf,QAAQ,EAAO;GACf,cAAc,EAAO;GACrB,SAAS,EAAO;GAChB,iBAAiB,EAAO;GACxB,UAAU,EAAO;GACjB,WAAW,EAAO;GAClB,MAAM,EAAO;GACb,UAAU,EAAO;EACnB,CAAC;EACD,OAAO;GACL,QAAQ,EAAS;GACjB,OAAO,EAAS;GAChB,MAAM,EAAS;GACf,UAAU,EAAS;EACrB;CACF,CAAC,CACH;CAEA,OAAO,EAAiB,GAAQ;EAC9B,SAAS,EAAW;EACpB,MAAM,EAAW;EACjB,QAAQ;CACV,CAAC;AACH"}
1
+ {"version":3,"file":"instant-close-bulk-auto.js","names":[],"sources":["../../../../src/solvers/instant-close/instant-close-bulk-auto/instant-close-bulk-auto.ts"],"sourcesContent":["import type { Address, Hex } from \"viem\";\nimport type { Config } from \"../../../core/config\";\nimport type { Compute, WriteSolverParameter } from \"../../../shared/types/properties\";\nimport {\n instantCloseBulk,\n type InstantCloseBulkOrder,\n type InstantCloseBulkReturnType,\n} from \"../instant-close-bulk/instant-close-bulk\";\nimport { prepareInstantCloseParams } from \"../prepare-instant-close-params/prepare-instant-close-params\";\nimport { type InstantCloseMarketData, type PositionType } from \"../shared/types\";\n\n/**\n * One UI-shape close intent inside an {@link instantCloseBulkAuto} batch. Each\n * entry mirrors `prepareInstantCloseParams` minus the per-call `from`/`chainId`\n * — those are hoisted to the batch parameters because the whole batch shares\n * one signer and chain.\n */\nexport interface InstantCloseBulkAutoOrder {\n /** PartyA — the VA that owns the position. */\n partyA: Address;\n /** Market identification + optional pre-fetched precision metadata. */\n market: InstantCloseMarketData;\n /** Side of the position being closed. */\n positionType: PositionType;\n /** Quote id of the position. */\n quoteId: bigint;\n /** Quantity to close as decimal string (base-token units). */\n quantityToClose: string;\n /** Slippage tolerance percent (e.g. `5` for 5%). */\n slippage: number;\n /** Pre-fetched mark price as decimal string. */\n markPrice?: string;\n /** Override the EIP-712 salt for this order. */\n salt?: Hex;\n /** Override the unix-seconds deadline for this order. */\n deadline?: bigint;\n}\n\n/**\n * Parameters for {@link instantCloseBulkAuto}.\n */\nexport type InstantCloseBulkAutoParameters = Compute<\n WriteSolverParameter & {\n orders: readonly InstantCloseBulkAutoOrder[];\n }\n>;\n\n/**\n * Resolve every order's missing wei fields via\n * `prepareInstantCloseParams` (parallel) and submit them in one\n * `instantCloseBulk` round-trip.\n *\n * Friendly default for callers that have a list of close intents and trust the\n * SDK to fetch market/price metadata. For full control, call\n * `prepareInstantCloseParams` per order + `instantCloseBulk` directly.\n *\n * @example\n * ```ts\n * await instantCloseBulkAuto(config, {\n * from: sessionKey,\n * orders: [\n * { partyA: vaA, market: { id: 1 }, positionType: PositionType.LONG, quoteId: 1n, quantityToClose: \"0.5\", slippage: 5 },\n * { partyA: vaB, market: { id: 2 }, positionType: PositionType.SHORT, quoteId: 2n, quantityToClose: \"1.0\", slippage: 5 },\n * ],\n * });\n * ```\n */\nexport async function instantCloseBulkAuto(\n config: Config,\n parameters: InstantCloseBulkAutoParameters,\n): Promise<InstantCloseBulkReturnType> {\n const resolved = await Promise.all(\n parameters.orders.map(async (intent): Promise<InstantCloseBulkOrder> => {\n const prepared = await prepareInstantCloseParams(config, {\n chainId: parameters.chainId,\n from: parameters.from,\n partyA: intent.partyA,\n market: intent.market,\n positionType: intent.positionType,\n quoteId: intent.quoteId,\n quantityToClose: intent.quantityToClose,\n slippage: intent.slippage,\n markPrice: intent.markPrice,\n salt: intent.salt,\n deadline: intent.deadline,\n });\n return {\n partyA: prepared.partyA,\n order: prepared.order,\n salt: prepared.salt,\n deadline: prepared.deadline,\n };\n }),\n );\n\n return instantCloseBulk(config, {\n chainId: parameters.chainId,\n from: parameters.from,\n orders: resolved,\n });\n}\n"],"mappings":";;;AAmEA,eAAsB,EACpB,GACA,GACqC;CACrC,IAAM,IAAW,MAAM,QAAQ,IAC7B,EAAW,OAAO,IAAI,OAAO,MAA2C;EACtE,IAAM,IAAW,MAAM,EAA0B,GAAQ;GACvD,SAAS,EAAW;GACpB,MAAM,EAAW;GACjB,QAAQ,EAAO;GACf,QAAQ,EAAO;GACf,cAAc,EAAO;GACrB,SAAS,EAAO;GAChB,iBAAiB,EAAO;GACxB,UAAU,EAAO;GACjB,WAAW,EAAO;GAClB,MAAM,EAAO;GACb,UAAU,EAAO;EACnB,CAAC;EACD,OAAO;GACL,QAAQ,EAAS;GACjB,OAAO,EAAS;GAChB,MAAM,EAAS;GACf,UAAU,EAAS;EACrB;CACF,CAAC,CACH;CAEA,OAAO,EAAiB,GAAQ;EAC9B,SAAS,EAAW;EACpB,MAAM,EAAW;EACjB,QAAQ;CACV,CAAC;AACH"}
@@ -0,0 +1,38 @@
1
+ import { Address, Hash } from 'viem';
2
+ import { Config } from '../../../core/config/index.js';
3
+ import { Compute, WriteContractParameter } from '../../../shared/types/properties.js';
4
+ /**
5
+ * Parameters for {@link cancelRegistration}.
6
+ */
7
+ export type CancelRegistrationParameters = Compute<WriteContractParameter & {
8
+ /**
9
+ * The pending affiliate (AccountManager) address to cancel. The bound wallet
10
+ * must be that affiliate's registered `admin`; the contract reverts otherwise.
11
+ */
12
+ affiliate: Address;
13
+ }>;
14
+ /** Return type of {@link cancelRegistration}: the submitted transaction hash. */
15
+ export type CancelRegistrationReturnType = Hash;
16
+ /**
17
+ * Send the on-chain transaction that cancels a still-`PENDING` affiliate
18
+ * registration, clearing it back to `NONE`.
19
+ *
20
+ * Resolves the bound wallet client and `AccountLayer` address from `config`. The
21
+ * bound EOA must be the affiliate's registered `admin`.
22
+ *
23
+ * Dry-runs the call with {@link simulateCancelRegistration} first unless
24
+ * `simulateBeforeWrite` is `false` (per-call, falling back to the config default).
25
+ *
26
+ * @param config - The SDK config (must have a `getWalletClient` resolver).
27
+ * @param parameters - Affiliate address, optional chain id / simulate opt-out.
28
+ * @returns The submitted transaction hash. The caller waits on the receipt.
29
+ * @throws {SymmError} when the chain is unsupported or no wallet is available.
30
+ * @throws Viem's write errors (`ContractFunctionExecutionError`, ...).
31
+ *
32
+ * @example
33
+ * ```ts
34
+ * const hash = await cancelRegistration(config, { affiliate: "0xaff…" });
35
+ * ```
36
+ */
37
+ export declare function cancelRegistration(config: Config, parameters: CancelRegistrationParameters): Promise<CancelRegistrationReturnType>;
38
+ //# sourceMappingURL=cancel-registration.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cancel-registration.d.ts","sourceRoot":"","sources":["../../../../src/symmio-contracts/account-layer/actions/cancel-registration.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC1C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,KAAK,EAAE,OAAO,EAAE,sBAAsB,EAAE,MAAM,kCAAkC,CAAC;AAKxF;;GAEG;AACH,MAAM,MAAM,4BAA4B,GAAG,OAAO,CAChD,sBAAsB,GAAG;IACvB;;;OAGG;IACH,SAAS,EAAE,OAAO,CAAC;CACpB,CACF,CAAC;AAEF,iFAAiF;AACjF,MAAM,MAAM,4BAA4B,GAAG,IAAI,CAAC;AAEhD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAsB,kBAAkB,CACtC,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,4BAA4B,GACvC,OAAO,CAAC,4BAA4B,CAAC,CAkBvC"}
@@ -0,0 +1,26 @@
1
+ import { accountLayerAbi as e } from "../../abi/v0.8.5/account-layer.js";
2
+ import { shouldSimulateBeforeWrite as t } from "../../../shared/utils/simulate-before-write.js";
3
+ import { simulateCancelRegistration as n } from "./simulate-cancel-registration.js";
4
+ //#region src/symmio-contracts/account-layer/actions/cancel-registration.ts
5
+ async function r(r, i) {
6
+ let { chainId: a, affiliate: o, from: s } = i, { addresses: c } = r.getChainConfig(a), l = await r.getWalletClient({
7
+ chainId: a,
8
+ from: s
9
+ });
10
+ return t(r, i) && await n(r, {
11
+ chainId: a,
12
+ affiliate: o,
13
+ from: l.account.address
14
+ }), l.writeContract({
15
+ address: c.accountLayerAddress,
16
+ abi: e,
17
+ functionName: "cancelRegistration",
18
+ args: [o],
19
+ account: l.account,
20
+ chain: l.chain
21
+ });
22
+ }
23
+ //#endregion
24
+ export { r as cancelRegistration };
25
+
26
+ //# sourceMappingURL=cancel-registration.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cancel-registration.js","names":[],"sources":["../../../../src/symmio-contracts/account-layer/actions/cancel-registration.ts"],"sourcesContent":["import type { Address, Hash } from \"viem\";\nimport type { Config } from \"../../../core/config\";\nimport type { Compute, WriteContractParameter } from \"../../../shared/types/properties\";\nimport { shouldSimulateBeforeWrite } from \"../../../shared/utils/simulate-before-write\";\nimport { accountLayerAbi } from \"../../abi/v0.8.5/account-layer\";\nimport { simulateCancelRegistration } from \"./simulate-cancel-registration\";\n\n/**\n * Parameters for {@link cancelRegistration}.\n */\nexport type CancelRegistrationParameters = Compute<\n WriteContractParameter & {\n /**\n * The pending affiliate (AccountManager) address to cancel. The bound wallet\n * must be that affiliate's registered `admin`; the contract reverts otherwise.\n */\n affiliate: Address;\n }\n>;\n\n/** Return type of {@link cancelRegistration}: the submitted transaction hash. */\nexport type CancelRegistrationReturnType = Hash;\n\n/**\n * Send the on-chain transaction that cancels a still-`PENDING` affiliate\n * registration, clearing it back to `NONE`.\n *\n * Resolves the bound wallet client and `AccountLayer` address from `config`. The\n * bound EOA must be the affiliate's registered `admin`.\n *\n * Dry-runs the call with {@link simulateCancelRegistration} first unless\n * `simulateBeforeWrite` is `false` (per-call, falling back to the config default).\n *\n * @param config - The SDK config (must have a `getWalletClient` resolver).\n * @param parameters - Affiliate address, optional chain id / simulate opt-out.\n * @returns The submitted transaction hash. The caller waits on the receipt.\n * @throws {SymmError} when the chain is unsupported or no wallet is available.\n * @throws Viem's write errors (`ContractFunctionExecutionError`, ...).\n *\n * @example\n * ```ts\n * const hash = await cancelRegistration(config, { affiliate: \"0xaff…\" });\n * ```\n */\nexport async function cancelRegistration(\n config: Config,\n parameters: CancelRegistrationParameters,\n): Promise<CancelRegistrationReturnType> {\n const { chainId, affiliate, from } = parameters;\n\n const { addresses } = config.getChainConfig(chainId);\n const walletClient = await config.getWalletClient({ chainId, from });\n\n if (shouldSimulateBeforeWrite(config, parameters)) {\n await simulateCancelRegistration(config, { chainId, affiliate, from: walletClient.account.address });\n }\n\n return walletClient.writeContract({\n address: addresses.accountLayerAddress,\n abi: accountLayerAbi,\n functionName: \"cancelRegistration\",\n args: [affiliate],\n account: walletClient.account,\n chain: walletClient.chain,\n });\n}\n"],"mappings":";;;;AA4CA,eAAsB,EACpB,GACA,GACuC;CACvC,IAAM,EAAE,YAAS,cAAW,YAAS,GAE/B,EAAE,iBAAc,EAAO,eAAe,CAAO,GAC7C,IAAe,MAAM,EAAO,gBAAgB;EAAE;EAAS;CAAK,CAAC;CAMnE,OAJI,EAA0B,GAAQ,CAAU,KAC9C,MAAM,EAA2B,GAAQ;EAAE;EAAS;EAAW,MAAM,EAAa,QAAQ;CAAQ,CAAC,GAG9F,EAAa,cAAc;EAChC,SAAS,EAAU;EACnB,KAAK;EACL,cAAc;EACd,MAAM,CAAC,CAAS;EAChB,SAAS,EAAa;EACtB,OAAO,EAAa;CACtB,CAAC;AACH"}
@@ -26,9 +26,10 @@ export type DepositAndAllocateForAccountReturnType = Hash;
26
26
  * a single transaction.
27
27
  *
28
28
  * Calls `AccountLayer.depositAndAllocateForAccount`. Equivalent to
29
- * {@link depositForAccount} followed by an allocate, but atomic: the deposited
30
- * funds become usable margin immediately instead of sitting in the available
31
- * balance.
29
+ * {@link depositForAccount} followed by an allocate, but atomic. The funds land
30
+ * in the classic-pool allocated balance — instant trading spends the available
31
+ * balance instead, so for the instant flow fund with {@link depositForAccount}
32
+ * alone (funds allocated here are not what an instant open consumes).
32
33
  *
33
34
  * Dry-runs the call with {@link simulateDepositAndAllocateForAccount} first unless
34
35
  * `simulateBeforeWrite` is `false` (per-call, falling back to the config default).
@@ -1 +1 @@
1
- {"version":3,"file":"deposit-and-allocate-for-account.d.ts","sourceRoot":"","sources":["../../../../src/symmio-contracts/account-layer/actions/deposit-and-allocate-for-account.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC1C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,KAAK,EAAE,OAAO,EAAE,sBAAsB,EAAE,MAAM,kCAAkC,CAAC;AAKxF;;GAEG;AACH,MAAM,MAAM,sCAAsC,GAAG,OAAO,CAC1D,sBAAsB,GAAG;IACvB;;;;OAIG;IACH,OAAO,EAAE,OAAO,CAAC;IACjB;;;;;OAKG;IACH,MAAM,EAAE,MAAM,CAAC;CAChB,CACF,CAAC;AAEF,2FAA2F;AAC3F,MAAM,MAAM,sCAAsC,GAAG,IAAI,CAAC;AAE1D;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAsB,4BAA4B,CAChD,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,sCAAsC,GACjD,OAAO,CAAC,sCAAsC,CAAC,CAuBjD"}
1
+ {"version":3,"file":"deposit-and-allocate-for-account.d.ts","sourceRoot":"","sources":["../../../../src/symmio-contracts/account-layer/actions/deposit-and-allocate-for-account.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC1C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,KAAK,EAAE,OAAO,EAAE,sBAAsB,EAAE,MAAM,kCAAkC,CAAC;AAKxF;;GAEG;AACH,MAAM,MAAM,sCAAsC,GAAG,OAAO,CAC1D,sBAAsB,GAAG;IACvB;;;;OAIG;IACH,OAAO,EAAE,OAAO,CAAC;IACjB;;;;;OAKG;IACH,MAAM,EAAE,MAAM,CAAC;CAChB,CACF,CAAC;AAEF,2FAA2F;AAC3F,MAAM,MAAM,sCAAsC,GAAG,IAAI,CAAC;AAE1D;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAsB,4BAA4B,CAChD,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,sCAAsC,GACjD,OAAO,CAAC,sCAAsC,CAAC,CAuBjD"}
@@ -1 +1 @@
1
- {"version":3,"file":"deposit-and-allocate-for-account.js","names":[],"sources":["../../../../src/symmio-contracts/account-layer/actions/deposit-and-allocate-for-account.ts"],"sourcesContent":["import type { Address, Hash } from \"viem\";\nimport type { Config } from \"../../../core/config\";\nimport type { Compute, WriteContractParameter } from \"../../../shared/types/properties\";\nimport { shouldSimulateBeforeWrite } from \"../../../shared/utils/simulate-before-write\";\nimport { accountLayerAbi } from \"../../abi/v0.8.5/account-layer\";\nimport { simulateDepositAndAllocateForAccount } from \"./simulate-deposit-and-allocate-for-account\";\n\n/**\n * Parameters for {@link depositAndAllocateForAccount}.\n */\nexport type DepositAndAllocateForAccountParameters = Compute<\n WriteContractParameter & {\n /**\n * The subaccount (or virtual account) to credit and allocate for. The wallet's\n * signing account must be the subaccount's on-chain `owner`; the contract\n * reverts otherwise.\n */\n account: Address;\n /**\n * Amount of collateral to deposit and allocate, in the collateral token's\n * smallest unit (e.g. `1_000000n` for 1 USDC at 6 decimals). The user must have\n * approved at least this much collateral to the SYMMIO core first — see\n * {@link approveCollateral}.\n */\n amount: bigint;\n }\n>;\n\n/** Return type of {@link depositAndAllocateForAccount}: the submitted transaction hash. */\nexport type DepositAndAllocateForAccountReturnType = Hash;\n\n/**\n * Deposit collateral into a subaccount **and allocate it into trading margin** in\n * a single transaction.\n *\n * Calls `AccountLayer.depositAndAllocateForAccount`. Equivalent to\n * {@link depositForAccount} followed by an allocate, but atomic: the deposited\n * funds become usable margin immediately instead of sitting in the available\n * balance.\n *\n * Dry-runs the call with {@link simulateDepositAndAllocateForAccount} first unless\n * `simulateBeforeWrite` is `false` (per-call, falling back to the config default).\n *\n * @remarks\n * Requires a prior ERC20 approval of the collateral token to the **SYMMIO core**\n * (`symmioAddress`), which is the contract that pulls the funds. See\n * {@link approveCollateral} / {@link getCollateralAllowance}.\n *\n * @param config - The SDK config (must have a `getWalletClient` resolver).\n * @param parameters - Subaccount address, amount (collateral units), optional chain id.\n * @returns The submitted transaction hash. The caller waits on the receipt.\n * @throws {SymmError} when the chain is unsupported or no wallet is available.\n * @throws Viem's write errors (`ContractFunctionExecutionError`, ...).\n *\n * @example\n * ```ts\n * const hash = await depositAndAllocateForAccount(config, { account: \"0xsub…\", amount: 1_000000n });\n * ```\n */\nexport async function depositAndAllocateForAccount(\n config: Config,\n parameters: DepositAndAllocateForAccountParameters,\n): Promise<DepositAndAllocateForAccountReturnType> {\n const { chainId, account, amount, from } = parameters;\n\n const { addresses } = config.getChainConfig(chainId);\n const walletClient = await config.getWalletClient({ chainId, from });\n\n if (shouldSimulateBeforeWrite(config, parameters)) {\n await simulateDepositAndAllocateForAccount(config, {\n chainId,\n account,\n amount,\n from: walletClient.account.address,\n });\n }\n\n return walletClient.writeContract({\n address: addresses.accountLayerAddress,\n abi: accountLayerAbi,\n functionName: \"depositAndAllocateForAccount\",\n args: [account, amount],\n account: walletClient.account,\n chain: walletClient.chain,\n });\n}\n"],"mappings":";;;;AA2DA,eAAsB,EACpB,GACA,GACiD;CACjD,IAAM,EAAE,YAAS,YAAS,WAAQ,YAAS,GAErC,EAAE,iBAAc,EAAO,eAAe,CAAO,GAC7C,IAAe,MAAM,EAAO,gBAAgB;EAAE;EAAS;CAAK,CAAC;CAWnE,OATI,EAA0B,GAAQ,CAAU,KAC9C,MAAM,EAAqC,GAAQ;EACjD;EACA;EACA;EACA,MAAM,EAAa,QAAQ;CAC7B,CAAC,GAGI,EAAa,cAAc;EAChC,SAAS,EAAU;EACnB,KAAK;EACL,cAAc;EACd,MAAM,CAAC,GAAS,CAAM;EACtB,SAAS,EAAa;EACtB,OAAO,EAAa;CACtB,CAAC;AACH"}
1
+ {"version":3,"file":"deposit-and-allocate-for-account.js","names":[],"sources":["../../../../src/symmio-contracts/account-layer/actions/deposit-and-allocate-for-account.ts"],"sourcesContent":["import type { Address, Hash } from \"viem\";\nimport type { Config } from \"../../../core/config\";\nimport type { Compute, WriteContractParameter } from \"../../../shared/types/properties\";\nimport { shouldSimulateBeforeWrite } from \"../../../shared/utils/simulate-before-write\";\nimport { accountLayerAbi } from \"../../abi/v0.8.5/account-layer\";\nimport { simulateDepositAndAllocateForAccount } from \"./simulate-deposit-and-allocate-for-account\";\n\n/**\n * Parameters for {@link depositAndAllocateForAccount}.\n */\nexport type DepositAndAllocateForAccountParameters = Compute<\n WriteContractParameter & {\n /**\n * The subaccount (or virtual account) to credit and allocate for. The wallet's\n * signing account must be the subaccount's on-chain `owner`; the contract\n * reverts otherwise.\n */\n account: Address;\n /**\n * Amount of collateral to deposit and allocate, in the collateral token's\n * smallest unit (e.g. `1_000000n` for 1 USDC at 6 decimals). The user must have\n * approved at least this much collateral to the SYMMIO core first — see\n * {@link approveCollateral}.\n */\n amount: bigint;\n }\n>;\n\n/** Return type of {@link depositAndAllocateForAccount}: the submitted transaction hash. */\nexport type DepositAndAllocateForAccountReturnType = Hash;\n\n/**\n * Deposit collateral into a subaccount **and allocate it into trading margin** in\n * a single transaction.\n *\n * Calls `AccountLayer.depositAndAllocateForAccount`. Equivalent to\n * {@link depositForAccount} followed by an allocate, but atomic. The funds land\n * in the classic-pool allocated balance — instant trading spends the available\n * balance instead, so for the instant flow fund with {@link depositForAccount}\n * alone (funds allocated here are not what an instant open consumes).\n *\n * Dry-runs the call with {@link simulateDepositAndAllocateForAccount} first unless\n * `simulateBeforeWrite` is `false` (per-call, falling back to the config default).\n *\n * @remarks\n * Requires a prior ERC20 approval of the collateral token to the **SYMMIO core**\n * (`symmioAddress`), which is the contract that pulls the funds. See\n * {@link approveCollateral} / {@link getCollateralAllowance}.\n *\n * @param config - The SDK config (must have a `getWalletClient` resolver).\n * @param parameters - Subaccount address, amount (collateral units), optional chain id.\n * @returns The submitted transaction hash. The caller waits on the receipt.\n * @throws {SymmError} when the chain is unsupported or no wallet is available.\n * @throws Viem's write errors (`ContractFunctionExecutionError`, ...).\n *\n * @example\n * ```ts\n * const hash = await depositAndAllocateForAccount(config, { account: \"0xsub…\", amount: 1_000000n });\n * ```\n */\nexport async function depositAndAllocateForAccount(\n config: Config,\n parameters: DepositAndAllocateForAccountParameters,\n): Promise<DepositAndAllocateForAccountReturnType> {\n const { chainId, account, amount, from } = parameters;\n\n const { addresses } = config.getChainConfig(chainId);\n const walletClient = await config.getWalletClient({ chainId, from });\n\n if (shouldSimulateBeforeWrite(config, parameters)) {\n await simulateDepositAndAllocateForAccount(config, {\n chainId,\n account,\n amount,\n from: walletClient.account.address,\n });\n }\n\n return walletClient.writeContract({\n address: addresses.accountLayerAddress,\n abi: accountLayerAbi,\n functionName: \"depositAndAllocateForAccount\",\n args: [account, amount],\n account: walletClient.account,\n chain: walletClient.chain,\n });\n}\n"],"mappings":";;;;AA4DA,eAAsB,EACpB,GACA,GACiD;CACjD,IAAM,EAAE,YAAS,YAAS,WAAQ,YAAS,GAErC,EAAE,iBAAc,EAAO,eAAe,CAAO,GAC7C,IAAe,MAAM,EAAO,gBAAgB;EAAE;EAAS;CAAK,CAAC;CAWnE,OATI,EAA0B,GAAQ,CAAU,KAC9C,MAAM,EAAqC,GAAQ;EACjD;EACA;EACA;EACA,MAAM,EAAa,QAAQ;CAC7B,CAAC,GAGI,EAAa,cAAc;EAChC,SAAS,EAAU;EACnB,KAAK;EACL,cAAc;EACd,MAAM,CAAC,GAAS,CAAM;EACtB,SAAS,EAAa;EACtB,OAAO,EAAa;CACtB,CAAC;AACH"}
@@ -23,9 +23,10 @@ export type DepositForAccountReturnType = Hash;
23
23
  * Deposit collateral into a subaccount's **available balance** on the SYMMIO core.
24
24
  *
25
25
  * Calls `AccountLayer.depositForAccount`, which pulls the collateral from the
26
- * connected wallet into the core and credits the subaccount. The funds land in
27
- * the available (withdrawable) balance, not in trading margin — use
28
- * {@link depositAndAllocateForAccount} to allocate in the same transaction.
26
+ * connected wallet into the core and credits the subaccount's available
27
+ * balance — the balance instant trading spends and withdrawals draw from, so
28
+ * for the instant flow this is the whole funding step (no allocate afterwards).
29
+ * Only the classic-pool flow allocates — see {@link depositAndAllocateForAccount}.
29
30
  *
30
31
  * Dry-runs the call with {@link simulateDepositForAccount} first unless
31
32
  * `simulateBeforeWrite` is `false` (per-call, falling back to the config default).
@@ -1 +1 @@
1
- {"version":3,"file":"deposit-for-account.d.ts","sourceRoot":"","sources":["../../../../src/symmio-contracts/account-layer/actions/deposit-for-account.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC1C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,KAAK,EAAE,OAAO,EAAE,sBAAsB,EAAE,MAAM,kCAAkC,CAAC;AAKxF;;GAEG;AACH,MAAM,MAAM,2BAA2B,GAAG,OAAO,CAC/C,sBAAsB,GAAG;IACvB;;;OAGG;IACH,OAAO,EAAE,OAAO,CAAC;IACjB;;;;OAIG;IACH,MAAM,EAAE,MAAM,CAAC;CAChB,CACF,CAAC;AAEF,gFAAgF;AAChF,MAAM,MAAM,2BAA2B,GAAG,IAAI,CAAC;AAE/C;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAsB,iBAAiB,CACrC,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,2BAA2B,GACtC,OAAO,CAAC,2BAA2B,CAAC,CAkBtC"}
1
+ {"version":3,"file":"deposit-for-account.d.ts","sourceRoot":"","sources":["../../../../src/symmio-contracts/account-layer/actions/deposit-for-account.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC1C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,KAAK,EAAE,OAAO,EAAE,sBAAsB,EAAE,MAAM,kCAAkC,CAAC;AAKxF;;GAEG;AACH,MAAM,MAAM,2BAA2B,GAAG,OAAO,CAC/C,sBAAsB,GAAG;IACvB;;;OAGG;IACH,OAAO,EAAE,OAAO,CAAC;IACjB;;;;OAIG;IACH,MAAM,EAAE,MAAM,CAAC;CAChB,CACF,CAAC;AAEF,gFAAgF;AAChF,MAAM,MAAM,2BAA2B,GAAG,IAAI,CAAC;AAE/C;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAsB,iBAAiB,CACrC,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,2BAA2B,GACtC,OAAO,CAAC,2BAA2B,CAAC,CAkBtC"}
@@ -1 +1 @@
1
- {"version":3,"file":"deposit-for-account.js","names":[],"sources":["../../../../src/symmio-contracts/account-layer/actions/deposit-for-account.ts"],"sourcesContent":["import type { Address, Hash } from \"viem\";\nimport type { Config } from \"../../../core/config\";\nimport type { Compute, WriteContractParameter } from \"../../../shared/types/properties\";\nimport { shouldSimulateBeforeWrite } from \"../../../shared/utils/simulate-before-write\";\nimport { accountLayerAbi } from \"../../abi/v0.8.5/account-layer\";\nimport { simulateDepositForAccount } from \"./simulate-deposit-for-account\";\n\n/**\n * Parameters for {@link depositForAccount}.\n */\nexport type DepositForAccountParameters = Compute<\n WriteContractParameter & {\n /**\n * The subaccount (or virtual account) to credit. The wallet's signing account\n * must be the subaccount's on-chain `owner`; the contract reverts otherwise.\n */\n account: Address;\n /**\n * Amount of collateral to deposit, in the collateral token's smallest unit\n * (e.g. `1_000000n` for 1 USDC at 6 decimals). The user must have approved at\n * least this much collateral to the SYMMIO core first — see {@link approveCollateral}.\n */\n amount: bigint;\n }\n>;\n\n/** Return type of {@link depositForAccount}: the submitted transaction hash. */\nexport type DepositForAccountReturnType = Hash;\n\n/**\n * Deposit collateral into a subaccount's **available balance** on the SYMMIO core.\n *\n * Calls `AccountLayer.depositForAccount`, which pulls the collateral from the\n * connected wallet into the core and credits the subaccount. The funds land in\n * the available (withdrawable) balance, not in trading margin — use\n * {@link depositAndAllocateForAccount} to allocate in the same transaction.\n *\n * Dry-runs the call with {@link simulateDepositForAccount} first unless\n * `simulateBeforeWrite` is `false` (per-call, falling back to the config default).\n *\n * @remarks\n * Requires a prior ERC20 approval of the collateral token to the **SYMMIO core**\n * (`symmioAddress`), which is the contract that pulls the funds. See\n * {@link approveCollateral} / {@link getCollateralAllowance}.\n *\n * @param config - The SDK config (must have a `getWalletClient` resolver).\n * @param parameters - Subaccount address, amount (collateral units), optional chain id.\n * @returns The submitted transaction hash. The caller waits on the receipt.\n * @throws {SymmError} when the chain is unsupported or no wallet is available.\n * @throws Viem's write errors (`ContractFunctionExecutionError`, ...).\n *\n * @example\n * ```ts\n * const hash = await depositForAccount(config, { account: \"0xsub…\", amount: 1_000000n });\n * ```\n */\nexport async function depositForAccount(\n config: Config,\n parameters: DepositForAccountParameters,\n): Promise<DepositForAccountReturnType> {\n const { chainId, account, amount, from } = parameters;\n\n const { addresses } = config.getChainConfig(chainId);\n const walletClient = await config.getWalletClient({ chainId, from });\n\n if (shouldSimulateBeforeWrite(config, parameters)) {\n await simulateDepositForAccount(config, { chainId, account, amount, from: walletClient.account.address });\n }\n\n return walletClient.writeContract({\n address: addresses.accountLayerAddress,\n abi: accountLayerAbi,\n functionName: \"depositForAccount\",\n args: [account, amount],\n account: walletClient.account,\n chain: walletClient.chain,\n });\n}\n"],"mappings":";;;;AAwDA,eAAsB,EACpB,GACA,GACsC;CACtC,IAAM,EAAE,YAAS,YAAS,WAAQ,YAAS,GAErC,EAAE,iBAAc,EAAO,eAAe,CAAO,GAC7C,IAAe,MAAM,EAAO,gBAAgB;EAAE;EAAS;CAAK,CAAC;CAMnE,OAJI,EAA0B,GAAQ,CAAU,KAC9C,MAAM,EAA0B,GAAQ;EAAE;EAAS;EAAS;EAAQ,MAAM,EAAa,QAAQ;CAAQ,CAAC,GAGnG,EAAa,cAAc;EAChC,SAAS,EAAU;EACnB,KAAK;EACL,cAAc;EACd,MAAM,CAAC,GAAS,CAAM;EACtB,SAAS,EAAa;EACtB,OAAO,EAAa;CACtB,CAAC;AACH"}
1
+ {"version":3,"file":"deposit-for-account.js","names":[],"sources":["../../../../src/symmio-contracts/account-layer/actions/deposit-for-account.ts"],"sourcesContent":["import type { Address, Hash } from \"viem\";\nimport type { Config } from \"../../../core/config\";\nimport type { Compute, WriteContractParameter } from \"../../../shared/types/properties\";\nimport { shouldSimulateBeforeWrite } from \"../../../shared/utils/simulate-before-write\";\nimport { accountLayerAbi } from \"../../abi/v0.8.5/account-layer\";\nimport { simulateDepositForAccount } from \"./simulate-deposit-for-account\";\n\n/**\n * Parameters for {@link depositForAccount}.\n */\nexport type DepositForAccountParameters = Compute<\n WriteContractParameter & {\n /**\n * The subaccount (or virtual account) to credit. The wallet's signing account\n * must be the subaccount's on-chain `owner`; the contract reverts otherwise.\n */\n account: Address;\n /**\n * Amount of collateral to deposit, in the collateral token's smallest unit\n * (e.g. `1_000000n` for 1 USDC at 6 decimals). The user must have approved at\n * least this much collateral to the SYMMIO core first — see {@link approveCollateral}.\n */\n amount: bigint;\n }\n>;\n\n/** Return type of {@link depositForAccount}: the submitted transaction hash. */\nexport type DepositForAccountReturnType = Hash;\n\n/**\n * Deposit collateral into a subaccount's **available balance** on the SYMMIO core.\n *\n * Calls `AccountLayer.depositForAccount`, which pulls the collateral from the\n * connected wallet into the core and credits the subaccount's available\n * balance — the balance instant trading spends and withdrawals draw from, so\n * for the instant flow this is the whole funding step (no allocate afterwards).\n * Only the classic-pool flow allocates — see {@link depositAndAllocateForAccount}.\n *\n * Dry-runs the call with {@link simulateDepositForAccount} first unless\n * `simulateBeforeWrite` is `false` (per-call, falling back to the config default).\n *\n * @remarks\n * Requires a prior ERC20 approval of the collateral token to the **SYMMIO core**\n * (`symmioAddress`), which is the contract that pulls the funds. See\n * {@link approveCollateral} / {@link getCollateralAllowance}.\n *\n * @param config - The SDK config (must have a `getWalletClient` resolver).\n * @param parameters - Subaccount address, amount (collateral units), optional chain id.\n * @returns The submitted transaction hash. The caller waits on the receipt.\n * @throws {SymmError} when the chain is unsupported or no wallet is available.\n * @throws Viem's write errors (`ContractFunctionExecutionError`, ...).\n *\n * @example\n * ```ts\n * const hash = await depositForAccount(config, { account: \"0xsub…\", amount: 1_000000n });\n * ```\n */\nexport async function depositForAccount(\n config: Config,\n parameters: DepositForAccountParameters,\n): Promise<DepositForAccountReturnType> {\n const { chainId, account, amount, from } = parameters;\n\n const { addresses } = config.getChainConfig(chainId);\n const walletClient = await config.getWalletClient({ chainId, from });\n\n if (shouldSimulateBeforeWrite(config, parameters)) {\n await simulateDepositForAccount(config, { chainId, account, amount, from: walletClient.account.address });\n }\n\n return walletClient.writeContract({\n address: addresses.accountLayerAddress,\n abi: accountLayerAbi,\n functionName: \"depositForAccount\",\n args: [account, amount],\n account: walletClient.account,\n chain: walletClient.chain,\n });\n}\n"],"mappings":";;;;AAyDA,eAAsB,EACpB,GACA,GACsC;CACtC,IAAM,EAAE,YAAS,YAAS,WAAQ,YAAS,GAErC,EAAE,iBAAc,EAAO,eAAe,CAAO,GAC7C,IAAe,MAAM,EAAO,gBAAgB;EAAE;EAAS;CAAK,CAAC;CAMnE,OAJI,EAA0B,GAAQ,CAAU,KAC9C,MAAM,EAA0B,GAAQ;EAAE;EAAS;EAAS;EAAQ,MAAM,EAAa,QAAQ;CAAQ,CAAC,GAGnG,EAAa,cAAc;EAChC,SAAS,EAAU;EACnB,KAAK;EACL,cAAc;EACd,MAAM,CAAC,GAAS,CAAM;EACtB,SAAS,EAAa;EACtB,OAAO,EAAa;CACtB,CAAC;AACH"}
@@ -0,0 +1,39 @@
1
+ import { Address } from 'viem';
2
+ import { Config } from '../../../core/config/index.js';
3
+ import { ChainIdParameter, Compute } from '../../../shared/types/properties.js';
4
+ /**
5
+ * Parameters for {@link generateAccountManagerAddress}.
6
+ */
7
+ export type GenerateAccountManagerAddressParameters = Compute<ChainIdParameter & {
8
+ /** The address that would submit the registration (`msg.sender` of the request). */
9
+ registrant: Address;
10
+ /** The affiliate name that would be registered. Part of the address salt. */
11
+ name: string;
12
+ }>;
13
+ /** Return type of {@link generateAccountManagerAddress}: the predicted affiliate address. */
14
+ export type GenerateAccountManagerAddressReturnType = Address;
15
+ /**
16
+ * Predict the deterministic affiliate (`AccountManager`) address for a
17
+ * `(registrant, name)` pair — the same CREATE2 address
18
+ * {@link requestToRegisterAffiliate} would assign.
19
+ *
20
+ * Pure view call; usable **before** registering to show the future affiliate
21
+ * address, and after, since the value is deterministic. Resolves the viem client
22
+ * and `AccountLayer` address from `config`.
23
+ *
24
+ * @param config - The SDK config.
25
+ * @param parameters - Prospective registrant, affiliate name, optional chain id.
26
+ * @returns The deterministic affiliate address for that registrant + name.
27
+ * @throws {SymmError} when the chain is not supported.
28
+ * @throws Viem's `ContractFunctionExecutionError` and friends for on-chain failures.
29
+ *
30
+ * @example
31
+ * ```ts
32
+ * const predicted = await generateAccountManagerAddress(config, {
33
+ * registrant: "0xme…",
34
+ * name: "Acme",
35
+ * });
36
+ * ```
37
+ */
38
+ export declare function generateAccountManagerAddress(config: Config, parameters: GenerateAccountManagerAddressParameters): Promise<GenerateAccountManagerAddressReturnType>;
39
+ //# sourceMappingURL=generate-account-manager-address.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generate-account-manager-address.d.ts","sourceRoot":"","sources":["../../../../src/symmio-contracts/account-layer/actions/generate-account-manager-address.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AACpC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,KAAK,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,kCAAkC,CAAC;AAGlF;;GAEG;AACH,MAAM,MAAM,uCAAuC,GAAG,OAAO,CAC3D,gBAAgB,GAAG;IACjB,oFAAoF;IACpF,UAAU,EAAE,OAAO,CAAC;IACpB,6EAA6E;IAC7E,IAAI,EAAE,MAAM,CAAC;CACd,CACF,CAAC;AAEF,6FAA6F;AAC7F,MAAM,MAAM,uCAAuC,GAAG,OAAO,CAAC;AAE9D;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAsB,6BAA6B,CACjD,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,uCAAuC,GAClD,OAAO,CAAC,uCAAuC,CAAC,CAclD"}
@@ -0,0 +1,15 @@
1
+ import { accountLayerAbi as e } from "../../abi/v0.8.5/account-layer.js";
2
+ //#region src/symmio-contracts/account-layer/actions/generate-account-manager-address.ts
3
+ async function t(t, n) {
4
+ let { chainId: r, registrant: i, name: a } = n, { addresses: o } = t.getChainConfig(r);
5
+ return await t.getClient({ chainId: r }).readContract({
6
+ address: o.accountLayerAddress,
7
+ abi: e,
8
+ functionName: "generateAccountManagerAddress",
9
+ args: [i, a]
10
+ });
11
+ }
12
+ //#endregion
13
+ export { t as generateAccountManagerAddress };
14
+
15
+ //# sourceMappingURL=generate-account-manager-address.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generate-account-manager-address.js","names":[],"sources":["../../../../src/symmio-contracts/account-layer/actions/generate-account-manager-address.ts"],"sourcesContent":["import type { Address } from \"viem\";\nimport type { Config } from \"../../../core/config\";\nimport type { ChainIdParameter, Compute } from \"../../../shared/types/properties\";\nimport { accountLayerAbi } from \"../../abi/v0.8.5/account-layer\";\n\n/**\n * Parameters for {@link generateAccountManagerAddress}.\n */\nexport type GenerateAccountManagerAddressParameters = Compute<\n ChainIdParameter & {\n /** The address that would submit the registration (`msg.sender` of the request). */\n registrant: Address;\n /** The affiliate name that would be registered. Part of the address salt. */\n name: string;\n }\n>;\n\n/** Return type of {@link generateAccountManagerAddress}: the predicted affiliate address. */\nexport type GenerateAccountManagerAddressReturnType = Address;\n\n/**\n * Predict the deterministic affiliate (`AccountManager`) address for a\n * `(registrant, name)` pair — the same CREATE2 address\n * {@link requestToRegisterAffiliate} would assign.\n *\n * Pure view call; usable **before** registering to show the future affiliate\n * address, and after, since the value is deterministic. Resolves the viem client\n * and `AccountLayer` address from `config`.\n *\n * @param config - The SDK config.\n * @param parameters - Prospective registrant, affiliate name, optional chain id.\n * @returns The deterministic affiliate address for that registrant + name.\n * @throws {SymmError} when the chain is not supported.\n * @throws Viem's `ContractFunctionExecutionError` and friends for on-chain failures.\n *\n * @example\n * ```ts\n * const predicted = await generateAccountManagerAddress(config, {\n * registrant: \"0xme…\",\n * name: \"Acme\",\n * });\n * ```\n */\nexport async function generateAccountManagerAddress(\n config: Config,\n parameters: GenerateAccountManagerAddressParameters,\n): Promise<GenerateAccountManagerAddressReturnType> {\n const { chainId, registrant, name } = parameters;\n\n const { addresses } = config.getChainConfig(chainId);\n const client = config.getClient({ chainId });\n\n const result = await client.readContract({\n address: addresses.accountLayerAddress,\n abi: accountLayerAbi,\n functionName: \"generateAccountManagerAddress\",\n args: [registrant, name],\n });\n\n return result;\n}\n"],"mappings":";;AA2CA,eAAsB,EACpB,GACA,GACkD;CAClD,IAAM,EAAE,YAAS,eAAY,YAAS,GAEhC,EAAE,iBAAc,EAAO,eAAe,CAAO;CAUnD,OAAO,MATQ,EAAO,UAAU,EAAE,WAAQ,CAErB,EAAO,aAAa;EACvC,SAAS,EAAU;EACnB,KAAK;EACL,cAAc;EACd,MAAM,CAAC,GAAY,CAAI;CACzB,CAAC;AAGH"}
@@ -0,0 +1,35 @@
1
+ import { Address } from 'viem';
2
+ import { Config } from '../../../core/config/index.js';
3
+ import { ChainIdParameter, Compute } from '../../../shared/types/properties.js';
4
+ import { AffiliateState } from '../types.js';
5
+ /**
6
+ * Parameters for {@link getAffiliateState}.
7
+ */
8
+ export type GetAffiliateStateParameters = Compute<ChainIdParameter & {
9
+ /** The affiliate (AccountManager) address to read the lifecycle state of. */
10
+ affiliate: Address;
11
+ }>;
12
+ /** Return type of {@link getAffiliateState}. */
13
+ export type GetAffiliateStateReturnType = AffiliateState;
14
+ /**
15
+ * Read an affiliate's current lifecycle state on the `AccountLayer`.
16
+ *
17
+ * Resolves the viem client and `AccountLayer` address from `config` for the
18
+ * given chain (or the config's default chain when `chainId` is omitted). Use
19
+ * this to poll after {@link requestToRegisterAffiliate}: the state advances from
20
+ * `PENDING` to `ACTIVE` once an approver approves the registration.
21
+ *
22
+ * @param config - The SDK config.
23
+ * @param parameters - Affiliate address, optional chain id.
24
+ * @returns The affiliate's {@link AffiliateState} (`NONE` for an unknown address).
25
+ * @throws {SymmError} when the chain is not supported.
26
+ * @throws Viem's `ContractFunctionExecutionError` and friends for on-chain failures.
27
+ *
28
+ * @example
29
+ * ```ts
30
+ * const state = await getAffiliateState(config, { affiliate: "0xaff…" });
31
+ * if (state === AffiliateState.ACTIVE) { }
32
+ * ```
33
+ */
34
+ export declare function getAffiliateState(config: Config, parameters: GetAffiliateStateParameters): Promise<GetAffiliateStateReturnType>;
35
+ //# sourceMappingURL=get-affiliate-state.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-affiliate-state.d.ts","sourceRoot":"","sources":["../../../../src/symmio-contracts/account-layer/actions/get-affiliate-state.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AACpC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,KAAK,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,kCAAkC,CAAC;AAElF,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE1C;;GAEG;AACH,MAAM,MAAM,2BAA2B,GAAG,OAAO,CAC/C,gBAAgB,GAAG;IACjB,6EAA6E;IAC7E,SAAS,EAAE,OAAO,CAAC;CACpB,CACF,CAAC;AAEF,gDAAgD;AAChD,MAAM,MAAM,2BAA2B,GAAG,cAAc,CAAC;AAEzD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAsB,iBAAiB,CACrC,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,2BAA2B,GACtC,OAAO,CAAC,2BAA2B,CAAC,CActC"}
@@ -0,0 +1,15 @@
1
+ import { accountLayerAbi as e } from "../../abi/v0.8.5/account-layer.js";
2
+ //#region src/symmio-contracts/account-layer/actions/get-affiliate-state.ts
3
+ async function t(t, n) {
4
+ let { chainId: r, affiliate: i } = n, { addresses: a } = t.getChainConfig(r);
5
+ return await t.getClient({ chainId: r }).readContract({
6
+ address: a.accountLayerAddress,
7
+ abi: e,
8
+ functionName: "getAffiliateState",
9
+ args: [i]
10
+ });
11
+ }
12
+ //#endregion
13
+ export { t as getAffiliateState };
14
+
15
+ //# sourceMappingURL=get-affiliate-state.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-affiliate-state.js","names":[],"sources":["../../../../src/symmio-contracts/account-layer/actions/get-affiliate-state.ts"],"sourcesContent":["import type { Address } from \"viem\";\nimport type { Config } from \"../../../core/config\";\nimport type { ChainIdParameter, Compute } from \"../../../shared/types/properties\";\nimport { accountLayerAbi } from \"../../abi/v0.8.5/account-layer\";\nimport { AffiliateState } from \"../types\";\n\n/**\n * Parameters for {@link getAffiliateState}.\n */\nexport type GetAffiliateStateParameters = Compute<\n ChainIdParameter & {\n /** The affiliate (AccountManager) address to read the lifecycle state of. */\n affiliate: Address;\n }\n>;\n\n/** Return type of {@link getAffiliateState}. */\nexport type GetAffiliateStateReturnType = AffiliateState;\n\n/**\n * Read an affiliate's current lifecycle state on the `AccountLayer`.\n *\n * Resolves the viem client and `AccountLayer` address from `config` for the\n * given chain (or the config's default chain when `chainId` is omitted). Use\n * this to poll after {@link requestToRegisterAffiliate}: the state advances from\n * `PENDING` to `ACTIVE` once an approver approves the registration.\n *\n * @param config - The SDK config.\n * @param parameters - Affiliate address, optional chain id.\n * @returns The affiliate's {@link AffiliateState} (`NONE` for an unknown address).\n * @throws {SymmError} when the chain is not supported.\n * @throws Viem's `ContractFunctionExecutionError` and friends for on-chain failures.\n *\n * @example\n * ```ts\n * const state = await getAffiliateState(config, { affiliate: \"0xaff…\" });\n * if (state === AffiliateState.ACTIVE) { }\n * ```\n */\nexport async function getAffiliateState(\n config: Config,\n parameters: GetAffiliateStateParameters,\n): Promise<GetAffiliateStateReturnType> {\n const { chainId, affiliate } = parameters;\n\n const { addresses } = config.getChainConfig(chainId);\n const client = config.getClient({ chainId });\n\n const result = await client.readContract({\n address: addresses.accountLayerAddress,\n abi: accountLayerAbi,\n functionName: \"getAffiliateState\",\n args: [affiliate],\n });\n\n return result as AffiliateState;\n}\n"],"mappings":";;AAuCA,eAAsB,EACpB,GACA,GACsC;CACtC,IAAM,EAAE,YAAS,iBAAc,GAEzB,EAAE,iBAAc,EAAO,eAAe,CAAO;CAUnD,OAAO,MATQ,EAAO,UAAU,EAAE,WAAQ,CAErB,EAAO,aAAa;EACvC,SAAS,EAAU;EACnB,KAAK;EACL,cAAc;EACd,MAAM,CAAC,CAAS;CAClB,CAAC;AAGH"}
@@ -0,0 +1,56 @@
1
+ import { Hash } from 'viem';
2
+ import { Config } from '../../../core/config/index.js';
3
+ import { Compute, WriteContractParameter } from '../../../shared/types/properties.js';
4
+ import { AffiliateRegistration } from '../types.js';
5
+ /**
6
+ * Parameters for {@link requestToRegisterAffiliate}.
7
+ */
8
+ export type RequestToRegisterAffiliateParameters = Compute<WriteContractParameter & {
9
+ /**
10
+ * The full `AffiliateRegistration` tuple. Its `stakeholders` shares plus
11
+ * `symmioShare` must sum to exactly `1e18`, `admin` must be non-zero, and
12
+ * every entry in `symmioCores` must be a whitelisted core, or the contract
13
+ * reverts.
14
+ */
15
+ registration: AffiliateRegistration;
16
+ }>;
17
+ /** Return type of {@link requestToRegisterAffiliate}: the submitted transaction hash. */
18
+ export type RequestToRegisterAffiliateReturnType = Hash;
19
+ /**
20
+ * Send the permissionless on-chain request to register a new affiliate.
21
+ *
22
+ * Resolves the bound wallet client and `AccountLayer` address from `config`. The
23
+ * request is permissionless — anyone may submit it — and creates a `PENDING`
24
+ * affiliate keyed to a deterministic `AccountManager` address derived from the
25
+ * caller and `registration.name`. An `APPROVER_ROLE` holder must then approve it
26
+ * before it becomes `ACTIVE`.
27
+ *
28
+ * Dry-runs the call with {@link simulateRequestToRegisterAffiliate} first unless
29
+ * `simulateBeforeWrite` is `false` (per-call, falling back to the config default).
30
+ *
31
+ * @param config - The SDK config (must have a `getWalletClient` resolver).
32
+ * @param parameters - The registration tuple, optional chain id / simulate opt-out.
33
+ * @returns The submitted transaction hash. A write cannot return the contract's
34
+ * `affiliateAddress`; derive it deterministically with
35
+ * {@link generateAccountManagerAddress} instead.
36
+ * @throws {SymmError} when the chain is unsupported or no wallet is available.
37
+ * @throws Viem's write errors (`ContractFunctionExecutionError`, ...).
38
+ *
39
+ * @example
40
+ * ```ts
41
+ * const hash = await requestToRegisterAffiliate(config, {
42
+ * registration: {
43
+ * name: "Acme",
44
+ * brandColor: "#ff5c39",
45
+ * admin: "0xadmin…",
46
+ * stakeholders: [{ receiver: "0xadmin…", share: 900000000000000000n }], // 0.9e18
47
+ * symmioShare: 100000000000000000n, // 0.1e18 — sums to 1e18
48
+ * metadata: "0x",
49
+ * legacyMultiAccounts: [],
50
+ * symmioCores: ["0xcore…"],
51
+ * },
52
+ * });
53
+ * ```
54
+ */
55
+ export declare function requestToRegisterAffiliate(config: Config, parameters: RequestToRegisterAffiliateParameters): Promise<RequestToRegisterAffiliateReturnType>;
56
+ //# sourceMappingURL=request-to-register-affiliate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"request-to-register-affiliate.d.ts","sourceRoot":"","sources":["../../../../src/symmio-contracts/account-layer/actions/request-to-register-affiliate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AACjC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,KAAK,EAAE,OAAO,EAAE,sBAAsB,EAAE,MAAM,kCAAkC,CAAC;AAGxF,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAGtD;;GAEG;AACH,MAAM,MAAM,oCAAoC,GAAG,OAAO,CACxD,sBAAsB,GAAG;IACvB;;;;;OAKG;IACH,YAAY,EAAE,qBAAqB,CAAC;CACrC,CACF,CAAC;AAEF,yFAAyF;AACzF,MAAM,MAAM,oCAAoC,GAAG,IAAI,CAAC;AAExD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,wBAAsB,0BAA0B,CAC9C,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,oCAAoC,GAC/C,OAAO,CAAC,oCAAoC,CAAC,CAkB/C"}
@@ -0,0 +1,26 @@
1
+ import { accountLayerAbi as e } from "../../abi/v0.8.5/account-layer.js";
2
+ import { shouldSimulateBeforeWrite as t } from "../../../shared/utils/simulate-before-write.js";
3
+ import { simulateRequestToRegisterAffiliate as n } from "./simulate-request-to-register-affiliate.js";
4
+ //#region src/symmio-contracts/account-layer/actions/request-to-register-affiliate.ts
5
+ async function r(r, i) {
6
+ let { chainId: a, registration: o, from: s } = i, { addresses: c } = r.getChainConfig(a), l = await r.getWalletClient({
7
+ chainId: a,
8
+ from: s
9
+ });
10
+ return t(r, i) && await n(r, {
11
+ chainId: a,
12
+ registration: o,
13
+ from: l.account.address
14
+ }), l.writeContract({
15
+ address: c.accountLayerAddress,
16
+ abi: e,
17
+ functionName: "requestToRegisterAffiliate",
18
+ args: [o],
19
+ account: l.account,
20
+ chain: l.chain
21
+ });
22
+ }
23
+ //#endregion
24
+ export { r as requestToRegisterAffiliate };
25
+
26
+ //# sourceMappingURL=request-to-register-affiliate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"request-to-register-affiliate.js","names":[],"sources":["../../../../src/symmio-contracts/account-layer/actions/request-to-register-affiliate.ts"],"sourcesContent":["import type { Hash } from \"viem\";\nimport type { Config } from \"../../../core/config\";\nimport type { Compute, WriteContractParameter } from \"../../../shared/types/properties\";\nimport { shouldSimulateBeforeWrite } from \"../../../shared/utils/simulate-before-write\";\nimport { accountLayerAbi } from \"../../abi/v0.8.5/account-layer\";\nimport type { AffiliateRegistration } from \"../types\";\nimport { simulateRequestToRegisterAffiliate } from \"./simulate-request-to-register-affiliate\";\n\n/**\n * Parameters for {@link requestToRegisterAffiliate}.\n */\nexport type RequestToRegisterAffiliateParameters = Compute<\n WriteContractParameter & {\n /**\n * The full `AffiliateRegistration` tuple. Its `stakeholders` shares plus\n * `symmioShare` must sum to exactly `1e18`, `admin` must be non-zero, and\n * every entry in `symmioCores` must be a whitelisted core, or the contract\n * reverts.\n */\n registration: AffiliateRegistration;\n }\n>;\n\n/** Return type of {@link requestToRegisterAffiliate}: the submitted transaction hash. */\nexport type RequestToRegisterAffiliateReturnType = Hash;\n\n/**\n * Send the permissionless on-chain request to register a new affiliate.\n *\n * Resolves the bound wallet client and `AccountLayer` address from `config`. The\n * request is permissionless — anyone may submit it — and creates a `PENDING`\n * affiliate keyed to a deterministic `AccountManager` address derived from the\n * caller and `registration.name`. An `APPROVER_ROLE` holder must then approve it\n * before it becomes `ACTIVE`.\n *\n * Dry-runs the call with {@link simulateRequestToRegisterAffiliate} first unless\n * `simulateBeforeWrite` is `false` (per-call, falling back to the config default).\n *\n * @param config - The SDK config (must have a `getWalletClient` resolver).\n * @param parameters - The registration tuple, optional chain id / simulate opt-out.\n * @returns The submitted transaction hash. A write cannot return the contract's\n * `affiliateAddress`; derive it deterministically with\n * {@link generateAccountManagerAddress} instead.\n * @throws {SymmError} when the chain is unsupported or no wallet is available.\n * @throws Viem's write errors (`ContractFunctionExecutionError`, ...).\n *\n * @example\n * ```ts\n * const hash = await requestToRegisterAffiliate(config, {\n * registration: {\n * name: \"Acme\",\n * brandColor: \"#ff5c39\",\n * admin: \"0xadmin…\",\n * stakeholders: [{ receiver: \"0xadmin…\", share: 900000000000000000n }], // 0.9e18\n * symmioShare: 100000000000000000n, // 0.1e18 — sums to 1e18\n * metadata: \"0x\",\n * legacyMultiAccounts: [],\n * symmioCores: [\"0xcore…\"],\n * },\n * });\n * ```\n */\nexport async function requestToRegisterAffiliate(\n config: Config,\n parameters: RequestToRegisterAffiliateParameters,\n): Promise<RequestToRegisterAffiliateReturnType> {\n const { chainId, registration, from } = parameters;\n\n const { addresses } = config.getChainConfig(chainId);\n const walletClient = await config.getWalletClient({ chainId, from });\n\n if (shouldSimulateBeforeWrite(config, parameters)) {\n await simulateRequestToRegisterAffiliate(config, { chainId, registration, from: walletClient.account.address });\n }\n\n return walletClient.writeContract({\n address: addresses.accountLayerAddress,\n abi: accountLayerAbi,\n functionName: \"requestToRegisterAffiliate\",\n args: [registration],\n account: walletClient.account,\n chain: walletClient.chain,\n });\n}\n"],"mappings":";;;;AA8DA,eAAsB,EACpB,GACA,GAC+C;CAC/C,IAAM,EAAE,YAAS,iBAAc,YAAS,GAElC,EAAE,iBAAc,EAAO,eAAe,CAAO,GAC7C,IAAe,MAAM,EAAO,gBAAgB;EAAE;EAAS;CAAK,CAAC;CAMnE,OAJI,EAA0B,GAAQ,CAAU,KAC9C,MAAM,EAAmC,GAAQ;EAAE;EAAS;EAAc,MAAM,EAAa,QAAQ;CAAQ,CAAC,GAGzG,EAAa,cAAc;EAChC,SAAS,EAAU;EACnB,KAAK;EACL,cAAc;EACd,MAAM,CAAC,CAAY;EACnB,SAAS,EAAa;EACtB,OAAO,EAAa;CACtB,CAAC;AACH"}
@@ -0,0 +1,31 @@
1
+ import { SimulateContractReturnType } from 'viem';
2
+ import { Config } from '../../../core/config/index.js';
3
+ import { Compute, FromParameter } from '../../../shared/types/properties.js';
4
+ import { accountLayerAbi } from '../../abi/v0.8.5/account-layer.js';
5
+ import { CancelRegistrationParameters } from './cancel-registration.js';
6
+ /**
7
+ * Parameters for {@link simulateCancelRegistration}: the write's parameters plus
8
+ * an optional `from` (the address the dry-run runs as).
9
+ */
10
+ export type SimulateCancelRegistrationParameters = Compute<CancelRegistrationParameters & FromParameter>;
11
+ /**
12
+ * Return type of {@link simulateCancelRegistration}: viem's `{ request, result }`.
13
+ *
14
+ * Written as an explicit alias over `SimulateContractReturnType<typeof accountLayerAbi, …>`
15
+ * so the emitted declaration references the ABI by name instead of inlining the whole
16
+ * ABI (which would bloat the published `.d.ts` and degrade consumers' type-checking).
17
+ */
18
+ export type SimulateCancelRegistrationReturnType = SimulateContractReturnType<typeof accountLayerAbi, "cancelRegistration">;
19
+ /**
20
+ * Dry-run {@link cancelRegistration} without sending a transaction. Runs
21
+ * `simulateContract` against the AccountLayer via the public client; a would-be
22
+ * revert (not admin, not pending) throws viem's call error.
23
+ *
24
+ * @param config - The SDK config.
25
+ * @param parameters - Affiliate address, optional `from`, optional chain id.
26
+ * @returns viem's `{ request, result }` (`result` is `undefined` — the function returns nothing).
27
+ * @throws {SymmError} when the chain is unsupported.
28
+ * @throws Viem's call errors when the transaction would revert.
29
+ */
30
+ export declare function simulateCancelRegistration(config: Config, parameters: SimulateCancelRegistrationParameters): Promise<SimulateCancelRegistrationReturnType>;
31
+ //# sourceMappingURL=simulate-cancel-registration.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"simulate-cancel-registration.d.ts","sourceRoot":"","sources":["../../../../src/symmio-contracts/account-layer/actions/simulate-cancel-registration.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,MAAM,CAAC;AACvD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,KAAK,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AAC/E,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,uBAAuB,CAAC;AAE1E;;;GAGG;AACH,MAAM,MAAM,oCAAoC,GAAG,OAAO,CAAC,4BAA4B,GAAG,aAAa,CAAC,CAAC;AAEzG;;;;;;GAMG;AACH,MAAM,MAAM,oCAAoC,GAAG,0BAA0B,CAC3E,OAAO,eAAe,EACtB,oBAAoB,CACrB,CAAC;AAEF;;;;;;;;;;GAUG;AACH,wBAAsB,0BAA0B,CAC9C,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,oCAAoC,GAC/C,OAAO,CAAC,oCAAoC,CAAC,CAY/C"}
@@ -0,0 +1,16 @@
1
+ import { accountLayerAbi as e } from "../../abi/v0.8.5/account-layer.js";
2
+ //#region src/symmio-contracts/account-layer/actions/simulate-cancel-registration.ts
3
+ async function t(t, n) {
4
+ let { chainId: r, affiliate: i, from: a } = n, { addresses: o } = t.getChainConfig(r);
5
+ return t.getClient({ chainId: r }).simulateContract({
6
+ address: o.accountLayerAddress,
7
+ abi: e,
8
+ functionName: "cancelRegistration",
9
+ args: [i],
10
+ account: a
11
+ });
12
+ }
13
+ //#endregion
14
+ export { t as simulateCancelRegistration };
15
+
16
+ //# sourceMappingURL=simulate-cancel-registration.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"simulate-cancel-registration.js","names":[],"sources":["../../../../src/symmio-contracts/account-layer/actions/simulate-cancel-registration.ts"],"sourcesContent":["import type { SimulateContractReturnType } from \"viem\";\nimport type { Config } from \"../../../core/config\";\nimport type { Compute, FromParameter } from \"../../../shared/types/properties\";\nimport { accountLayerAbi } from \"../../abi/v0.8.5/account-layer\";\nimport type { CancelRegistrationParameters } from \"./cancel-registration\";\n\n/**\n * Parameters for {@link simulateCancelRegistration}: the write's parameters plus\n * an optional `from` (the address the dry-run runs as).\n */\nexport type SimulateCancelRegistrationParameters = Compute<CancelRegistrationParameters & FromParameter>;\n\n/**\n * Return type of {@link simulateCancelRegistration}: viem's `{ request, result }`.\n *\n * Written as an explicit alias over `SimulateContractReturnType<typeof accountLayerAbi, …>`\n * so the emitted declaration references the ABI by name instead of inlining the whole\n * ABI (which would bloat the published `.d.ts` and degrade consumers' type-checking).\n */\nexport type SimulateCancelRegistrationReturnType = SimulateContractReturnType<\n typeof accountLayerAbi,\n \"cancelRegistration\"\n>;\n\n/**\n * Dry-run {@link cancelRegistration} without sending a transaction. Runs\n * `simulateContract` against the AccountLayer via the public client; a would-be\n * revert (not admin, not pending) throws viem's call error.\n *\n * @param config - The SDK config.\n * @param parameters - Affiliate address, optional `from`, optional chain id.\n * @returns viem's `{ request, result }` (`result` is `undefined` — the function returns nothing).\n * @throws {SymmError} when the chain is unsupported.\n * @throws Viem's call errors when the transaction would revert.\n */\nexport async function simulateCancelRegistration(\n config: Config,\n parameters: SimulateCancelRegistrationParameters,\n): Promise<SimulateCancelRegistrationReturnType> {\n const { chainId, affiliate, from } = parameters;\n\n const { addresses } = config.getChainConfig(chainId);\n\n return config.getClient({ chainId }).simulateContract({\n address: addresses.accountLayerAddress,\n abi: accountLayerAbi,\n functionName: \"cancelRegistration\",\n args: [affiliate],\n account: from,\n });\n}\n"],"mappings":";;AAmCA,eAAsB,EACpB,GACA,GAC+C;CAC/C,IAAM,EAAE,YAAS,cAAW,YAAS,GAE/B,EAAE,iBAAc,EAAO,eAAe,CAAO;CAEnD,OAAO,EAAO,UAAU,EAAE,WAAQ,CAAC,EAAE,iBAAiB;EACpD,SAAS,EAAU;EACnB,KAAK;EACL,cAAc;EACd,MAAM,CAAC,CAAS;EAChB,SAAS;CACX,CAAC;AACH"}
@@ -0,0 +1,33 @@
1
+ import { SimulateContractReturnType } from 'viem';
2
+ import { Config } from '../../../core/config/index.js';
3
+ import { Compute, FromParameter } from '../../../shared/types/properties.js';
4
+ import { accountLayerAbi } from '../../abi/v0.8.5/account-layer.js';
5
+ import { RequestToRegisterAffiliateParameters } from './request-to-register-affiliate.js';
6
+ /**
7
+ * Parameters for {@link simulateRequestToRegisterAffiliate}: the write's
8
+ * parameters plus an optional `from` (the address the dry-run runs as).
9
+ */
10
+ export type SimulateRequestToRegisterAffiliateParameters = Compute<RequestToRegisterAffiliateParameters & FromParameter>;
11
+ /**
12
+ * Return type of {@link simulateRequestToRegisterAffiliate}: viem's
13
+ * `{ request, result }`.
14
+ *
15
+ * Written as an explicit alias over `SimulateContractReturnType<typeof accountLayerAbi, …>`
16
+ * so the emitted declaration references the ABI by name instead of inlining the whole
17
+ * ABI (which would bloat the published `.d.ts` and degrade consumers' type-checking).
18
+ */
19
+ export type SimulateRequestToRegisterAffiliateReturnType = SimulateContractReturnType<typeof accountLayerAbi, "requestToRegisterAffiliate">;
20
+ /**
21
+ * Dry-run {@link requestToRegisterAffiliate} without sending a transaction. Runs
22
+ * `simulateContract` against the AccountLayer via the public client; a would-be
23
+ * revert (bad fee-share sum, zero admin, unwhitelisted core, name taken) throws
24
+ * viem's call error. On success, `result` is the deterministic affiliate address.
25
+ *
26
+ * @param config - The SDK config.
27
+ * @param parameters - The registration tuple, optional `from`, optional chain id.
28
+ * @returns viem's `{ request, result }` (`result` is the would-be affiliate address).
29
+ * @throws {SymmError} when the chain is unsupported.
30
+ * @throws Viem's call errors when the transaction would revert.
31
+ */
32
+ export declare function simulateRequestToRegisterAffiliate(config: Config, parameters: SimulateRequestToRegisterAffiliateParameters): Promise<SimulateRequestToRegisterAffiliateReturnType>;
33
+ //# sourceMappingURL=simulate-request-to-register-affiliate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"simulate-request-to-register-affiliate.d.ts","sourceRoot":"","sources":["../../../../src/symmio-contracts/account-layer/actions/simulate-request-to-register-affiliate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,MAAM,CAAC;AACvD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,KAAK,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AAC/E,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,KAAK,EAAE,oCAAoC,EAAE,MAAM,iCAAiC,CAAC;AAE5F;;;GAGG;AACH,MAAM,MAAM,4CAA4C,GAAG,OAAO,CAChE,oCAAoC,GAAG,aAAa,CACrD,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,MAAM,4CAA4C,GAAG,0BAA0B,CACnF,OAAO,eAAe,EACtB,4BAA4B,CAC7B,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,wBAAsB,kCAAkC,CACtD,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,4CAA4C,GACvD,OAAO,CAAC,4CAA4C,CAAC,CAYvD"}
@@ -0,0 +1,16 @@
1
+ import { accountLayerAbi as e } from "../../abi/v0.8.5/account-layer.js";
2
+ //#region src/symmio-contracts/account-layer/actions/simulate-request-to-register-affiliate.ts
3
+ async function t(t, n) {
4
+ let { chainId: r, registration: i, from: a } = n, { addresses: o } = t.getChainConfig(r);
5
+ return t.getClient({ chainId: r }).simulateContract({
6
+ address: o.accountLayerAddress,
7
+ abi: e,
8
+ functionName: "requestToRegisterAffiliate",
9
+ args: [i],
10
+ account: a
11
+ });
12
+ }
13
+ //#endregion
14
+ export { t as simulateRequestToRegisterAffiliate };
15
+
16
+ //# sourceMappingURL=simulate-request-to-register-affiliate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"simulate-request-to-register-affiliate.js","names":[],"sources":["../../../../src/symmio-contracts/account-layer/actions/simulate-request-to-register-affiliate.ts"],"sourcesContent":["import type { SimulateContractReturnType } from \"viem\";\nimport type { Config } from \"../../../core/config\";\nimport type { Compute, FromParameter } from \"../../../shared/types/properties\";\nimport { accountLayerAbi } from \"../../abi/v0.8.5/account-layer\";\nimport type { RequestToRegisterAffiliateParameters } from \"./request-to-register-affiliate\";\n\n/**\n * Parameters for {@link simulateRequestToRegisterAffiliate}: the write's\n * parameters plus an optional `from` (the address the dry-run runs as).\n */\nexport type SimulateRequestToRegisterAffiliateParameters = Compute<\n RequestToRegisterAffiliateParameters & FromParameter\n>;\n\n/**\n * Return type of {@link simulateRequestToRegisterAffiliate}: viem's\n * `{ request, result }`.\n *\n * Written as an explicit alias over `SimulateContractReturnType<typeof accountLayerAbi, …>`\n * so the emitted declaration references the ABI by name instead of inlining the whole\n * ABI (which would bloat the published `.d.ts` and degrade consumers' type-checking).\n */\nexport type SimulateRequestToRegisterAffiliateReturnType = SimulateContractReturnType<\n typeof accountLayerAbi,\n \"requestToRegisterAffiliate\"\n>;\n\n/**\n * Dry-run {@link requestToRegisterAffiliate} without sending a transaction. Runs\n * `simulateContract` against the AccountLayer via the public client; a would-be\n * revert (bad fee-share sum, zero admin, unwhitelisted core, name taken) throws\n * viem's call error. On success, `result` is the deterministic affiliate address.\n *\n * @param config - The SDK config.\n * @param parameters - The registration tuple, optional `from`, optional chain id.\n * @returns viem's `{ request, result }` (`result` is the would-be affiliate address).\n * @throws {SymmError} when the chain is unsupported.\n * @throws Viem's call errors when the transaction would revert.\n */\nexport async function simulateRequestToRegisterAffiliate(\n config: Config,\n parameters: SimulateRequestToRegisterAffiliateParameters,\n): Promise<SimulateRequestToRegisterAffiliateReturnType> {\n const { chainId, registration, from } = parameters;\n\n const { addresses } = config.getChainConfig(chainId);\n\n return config.getClient({ chainId }).simulateContract({\n address: addresses.accountLayerAddress,\n abi: accountLayerAbi,\n functionName: \"requestToRegisterAffiliate\",\n args: [registration],\n account: from,\n });\n}\n"],"mappings":";;AAuCA,eAAsB,EACpB,GACA,GACuD;CACvD,IAAM,EAAE,YAAS,iBAAc,YAAS,GAElC,EAAE,iBAAc,EAAO,eAAe,CAAO;CAEnD,OAAO,EAAO,UAAU,EAAE,WAAQ,CAAC,EAAE,iBAAiB;EACpD,SAAS,EAAU;EACnB,KAAK;EACL,cAAc;EACd,MAAM,CAAC,CAAY;EACnB,SAAS;CACX,CAAC;AACH"}