@charterlabs/rhinestone-sdk 0.1.1 → 0.1.2

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 (194) hide show
  1. package/README.md +74 -181
  2. package/dist/src/accounts/error.d.ts +69 -0
  3. package/dist/src/accounts/error.d.ts.map +1 -0
  4. package/dist/src/accounts/error.js +109 -0
  5. package/dist/{accounts → src/accounts}/index.d.ts +14 -21
  6. package/dist/src/accounts/index.d.ts.map +1 -0
  7. package/dist/src/accounts/index.js +469 -0
  8. package/dist/src/accounts/index.test.d.ts +2 -0
  9. package/dist/src/accounts/index.test.d.ts.map +1 -0
  10. package/dist/src/accounts/index.test.js +36 -0
  11. package/dist/{accounts → src/accounts}/kernel.d.ts +7 -9
  12. package/dist/src/accounts/kernel.d.ts.map +1 -0
  13. package/dist/{accounts → src/accounts}/kernel.js +0 -8
  14. package/dist/src/accounts/kernel.test.d.ts +2 -0
  15. package/dist/src/accounts/kernel.test.d.ts.map +1 -0
  16. package/dist/src/accounts/kernel.test.js +105 -0
  17. package/dist/{accounts → src/accounts}/nexus.d.ts +14 -13
  18. package/dist/src/accounts/nexus.d.ts.map +1 -0
  19. package/dist/{accounts → src/accounts}/nexus.js +92 -88
  20. package/dist/src/accounts/nexus.test.d.ts +2 -0
  21. package/dist/src/accounts/nexus.test.d.ts.map +1 -0
  22. package/dist/src/accounts/nexus.test.js +87 -0
  23. package/dist/{accounts → src/accounts}/safe.d.ts +4 -6
  24. package/dist/src/accounts/safe.d.ts.map +1 -0
  25. package/dist/{accounts → src/accounts}/safe.js +20 -29
  26. package/dist/src/accounts/safe.test.d.ts +2 -0
  27. package/dist/src/accounts/safe.test.d.ts.map +1 -0
  28. package/dist/src/accounts/safe.test.js +87 -0
  29. package/dist/src/accounts/startale.d.ts +20 -0
  30. package/dist/src/accounts/startale.d.ts.map +1 -0
  31. package/dist/src/accounts/startale.js +100 -0
  32. package/dist/src/accounts/startale.test.d.ts +2 -0
  33. package/dist/src/accounts/startale.test.d.ts.map +1 -0
  34. package/dist/src/accounts/startale.test.js +99 -0
  35. package/dist/{accounts → src/accounts}/utils.d.ts +4 -3
  36. package/dist/src/accounts/utils.d.ts.map +1 -0
  37. package/dist/{accounts → src/accounts}/utils.js +44 -0
  38. package/dist/src/accounts/utils.test.d.ts +2 -0
  39. package/dist/src/accounts/utils.test.d.ts.map +1 -0
  40. package/dist/src/accounts/utils.test.js +49 -0
  41. package/dist/src/actions/index.d.ts +39 -0
  42. package/dist/src/actions/index.d.ts.map +1 -0
  43. package/dist/{actions → src/actions}/index.js +108 -15
  44. package/dist/src/actions/index.test.d.ts +2 -0
  45. package/dist/src/actions/index.test.d.ts.map +1 -0
  46. package/dist/src/actions/index.test.js +302 -0
  47. package/dist/{actions → src/actions}/smart-session.d.ts +2 -2
  48. package/dist/src/actions/smart-session.d.ts.map +1 -0
  49. package/dist/src/execution/compact.d.ts +8 -0
  50. package/dist/src/execution/compact.d.ts.map +1 -0
  51. package/dist/src/execution/compact.js +105 -0
  52. package/dist/src/execution/error.d.ts +54 -0
  53. package/dist/src/execution/error.d.ts.map +1 -0
  54. package/dist/src/execution/error.js +78 -0
  55. package/dist/{execution → src/execution}/index.d.ts +7 -6
  56. package/dist/src/execution/index.d.ts.map +1 -0
  57. package/dist/src/execution/index.js +150 -0
  58. package/dist/src/execution/smart-session.d.ts +15 -0
  59. package/dist/src/execution/smart-session.d.ts.map +1 -0
  60. package/dist/{execution → src/execution}/smart-session.js +16 -77
  61. package/dist/src/execution/smart-session.test.d.ts +2 -0
  62. package/dist/src/execution/smart-session.test.d.ts.map +1 -0
  63. package/dist/src/execution/smart-session.test.js +34 -0
  64. package/dist/src/execution/utils.d.ts +45 -0
  65. package/dist/src/execution/utils.d.ts.map +1 -0
  66. package/dist/src/execution/utils.js +433 -0
  67. package/dist/src/index.d.ts +41 -0
  68. package/dist/src/index.d.ts.map +1 -0
  69. package/dist/src/index.js +154 -0
  70. package/dist/src/modules/abi/smart-sessions.d.ts.map +1 -0
  71. package/dist/src/modules/common.d.ts.map +1 -0
  72. package/dist/{modules → src/modules}/index.d.ts +3 -11
  73. package/dist/src/modules/index.d.ts.map +1 -0
  74. package/dist/{modules → src/modules}/index.js +3 -45
  75. package/dist/src/modules/index.test.d.ts +2 -0
  76. package/dist/src/modules/index.test.d.ts.map +1 -0
  77. package/dist/src/modules/index.test.js +107 -0
  78. package/dist/src/modules/omni-account.d.ts +7 -0
  79. package/dist/src/modules/omni-account.d.ts.map +1 -0
  80. package/dist/src/modules/omni-account.js +11 -0
  81. package/dist/src/modules/read.d.ts +9 -0
  82. package/dist/src/modules/read.d.ts.map +1 -0
  83. package/dist/{modules → src/modules}/read.js +6 -37
  84. package/dist/{modules → src/modules}/validators/core.d.ts +6 -7
  85. package/dist/src/modules/validators/core.d.ts.map +1 -0
  86. package/dist/{modules → src/modules}/validators/core.js +83 -8
  87. package/dist/src/modules/validators/core.test.d.ts +2 -0
  88. package/dist/src/modules/validators/core.test.d.ts.map +1 -0
  89. package/dist/src/modules/validators/core.test.js +108 -0
  90. package/dist/src/modules/validators/index.d.ts +4 -0
  91. package/dist/src/modules/validators/index.d.ts.map +1 -0
  92. package/dist/{modules → src/modules}/validators/index.js +1 -3
  93. package/dist/{modules → src/modules}/validators/smart-sessions.d.ts +4 -15
  94. package/dist/src/modules/validators/smart-sessions.d.ts.map +1 -0
  95. package/dist/{modules → src/modules}/validators/smart-sessions.js +7 -61
  96. package/dist/src/modules/validators/smart-sessions.test.d.ts +2 -0
  97. package/dist/src/modules/validators/smart-sessions.test.d.ts.map +1 -0
  98. package/dist/src/modules/validators/smart-sessions.test.js +226 -0
  99. package/dist/src/orchestrator/client.d.ts +21 -0
  100. package/dist/src/orchestrator/client.d.ts.map +1 -0
  101. package/dist/src/orchestrator/client.js +284 -0
  102. package/dist/src/orchestrator/consts.d.ts +5 -0
  103. package/dist/src/orchestrator/consts.d.ts.map +1 -0
  104. package/dist/src/orchestrator/consts.js +9 -0
  105. package/dist/src/orchestrator/error.d.ts +96 -0
  106. package/dist/src/orchestrator/error.d.ts.map +1 -0
  107. package/dist/src/orchestrator/error.js +132 -0
  108. package/dist/src/orchestrator/index.d.ts +11 -0
  109. package/dist/src/orchestrator/index.d.ts.map +1 -0
  110. package/dist/src/orchestrator/index.js +42 -0
  111. package/dist/src/orchestrator/registry.d.ts +39 -0
  112. package/dist/src/orchestrator/registry.d.ts.map +1 -0
  113. package/dist/src/orchestrator/registry.js +121 -0
  114. package/dist/src/orchestrator/registry.json +365 -0
  115. package/dist/src/orchestrator/registry.test.d.ts +2 -0
  116. package/dist/src/orchestrator/registry.test.d.ts.map +1 -0
  117. package/dist/src/orchestrator/registry.test.js +137 -0
  118. package/dist/src/orchestrator/types.d.ts +275 -0
  119. package/dist/src/orchestrator/types.d.ts.map +1 -0
  120. package/dist/src/orchestrator/types.js +19 -0
  121. package/dist/src/orchestrator/utils.d.ts +5 -0
  122. package/dist/src/orchestrator/utils.d.ts.map +1 -0
  123. package/dist/src/orchestrator/utils.js +126 -0
  124. package/dist/{types.d.ts → src/types.d.ts} +42 -21
  125. package/dist/src/types.d.ts.map +1 -0
  126. package/dist/test/consts.d.ts +10 -0
  127. package/dist/test/consts.d.ts.map +1 -0
  128. package/dist/test/consts.js +22 -0
  129. package/package.json +11 -20
  130. package/dist/accounts/index.d.ts.map +0 -1
  131. package/dist/accounts/index.js +0 -419
  132. package/dist/accounts/kernel.d.ts.map +0 -1
  133. package/dist/accounts/nexus.d.ts.map +0 -1
  134. package/dist/accounts/safe.d.ts.map +0 -1
  135. package/dist/accounts/utils.d.ts.map +0 -1
  136. package/dist/actions/index.d.ts +0 -29
  137. package/dist/actions/index.d.ts.map +0 -1
  138. package/dist/actions/registry.d.ts +0 -7
  139. package/dist/actions/registry.d.ts.map +0 -1
  140. package/dist/actions/registry.js +0 -7
  141. package/dist/actions/smart-session.d.ts.map +0 -1
  142. package/dist/execution/index.d.ts.map +0 -1
  143. package/dist/execution/index.js +0 -149
  144. package/dist/execution/smart-session.d.ts +0 -23
  145. package/dist/execution/smart-session.d.ts.map +0 -1
  146. package/dist/execution/utils.d.ts +0 -68
  147. package/dist/execution/utils.d.ts.map +0 -1
  148. package/dist/execution/utils.js +0 -482
  149. package/dist/index.d.ts +0 -38
  150. package/dist/index.d.ts.map +0 -1
  151. package/dist/index.js +0 -119
  152. package/dist/modules/abi/smart-sessions.d.ts.map +0 -1
  153. package/dist/modules/common.d.ts.map +0 -1
  154. package/dist/modules/index.d.ts.map +0 -1
  155. package/dist/modules/omni-account.d.ts +0 -9
  156. package/dist/modules/omni-account.d.ts.map +0 -1
  157. package/dist/modules/omni-account.js +0 -15
  158. package/dist/modules/read.d.ts +0 -10
  159. package/dist/modules/read.d.ts.map +0 -1
  160. package/dist/modules/registry.d.ts +0 -9
  161. package/dist/modules/registry.d.ts.map +0 -1
  162. package/dist/modules/registry.js +0 -60
  163. package/dist/modules/validators/core.d.ts.map +0 -1
  164. package/dist/modules/validators/index.d.ts +0 -4
  165. package/dist/modules/validators/index.d.ts.map +0 -1
  166. package/dist/modules/validators/smart-sessions.d.ts.map +0 -1
  167. package/dist/orchestrator/client.d.ts +0 -29
  168. package/dist/orchestrator/client.d.ts.map +0 -1
  169. package/dist/orchestrator/client.js +0 -250
  170. package/dist/orchestrator/consts.d.ts +0 -5
  171. package/dist/orchestrator/consts.d.ts.map +0 -1
  172. package/dist/orchestrator/consts.js +0 -9
  173. package/dist/orchestrator/error.d.ts +0 -18
  174. package/dist/orchestrator/error.d.ts.map +0 -1
  175. package/dist/orchestrator/error.js +0 -33
  176. package/dist/orchestrator/index.d.ts +0 -11
  177. package/dist/orchestrator/index.d.ts.map +0 -1
  178. package/dist/orchestrator/index.js +0 -40
  179. package/dist/orchestrator/registry.d.ts +0 -20
  180. package/dist/orchestrator/registry.d.ts.map +0 -1
  181. package/dist/orchestrator/registry.js +0 -444
  182. package/dist/orchestrator/types.d.ts +0 -242
  183. package/dist/orchestrator/types.d.ts.map +0 -1
  184. package/dist/orchestrator/types.js +0 -19
  185. package/dist/orchestrator/utils.d.ts +0 -29
  186. package/dist/orchestrator/utils.d.ts.map +0 -1
  187. package/dist/orchestrator/utils.js +0 -319
  188. package/dist/types.d.ts.map +0 -1
  189. /package/dist/{actions → src/actions}/smart-session.js +0 -0
  190. /package/dist/{modules → src/modules}/abi/smart-sessions.d.ts +0 -0
  191. /package/dist/{modules → src/modules}/abi/smart-sessions.js +0 -0
  192. /package/dist/{modules → src/modules}/common.d.ts +0 -0
  193. /package/dist/{modules → src/modules}/common.js +0 -0
  194. /package/dist/{types.js → src/types.js} +0 -0
@@ -1,149 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.sendTransaction = sendTransaction;
4
- exports.waitForExecution = waitForExecution;
5
- exports.getMaxSpendableAmount = getMaxSpendableAmount;
6
- exports.getPortfolio = getPortfolio;
7
- const viem_1 = require("viem");
8
- const chains_1 = require("viem/chains");
9
- const accounts_1 = require("../accounts");
10
- const utils_1 = require("../accounts/utils");
11
- const orchestrator_1 = require("../orchestrator");
12
- const registry_1 = require("../orchestrator/registry");
13
- const smart_session_1 = require("./smart-session");
14
- const utils_2 = require("./utils");
15
- const POLLING_INTERVAL = 500;
16
- async function sendTransaction(config, transaction) {
17
- if ('chain' in transaction) {
18
- // Same-chain transaction
19
- return await sendTransactionInternal(config, transaction.chain, transaction.chain, transaction.calls, transaction.gasLimit, transaction.tokenRequests, transaction.signers);
20
- }
21
- else {
22
- // Cross-chain transaction
23
- return await sendTransactionInternal(config, transaction.sourceChain, transaction.targetChain, transaction.calls, transaction.gasLimit, transaction.tokenRequests, transaction.signers);
24
- }
25
- }
26
- async function sendTransactionInternal(config, sourceChain, targetChain, calls, gasLimit, initialTokenRequests, signers) {
27
- if (sourceChain) {
28
- const isAccountDeployed = await (0, accounts_1.isDeployed)(sourceChain, config);
29
- if (!isAccountDeployed) {
30
- await (0, accounts_1.deploySource)(sourceChain, config);
31
- }
32
- }
33
- const accountAddress = (0, accounts_1.getAddress)(config);
34
- // Across requires passing some value to repay the solvers
35
- const tokenRequests = initialTokenRequests.length === 0
36
- ? [
37
- {
38
- address: viem_1.zeroAddress,
39
- amount: 1n,
40
- },
41
- ]
42
- : initialTokenRequests;
43
- const asUserOp = signers?.type === 'guardians' || signers?.type === 'session';
44
- if (asUserOp) {
45
- if (!sourceChain) {
46
- throw new Error(`Specifying source chain is required when using smart sessions or guardians`);
47
- }
48
- const withSession = signers?.type === 'session' ? signers.session : null;
49
- if (withSession) {
50
- await (0, smart_session_1.enableSmartSession)(sourceChain, config, withSession);
51
- }
52
- // Smart sessions require a UserOp flow
53
- return await sendTransactionAsUserOp(config, sourceChain, targetChain, calls, gasLimit, tokenRequests, accountAddress, signers);
54
- }
55
- else {
56
- return await sendTransactionAsIntent(config, sourceChain, targetChain, calls, gasLimit, tokenRequests, accountAddress, signers);
57
- }
58
- }
59
- async function sendTransactionAsUserOp(config, sourceChain, targetChain, calls, gasLimit, tokenRequests, accountAddress, signers) {
60
- const withSession = signers?.type === 'session' ? signers.session : null;
61
- const publicClient = (0, viem_1.createPublicClient)({
62
- chain: sourceChain,
63
- transport: (0, viem_1.http)(),
64
- });
65
- const validatorAccount = await (0, utils_2.getValidatorAccount)(config, signers, publicClient, sourceChain);
66
- if (!validatorAccount) {
67
- throw new Error('No validator account found');
68
- }
69
- const bundlerClient = (0, utils_1.getBundlerClient)(config, publicClient);
70
- if (sourceChain.id === targetChain.id) {
71
- if (withSession) {
72
- await (0, smart_session_1.enableSmartSession)(targetChain, config, withSession);
73
- }
74
- const hash = await bundlerClient.sendUserOperation({
75
- account: validatorAccount,
76
- calls,
77
- });
78
- return {
79
- type: 'userop',
80
- hash,
81
- sourceChain: sourceChain.id,
82
- targetChain: targetChain.id,
83
- };
84
- }
85
- const orderPath = await (0, utils_2.getUserOpOrderPath)(sourceChain, targetChain, tokenRequests, accountAddress, gasLimit, config.rhinestoneApiKey);
86
- // Deploy the account on the target chain
87
- await (0, accounts_1.deployTarget)(targetChain, config, true);
88
- if (withSession) {
89
- await (0, smart_session_1.enableSmartSession)(targetChain, config, withSession);
90
- }
91
- const userOp = await (0, utils_2.getUserOp)(config, targetChain, signers, orderPath, calls, tokenRequests, accountAddress);
92
- const signature = await (0, utils_2.signUserOp)(config, sourceChain, targetChain, accountAddress, signers, userOp, orderPath);
93
- return await (0, utils_2.submitUserOp)(config, sourceChain, targetChain, userOp, signature, orderPath);
94
- }
95
- async function sendTransactionAsIntent(config, sourceChain, targetChain, calls, gasLimit, tokenRequests, accountAddress, signers) {
96
- const { orderPath, hash: orderBundleHash } = await (0, utils_2.prepareTransactionAsIntent)(config, sourceChain, targetChain, calls, gasLimit, tokenRequests, accountAddress);
97
- if (!orderPath) {
98
- throw new Error('Order path is required when using intents');
99
- }
100
- const signature = await (0, utils_2.signIntent)(config, sourceChain, targetChain, orderBundleHash, signers);
101
- return await (0, utils_2.submitIntentInternal)(config, sourceChain, targetChain, orderPath, signature, true);
102
- }
103
- async function waitForExecution(config, result, acceptsPreconfirmations) {
104
- const validStatuses = new Set([
105
- orchestrator_1.BUNDLE_STATUS_FAILED,
106
- orchestrator_1.BUNDLE_STATUS_COMPLETED,
107
- orchestrator_1.BUNDLE_STATUS_FILLED,
108
- ]);
109
- if (acceptsPreconfirmations) {
110
- validStatuses.add(orchestrator_1.BUNDLE_STATUS_PRECONFIRMED);
111
- }
112
- switch (result.type) {
113
- case 'bundle': {
114
- let bundleResult = null;
115
- while (bundleResult === null || !validStatuses.has(bundleResult.status)) {
116
- const orchestrator = (0, utils_2.getOrchestratorByChain)(result.targetChain, config.rhinestoneApiKey);
117
- bundleResult = await orchestrator.getBundleStatus(result.id);
118
- await new Promise((resolve) => setTimeout(resolve, POLLING_INTERVAL));
119
- }
120
- if (bundleResult.status === orchestrator_1.BUNDLE_STATUS_FAILED) {
121
- throw new Error('Bundle failed');
122
- }
123
- return bundleResult;
124
- }
125
- case 'userop': {
126
- const targetChain = (0, registry_1.getChainById)(result.targetChain);
127
- const publicClient = (0, viem_1.createPublicClient)({
128
- chain: targetChain,
129
- transport: (0, viem_1.http)(),
130
- });
131
- const bundlerClient = (0, utils_1.getBundlerClient)(config, publicClient);
132
- const receipt = await bundlerClient.waitForUserOperationReceipt({
133
- hash: result.hash,
134
- });
135
- return receipt;
136
- }
137
- }
138
- }
139
- async function getMaxSpendableAmount(config, chain, tokenAddress, gasUnits) {
140
- const address = (0, accounts_1.getAddress)(config);
141
- const orchestrator = (0, utils_2.getOrchestratorByChain)(chain.id, config.rhinestoneApiKey);
142
- return orchestrator.getMaxTokenAmount(address, chain.id, tokenAddress, gasUnits);
143
- }
144
- async function getPortfolio(config, onTestnets) {
145
- const address = (0, accounts_1.getAddress)(config);
146
- const chainId = onTestnets ? chains_1.sepolia.id : chains_1.mainnet.id;
147
- const orchestrator = (0, utils_2.getOrchestratorByChain)(chainId, config.rhinestoneApiKey);
148
- return orchestrator.getPortfolio(address);
149
- }
@@ -1,23 +0,0 @@
1
- import { type Address, type Chain, type Hex } from 'viem';
2
- import { ChainDigest, EnableSessionData, SmartSessionModeType } from '../modules/validators/smart-sessions';
3
- import type { OrderPath } from '../orchestrator';
4
- import type { RhinestoneAccountConfig, Session } from '../types';
5
- interface SessionDetails {
6
- permissionEnableHash: Hex;
7
- mode: SmartSessionModeType;
8
- hashesAndChainIds: ChainDigest[];
9
- enableSessionData: EnableSessionData;
10
- }
11
- declare function getSessionDetails(config: RhinestoneAccountConfig, sessions: Session[], sessionIndex: number, signature?: Hex): Promise<SessionDetails>;
12
- declare function getMultichainDigest(chainDigests: ChainDigest[]): Hex;
13
- declare function enableSmartSession(chain: Chain, config: RhinestoneAccountConfig, session: Session): Promise<void>;
14
- declare function hashErc7739(sourceChain: Chain, orderPath: OrderPath, accountAddress: Address): Promise<{
15
- hash: `0x${string}`;
16
- appDomainSeparator: `0x${string}`;
17
- contentsType: string;
18
- structHash: `0x${string}`;
19
- }>;
20
- declare function getSessionSignature(signature: Hex, appDomainSeparator: Hex, structHash: Hex, contentsType: string, withSession: Session): `0x${string}`;
21
- export { enableSmartSession, hashErc7739, getSessionSignature, getSessionDetails, getMultichainDigest, };
22
- export type { SessionDetails };
23
- //# sourceMappingURL=smart-session.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"smart-session.d.ts","sourceRoot":"","sources":["../../execution/smart-session.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,OAAO,EACZ,KAAK,KAAK,EAKV,KAAK,GAAG,EAIT,MAAM,MAAM,CAAA;AAkBb,OAAO,EACL,WAAW,EAEX,iBAAiB,EAGjB,oBAAoB,EACrB,MAAM,sCAAsC,CAAA;AAC7C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAEhD,OAAO,KAAK,EAAe,uBAAuB,EAAE,OAAO,EAAE,MAAM,UAAU,CAAA;AAE7E,UAAU,cAAc;IACtB,oBAAoB,EAAE,GAAG,CAAA;IACzB,IAAI,EAAE,oBAAoB,CAAA;IAC1B,iBAAiB,EAAE,WAAW,EAAE,CAAA;IAChC,iBAAiB,EAAE,iBAAiB,CAAA;CACrC;AAED,iBAAe,iBAAiB,CAC9B,MAAM,EAAE,uBAAuB,EAC/B,QAAQ,EAAE,OAAO,EAAE,EACnB,YAAY,EAAE,MAAM,EACpB,SAAS,CAAC,EAAE,GAAG,GACd,OAAO,CAAC,cAAc,CAAC,CA2BzB;AA2FD,iBAAS,mBAAmB,CAAC,YAAY,EAAE,WAAW,EAAE,GAAG,GAAG,CAgC7D;AAiLD,iBAAe,kBAAkB,CAC/B,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,uBAAuB,EAC/B,OAAO,EAAE,OAAO,iBAiCjB;AAED,iBAAe,WAAW,CACxB,WAAW,EAAE,KAAK,EAClB,SAAS,EAAE,SAAS,EACpB,cAAc,EAAE,OAAO;;;;;GAiExB;AAED,iBAAS,mBAAmB,CAC1B,SAAS,EAAE,GAAG,EACd,kBAAkB,EAAE,GAAG,EACvB,UAAU,EAAE,GAAG,EACf,YAAY,EAAE,MAAM,EACpB,WAAW,EAAE,OAAO,iBAkBrB;AAED,OAAO,EACL,kBAAkB,EAClB,WAAW,EACX,mBAAmB,EACnB,iBAAiB,EACjB,mBAAmB,GACpB,CAAA;AACD,YAAY,EAAE,cAAc,EAAE,CAAA"}
@@ -1,68 +0,0 @@
1
- import { Address, Chain, Hex } from 'viem';
2
- import { UserOperation } from 'viem/account-abstraction';
3
- import { OrderPath } from '../orchestrator/types';
4
- import { Call, RhinestoneAccountConfig, SignerSet, TokenRequest, Transaction } from '../types';
5
- type TransactionResult = {
6
- type: 'userop';
7
- hash: Hex;
8
- sourceChain: number;
9
- targetChain: number;
10
- } | {
11
- type: 'bundle';
12
- id: bigint;
13
- sourceChain?: number;
14
- targetChain: number;
15
- };
16
- interface BundleData {
17
- hash: Hex;
18
- orderPath?: OrderPath;
19
- userOp?: UserOperation;
20
- }
21
- interface PreparedTransactionData {
22
- bundleData: BundleData;
23
- transaction: Transaction;
24
- }
25
- interface SignedTransactionData extends PreparedTransactionData {
26
- signature: Hex;
27
- }
28
- declare function prepareTransaction(config: RhinestoneAccountConfig, transaction: Transaction): Promise<PreparedTransactionData>;
29
- declare function signTransaction(config: RhinestoneAccountConfig, preparedTransaction: PreparedTransactionData): Promise<SignedTransactionData>;
30
- declare function submitTransaction(config: RhinestoneAccountConfig, signedTransaction: SignedTransactionData): Promise<TransactionResult>;
31
- declare function prepareTransactionAsIntent(config: RhinestoneAccountConfig, sourceChain: Chain | undefined, targetChain: Chain, calls: Call[], gasLimit: bigint | undefined, tokenRequests: TokenRequest[], accountAddress: Address): Promise<BundleData>;
32
- declare function signIntent(config: RhinestoneAccountConfig, sourceChain: Chain | undefined, targetChain: Chain, bundleHash: Hex, signers?: SignerSet): Promise<`0x${string}`>;
33
- declare function signUserOp(config: RhinestoneAccountConfig, sourceChain: Chain, targetChain: Chain, accountAddress: Address, signers: SignerSet | undefined, userOp: UserOperation, orderPath?: OrderPath): Promise<`0x${string}`>;
34
- declare function submitUserOp(config: RhinestoneAccountConfig, sourceChain: Chain, targetChain: Chain, userOp: UserOperation, signature: Hex, orderPath?: OrderPath): Promise<TransactionResult>;
35
- declare function getOrchestratorByChain(chainId: number, apiKey: string): import("../orchestrator").Orchestrator;
36
- declare function getUserOpOrderPath(sourceChain: Chain, targetChain: Chain, tokenRequests: TokenRequest[], accountAddress: Address, gasLimit: bigint | undefined, rhinestoneApiKey: string): Promise<OrderPath>;
37
- declare function getUserOp(config: RhinestoneAccountConfig, targetChain: Chain, signers: SignerSet | undefined, orderPath: OrderPath, calls: Call[], tokenRequests: TokenRequest[], accountAddress: Address): Promise<{
38
- readonly account: import("viem/account-abstraction").SmartAccount<import("viem/account-abstraction").SmartAccountImplementation<import("viem").Abi, "0.7">>;
39
- readonly stateOverride: {
40
- address: `0x${string}`;
41
- stateDiff: {
42
- slot: `0x${string}`;
43
- value: `0x${string}`;
44
- }[];
45
- }[];
46
- callData: Hex;
47
- paymasterAndData: undefined;
48
- sender: UserOperation["sender"];
49
- authorization: UserOperation["authorization"];
50
- factory: UserOperation["factory"];
51
- factoryData: UserOperation["factoryData"];
52
- nonce: UserOperation["nonce"];
53
- maxFeePerGas: UserOperation["maxFeePerGas"];
54
- maxPriorityFeePerGas: UserOperation["maxPriorityFeePerGas"];
55
- callGasLimit: UserOperation["callGasLimit"];
56
- preVerificationGas: UserOperation["preVerificationGas"];
57
- verificationGasLimit: UserOperation["verificationGasLimit"];
58
- paymasterPostOpGasLimit: UserOperation["paymasterPostOpGasLimit"];
59
- paymasterVerificationGasLimit: UserOperation["paymasterVerificationGasLimit"];
60
- paymaster: UserOperation["paymaster"];
61
- paymasterData: UserOperation["paymasterData"];
62
- signature: UserOperation["signature"];
63
- }>;
64
- declare function submitIntentInternal(config: RhinestoneAccountConfig, sourceChain: Chain | undefined, targetChain: Chain, orderPath: OrderPath, signature: Hex, deploy: boolean): Promise<TransactionResult>;
65
- declare function getValidatorAccount(config: RhinestoneAccountConfig, signers: SignerSet | undefined, publicClient: any, chain: Chain): Promise<import("viem/account-abstraction").SmartAccount<import("viem/account-abstraction").SmartAccountImplementation<import("viem").Abi, "0.7">> | null | undefined>;
66
- export { prepareTransaction, signTransaction, submitTransaction, getOrchestratorByChain, getUserOpOrderPath, getUserOp, signIntent, signUserOp, submitUserOp, prepareTransactionAsIntent, submitIntentInternal, getValidatorAccount, };
67
- export type { BundleData, TransactionResult, PreparedTransactionData, SignedTransactionData, };
68
- //# sourceMappingURL=utils.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../execution/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EACP,KAAK,EAGL,GAAG,EAOJ,MAAM,MAAM,CAAA;AACb,OAAO,EAGL,aAAa,EACd,MAAM,0BAA0B,CAAA;AA6BjC,OAAO,EAEL,SAAS,EAGV,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EACL,IAAI,EAGJ,uBAAuB,EACvB,SAAS,EACT,YAAY,EACZ,WAAW,EACZ,MAAM,UAAU,CAAA;AAGjB,KAAK,iBAAiB,GAClB;IACE,IAAI,EAAE,QAAQ,CAAA;IACd,IAAI,EAAE,GAAG,CAAA;IACT,WAAW,EAAE,MAAM,CAAA;IACnB,WAAW,EAAE,MAAM,CAAA;CACpB,GACD;IACE,IAAI,EAAE,QAAQ,CAAA;IACd,EAAE,EAAE,MAAM,CAAA;IACV,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,WAAW,EAAE,MAAM,CAAA;CACpB,CAAA;AAEL,UAAU,UAAU;IAClB,IAAI,EAAE,GAAG,CAAA;IACT,SAAS,CAAC,EAAE,SAAS,CAAA;IACrB,MAAM,CAAC,EAAE,aAAa,CAAA;CACvB;AAED,UAAU,uBAAuB;IAC/B,UAAU,EAAE,UAAU,CAAA;IACtB,WAAW,EAAE,WAAW,CAAA;CACzB;AAED,UAAU,qBAAsB,SAAQ,uBAAuB;IAC7D,SAAS,EAAE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