@rhinestone/sdk 2.0.0-beta.0 → 2.0.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/src/accounts/json-rpc/providers.d.ts.map +1 -1
- package/dist/src/accounts/json-rpc/providers.js +3 -2
- package/dist/src/errors/index.d.ts +3 -3
- package/dist/src/errors/index.d.ts.map +1 -1
- package/dist/src/errors/index.js +6 -4
- package/dist/src/execution/compact.d.ts +1 -144
- package/dist/src/execution/compact.d.ts.map +1 -1
- package/dist/src/execution/compact.js +1 -109
- package/dist/src/execution/error.d.ts +10 -1
- package/dist/src/execution/error.d.ts.map +1 -1
- package/dist/src/execution/error.js +9 -1
- package/dist/src/execution/index.d.ts +3 -4
- package/dist/src/execution/index.d.ts.map +1 -1
- package/dist/src/execution/index.js +21 -17
- package/dist/src/execution/permit2.d.ts +1 -137
- package/dist/src/execution/permit2.d.ts.map +1 -1
- package/dist/src/execution/permit2.js +2 -231
- package/dist/src/execution/utils.d.ts +28 -12
- package/dist/src/execution/utils.d.ts.map +1 -1
- package/dist/src/execution/utils.js +167 -117
- package/dist/src/index.d.ts +9 -8
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +8 -8
- package/dist/src/modules/validators/smart-sessions.d.ts.map +1 -1
- package/dist/src/modules/validators/smart-sessions.js +3 -5
- package/dist/src/orchestrator/caip2.d.ts +7 -0
- package/dist/src/orchestrator/caip2.d.ts.map +1 -0
- package/dist/src/orchestrator/caip2.js +17 -0
- package/dist/src/orchestrator/client.d.ts +11 -11
- package/dist/src/orchestrator/client.d.ts.map +1 -1
- package/dist/src/orchestrator/client.js +193 -295
- package/dist/src/orchestrator/consts.d.ts +2 -2
- package/dist/src/orchestrator/consts.d.ts.map +1 -1
- package/dist/src/orchestrator/consts.js +2 -2
- package/dist/src/orchestrator/error.d.ts +72 -217
- package/dist/src/orchestrator/error.d.ts.map +1 -1
- package/dist/src/orchestrator/error.js +117 -195
- package/dist/src/orchestrator/index.d.ts +4 -4
- package/dist/src/orchestrator/index.d.ts.map +1 -1
- package/dist/src/orchestrator/index.js +2 -2
- package/dist/src/orchestrator/types.d.ts +97 -232
- package/dist/src/orchestrator/types.d.ts.map +1 -1
- package/dist/src/types.d.ts +2 -4
- package/dist/src/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/src/execution/singleChainOps.d.ts +0 -41
- package/dist/src/execution/singleChainOps.d.ts.map +0 -1
- package/dist/src/execution/singleChainOps.js +0 -42
- package/dist/src/execution/types.d.ts +0 -36
- package/dist/src/execution/types.d.ts.map +0 -1
- package/dist/src/execution/types.js +0 -1
package/README.md
CHANGED
|
@@ -162,7 +162,7 @@ For a complete walkthrough, see the [Quickstart guide](https://docs.rhinestone.d
|
|
|
162
162
|
|
|
163
163
|
## Migrating from Orchestrator SDK
|
|
164
164
|
|
|
165
|
-
To migrate from the [Orchestrator SDK](https://github.com/rhinestonewtf/orchestrator-sdk), replace all imports of `@rhinestone/orchestrator-sdk` with `@rhinestone/sdk
|
|
165
|
+
To migrate from the [Orchestrator SDK](https://github.com/rhinestonewtf/orchestrator-sdk), replace all imports of `@rhinestone/orchestrator-sdk` with `@rhinestone/sdk`.
|
|
166
166
|
|
|
167
167
|
Let us know if you encounter any issues!
|
|
168
168
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"providers.d.ts","sourceRoot":"","sources":["../../../../accounts/json-rpc/providers.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AAExD,iBAAS,aAAa,CAAC,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,
|
|
1
|
+
{"version":3,"file":"providers.d.ts","sourceRoot":"","sources":["../../../../accounts/json-rpc/providers.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AAExD,iBAAS,aAAa,CAAC,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAYtE;AAED,iBAAS,YAAY,CACnB,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC3B,MAAM,GAAG,SAAS,CAEpB;AAED,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,CAAA"}
|
|
@@ -5,9 +5,10 @@ function getAlchemyUrl(chainId, apiKey) {
|
|
|
5
5
|
if (!chainParam) {
|
|
6
6
|
throw new Error(`Unsupported chain: ${chainId}`);
|
|
7
7
|
}
|
|
8
|
-
return urlTemplate
|
|
8
|
+
return (urlTemplate
|
|
9
9
|
.replace('{{chain_param}}', chainParam)
|
|
10
|
-
|
|
10
|
+
// biome-ignore lint/suspicious/noTemplateCurlyInString: literal placeholder token in the upstream shared-configs url_template
|
|
11
|
+
.replace('${ALCHEMY_API_KEY}', apiKey));
|
|
11
12
|
}
|
|
12
13
|
function getCustomUrl(chainId, urls) {
|
|
13
14
|
return urls[chainId];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AccountConfigurationNotSupportedError, AccountError, Eip712DomainNotAvailableError, Eip7702AccountMustHaveEoaError, Eip7702NotSupportedForAccountError, EoaAccountMustHaveAccountError, ExistingEip7702AccountsNotSupportedError, FactoryArgsNotAvailableError, isAccountError, SigningNotSupportedForAccountError, SmartSessionsNotEnabledError, WalletClientNoConnectedAccountError } from '../accounts/index.js';
|
|
2
|
-
import { ExecutionError, IntentFailedError, isExecutionError, OrderPathRequiredForIntentsError, SessionChainRequiredError, SignerNotSupportedError } from '../execution/index.js';
|
|
3
|
-
import {
|
|
4
|
-
export { isAccountError, AccountError, AccountConfigurationNotSupportedError, Eip712DomainNotAvailableError, Eip7702AccountMustHaveEoaError, EoaAccountMustHaveAccountError, ExistingEip7702AccountsNotSupportedError, FactoryArgsNotAvailableError, SmartSessionsNotEnabledError, SigningNotSupportedForAccountError, Eip7702NotSupportedForAccountError, WalletClientNoConnectedAccountError, isExecutionError, ExecutionError, IntentFailedError, OrderPathRequiredForIntentsError, SessionChainRequiredError, SignerNotSupportedError, isOrchestratorError, isRetryable, isAuthError, isValidationError, isRateLimited,
|
|
2
|
+
import { ExecutionError, IntentFailedError, isExecutionError, OrderPathRequiredForIntentsError, QuoteNotInPreparedTransactionError, SessionChainRequiredError, SignerNotSupportedError } from '../execution/index.js';
|
|
3
|
+
import { ConflictError, ExternalServiceTimeoutError, ForbiddenError, InsufficientLiquidityError, InternalServerError, isAuthError, isOrchestratorError, isRateLimited, isRetryable, isValidationError, NotFoundError, OrchestratorError, RateLimitedError, RelayerMarketUnavailableError, SettlementExecutionError, SettlementQuoteError, UnauthorizedError, UnprocessableContentError, UnsupportedChainError, UnsupportedTokenError, ValidationError } from '../orchestrator/index.js';
|
|
4
|
+
export { isAccountError, AccountError, AccountConfigurationNotSupportedError, Eip712DomainNotAvailableError, Eip7702AccountMustHaveEoaError, EoaAccountMustHaveAccountError, ExistingEip7702AccountsNotSupportedError, FactoryArgsNotAvailableError, SmartSessionsNotEnabledError, SigningNotSupportedForAccountError, Eip7702NotSupportedForAccountError, WalletClientNoConnectedAccountError, isExecutionError, ExecutionError, IntentFailedError, OrderPathRequiredForIntentsError, QuoteNotInPreparedTransactionError, SessionChainRequiredError, SignerNotSupportedError, isOrchestratorError, isRetryable, isAuthError, isValidationError, isRateLimited, ConflictError, ExternalServiceTimeoutError, ForbiddenError, InsufficientLiquidityError, InternalServerError, NotFoundError, OrchestratorError, RateLimitedError, RelayerMarketUnavailableError, SettlementExecutionError, SettlementQuoteError, UnauthorizedError, UnprocessableContentError, ValidationError, UnsupportedChainError, UnsupportedTokenError, };
|
|
5
5
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../errors/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qCAAqC,EACrC,YAAY,EACZ,6BAA6B,EAC7B,8BAA8B,EAC9B,kCAAkC,EAClC,8BAA8B,EAC9B,wCAAwC,EACxC,4BAA4B,EAC5B,cAAc,EACd,kCAAkC,EAClC,4BAA4B,EAC5B,mCAAmC,EACpC,MAAM,aAAa,CAAA;AACpB,OAAO,EACL,cAAc,EACd,iBAAiB,EACjB,gBAAgB,EAChB,gCAAgC,EAChC,yBAAyB,EACzB,uBAAuB,EACxB,MAAM,cAAc,CAAA;AACrB,OAAO,EACL,2BAA2B,EAC3B,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../errors/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qCAAqC,EACrC,YAAY,EACZ,6BAA6B,EAC7B,8BAA8B,EAC9B,kCAAkC,EAClC,8BAA8B,EAC9B,wCAAwC,EACxC,4BAA4B,EAC5B,cAAc,EACd,kCAAkC,EAClC,4BAA4B,EAC5B,mCAAmC,EACpC,MAAM,aAAa,CAAA;AACpB,OAAO,EACL,cAAc,EACd,iBAAiB,EACjB,gBAAgB,EAChB,gCAAgC,EAChC,kCAAkC,EAClC,yBAAyB,EACzB,uBAAuB,EACxB,MAAM,cAAc,CAAA;AACrB,OAAO,EACL,aAAa,EACb,2BAA2B,EAC3B,cAAc,EACd,0BAA0B,EAC1B,mBAAmB,EACnB,WAAW,EACX,mBAAmB,EACnB,aAAa,EACb,WAAW,EACX,iBAAiB,EACjB,aAAa,EACb,iBAAiB,EACjB,gBAAgB,EAChB,6BAA6B,EAC7B,wBAAwB,EACxB,oBAAoB,EACpB,iBAAiB,EACjB,yBAAyB,EACzB,qBAAqB,EACrB,qBAAqB,EACrB,eAAe,EAChB,MAAM,iBAAiB,CAAA;AAExB,OAAO,EAEL,cAAc,EACd,YAAY,EACZ,qCAAqC,EACrC,6BAA6B,EAC7B,8BAA8B,EAC9B,8BAA8B,EAC9B,wCAAwC,EACxC,4BAA4B,EAC5B,4BAA4B,EAC5B,kCAAkC,EAClC,kCAAkC,EAClC,mCAAmC,EAEnC,gBAAgB,EAChB,cAAc,EACd,iBAAiB,EACjB,gCAAgC,EAChC,kCAAkC,EAClC,yBAAyB,EACzB,uBAAuB,EAEvB,mBAAmB,EACnB,WAAW,EACX,WAAW,EACX,iBAAiB,EACjB,aAAa,EACb,aAAa,EACb,2BAA2B,EAC3B,cAAc,EACd,0BAA0B,EAC1B,mBAAmB,EACnB,aAAa,EACb,iBAAiB,EACjB,gBAAgB,EAChB,6BAA6B,EAC7B,wBAAwB,EACxB,oBAAoB,EACpB,iBAAiB,EACjB,yBAAyB,EACzB,eAAe,EAEf,qBAAqB,EACrB,qBAAqB,GACtB,CAAA"}
|
package/dist/src/errors/index.js
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { AccountConfigurationNotSupportedError, AccountError, Eip712DomainNotAvailableError, Eip7702AccountMustHaveEoaError, Eip7702NotSupportedForAccountError, EoaAccountMustHaveAccountError, ExistingEip7702AccountsNotSupportedError, FactoryArgsNotAvailableError, isAccountError, SigningNotSupportedForAccountError, SmartSessionsNotEnabledError, WalletClientNoConnectedAccountError, } from '../accounts/index.js';
|
|
2
|
-
import { ExecutionError, IntentFailedError, isExecutionError, OrderPathRequiredForIntentsError, SessionChainRequiredError, SignerNotSupportedError, } from '../execution/index.js';
|
|
3
|
-
import {
|
|
2
|
+
import { ExecutionError, IntentFailedError, isExecutionError, OrderPathRequiredForIntentsError, QuoteNotInPreparedTransactionError, SessionChainRequiredError, SignerNotSupportedError, } from '../execution/index.js';
|
|
3
|
+
import { ConflictError, ExternalServiceTimeoutError, ForbiddenError, InsufficientLiquidityError, InternalServerError, isAuthError, isOrchestratorError, isRateLimited, isRetryable, isValidationError, NotFoundError, OrchestratorError, RateLimitedError, RelayerMarketUnavailableError, SettlementExecutionError, SettlementQuoteError, UnauthorizedError, UnprocessableContentError, UnsupportedChainError, UnsupportedTokenError, ValidationError, } from '../orchestrator/index.js';
|
|
4
4
|
export {
|
|
5
5
|
// Account
|
|
6
6
|
isAccountError, AccountError, AccountConfigurationNotSupportedError, Eip712DomainNotAvailableError, Eip7702AccountMustHaveEoaError, EoaAccountMustHaveAccountError, ExistingEip7702AccountsNotSupportedError, FactoryArgsNotAvailableError, SmartSessionsNotEnabledError, SigningNotSupportedForAccountError, Eip7702NotSupportedForAccountError, WalletClientNoConnectedAccountError,
|
|
7
7
|
// Execution
|
|
8
|
-
isExecutionError, ExecutionError, IntentFailedError, OrderPathRequiredForIntentsError, SessionChainRequiredError, SignerNotSupportedError,
|
|
8
|
+
isExecutionError, ExecutionError, IntentFailedError, OrderPathRequiredForIntentsError, QuoteNotInPreparedTransactionError, SessionChainRequiredError, SignerNotSupportedError,
|
|
9
9
|
// Orchestrator
|
|
10
|
-
isOrchestratorError, isRetryable, isAuthError, isValidationError, isRateLimited,
|
|
10
|
+
isOrchestratorError, isRetryable, isAuthError, isValidationError, isRateLimited, ConflictError, ExternalServiceTimeoutError, ForbiddenError, InsufficientLiquidityError, InternalServerError, NotFoundError, OrchestratorError, RateLimitedError, RelayerMarketUnavailableError, SettlementExecutionError, SettlementQuoteError, UnauthorizedError, UnprocessableContentError, ValidationError,
|
|
11
|
+
// Registry (SDK-local validation)
|
|
12
|
+
UnsupportedChainError, UnsupportedTokenError, };
|
|
@@ -1,148 +1,5 @@
|
|
|
1
|
-
import { type Hex } from 'viem';
|
|
2
|
-
import type { IntentOp, IntentOpElement } from '../orchestrator/types.js';
|
|
3
1
|
declare const SCOPE_MULTICHAIN = 0;
|
|
4
2
|
declare const RESET_PERIOD_ONE_WEEK = 6;
|
|
5
3
|
declare const COMPACT_ADDRESS = "0x00000000000000171ede64904551eeDF3C6C9788";
|
|
6
|
-
|
|
7
|
-
readonly domain: {
|
|
8
|
-
readonly name: "The Compact";
|
|
9
|
-
readonly version: "1";
|
|
10
|
-
readonly chainId: number;
|
|
11
|
-
readonly verifyingContract: "0x73d2dc0c21fca4ec1601895d50df7f5624f07d3f";
|
|
12
|
-
};
|
|
13
|
-
readonly types: {
|
|
14
|
-
readonly MultichainCompact: readonly [{
|
|
15
|
-
readonly name: "sponsor";
|
|
16
|
-
readonly type: "address";
|
|
17
|
-
}, {
|
|
18
|
-
readonly name: "nonce";
|
|
19
|
-
readonly type: "uint256";
|
|
20
|
-
}, {
|
|
21
|
-
readonly name: "expires";
|
|
22
|
-
readonly type: "uint256";
|
|
23
|
-
}, {
|
|
24
|
-
readonly name: "elements";
|
|
25
|
-
readonly type: "Element[]";
|
|
26
|
-
}];
|
|
27
|
-
readonly Element: readonly [{
|
|
28
|
-
readonly name: "arbiter";
|
|
29
|
-
readonly type: "address";
|
|
30
|
-
}, {
|
|
31
|
-
readonly name: "chainId";
|
|
32
|
-
readonly type: "uint256";
|
|
33
|
-
}, {
|
|
34
|
-
readonly name: "commitments";
|
|
35
|
-
readonly type: "Lock[]";
|
|
36
|
-
}, {
|
|
37
|
-
readonly name: "mandate";
|
|
38
|
-
readonly type: "Mandate";
|
|
39
|
-
}];
|
|
40
|
-
readonly Lock: readonly [{
|
|
41
|
-
readonly name: "lockTag";
|
|
42
|
-
readonly type: "bytes12";
|
|
43
|
-
}, {
|
|
44
|
-
readonly name: "token";
|
|
45
|
-
readonly type: "address";
|
|
46
|
-
}, {
|
|
47
|
-
readonly name: "amount";
|
|
48
|
-
readonly type: "uint256";
|
|
49
|
-
}];
|
|
50
|
-
readonly Mandate: readonly [{
|
|
51
|
-
readonly name: "target";
|
|
52
|
-
readonly type: "Target";
|
|
53
|
-
}, {
|
|
54
|
-
readonly name: "minGas";
|
|
55
|
-
readonly type: "uint128";
|
|
56
|
-
}, {
|
|
57
|
-
readonly name: "originOps";
|
|
58
|
-
readonly type: "Op";
|
|
59
|
-
}, {
|
|
60
|
-
readonly name: "destOps";
|
|
61
|
-
readonly type: "Op";
|
|
62
|
-
}, {
|
|
63
|
-
readonly name: "q";
|
|
64
|
-
readonly type: "bytes32";
|
|
65
|
-
}];
|
|
66
|
-
readonly Target: readonly [{
|
|
67
|
-
readonly name: "recipient";
|
|
68
|
-
readonly type: "address";
|
|
69
|
-
}, {
|
|
70
|
-
readonly name: "tokenOut";
|
|
71
|
-
readonly type: "Token[]";
|
|
72
|
-
}, {
|
|
73
|
-
readonly name: "targetChain";
|
|
74
|
-
readonly type: "uint256";
|
|
75
|
-
}, {
|
|
76
|
-
readonly name: "fillExpiry";
|
|
77
|
-
readonly type: "uint256";
|
|
78
|
-
}];
|
|
79
|
-
readonly Token: readonly [{
|
|
80
|
-
readonly name: "token";
|
|
81
|
-
readonly type: "address";
|
|
82
|
-
}, {
|
|
83
|
-
readonly name: "amount";
|
|
84
|
-
readonly type: "uint256";
|
|
85
|
-
}];
|
|
86
|
-
readonly Op: readonly [{
|
|
87
|
-
readonly name: "vt";
|
|
88
|
-
readonly type: "bytes32";
|
|
89
|
-
}, {
|
|
90
|
-
readonly name: "ops";
|
|
91
|
-
readonly type: "Ops[]";
|
|
92
|
-
}];
|
|
93
|
-
readonly Ops: readonly [{
|
|
94
|
-
readonly name: "to";
|
|
95
|
-
readonly type: "address";
|
|
96
|
-
}, {
|
|
97
|
-
readonly name: "value";
|
|
98
|
-
readonly type: "uint256";
|
|
99
|
-
}, {
|
|
100
|
-
readonly name: "data";
|
|
101
|
-
readonly type: "bytes";
|
|
102
|
-
}];
|
|
103
|
-
};
|
|
104
|
-
readonly primaryType: "MultichainCompact";
|
|
105
|
-
readonly message: {
|
|
106
|
-
readonly sponsor: `0x${string}`;
|
|
107
|
-
readonly nonce: bigint;
|
|
108
|
-
readonly expires: bigint;
|
|
109
|
-
readonly elements: {
|
|
110
|
-
arbiter: `0x${string}`;
|
|
111
|
-
chainId: bigint;
|
|
112
|
-
commitments: {
|
|
113
|
-
lockTag: `0x${string}`;
|
|
114
|
-
token: `0x${string}`;
|
|
115
|
-
amount: bigint;
|
|
116
|
-
}[];
|
|
117
|
-
mandate: {
|
|
118
|
-
target: {
|
|
119
|
-
recipient: `0x${string}`;
|
|
120
|
-
tokenOut: {
|
|
121
|
-
token: `0x${string}`;
|
|
122
|
-
amount: bigint;
|
|
123
|
-
}[];
|
|
124
|
-
targetChain: bigint;
|
|
125
|
-
fillExpiry: bigint;
|
|
126
|
-
};
|
|
127
|
-
minGas: bigint;
|
|
128
|
-
originOps: import("../orchestrator/types.js").Op;
|
|
129
|
-
destOps: import("../orchestrator/types.js").Op;
|
|
130
|
-
q: `0x${string}`;
|
|
131
|
-
};
|
|
132
|
-
}[];
|
|
133
|
-
};
|
|
134
|
-
};
|
|
135
|
-
/**
|
|
136
|
-
* Get the compact digest for signing
|
|
137
|
-
* @param intentOp The intent operation
|
|
138
|
-
* @returns The digest hash
|
|
139
|
-
*/
|
|
140
|
-
declare function getCompactDigest(intentOp: IntentOp): Hex;
|
|
141
|
-
/**
|
|
142
|
-
* Get the Permit2 digest for signing
|
|
143
|
-
* @param intentOp The intent operation
|
|
144
|
-
* @returns The digest hash
|
|
145
|
-
*/
|
|
146
|
-
declare function getPermit2Digest(element: IntentOpElement, nonce: bigint, expires: bigint): Hex;
|
|
147
|
-
export { SCOPE_MULTICHAIN, RESET_PERIOD_ONE_WEEK, COMPACT_ADDRESS, getCompactTypedData, getCompactDigest, getPermit2Digest, };
|
|
4
|
+
export { SCOPE_MULTICHAIN, RESET_PERIOD_ONE_WEEK, COMPACT_ADDRESS };
|
|
148
5
|
//# sourceMappingURL=compact.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compact.d.ts","sourceRoot":"","sources":["../../../execution/compact.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"compact.d.ts","sourceRoot":"","sources":["../../../execution/compact.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,gBAAgB,IAAI,CAAA;AAC1B,QAAA,MAAM,qBAAqB,IAAI,CAAA;AAE/B,QAAA,MAAM,eAAe,+CAA+C,CAAA;AAEpE,OAAO,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,eAAe,EAAE,CAAA"}
|
|
@@ -1,112 +1,4 @@
|
|
|
1
|
-
import { hashTypedData, keccak256, slice, toHex } from 'viem';
|
|
2
|
-
import { getTypedData as getPermit2TypedData } from './permit2.js';
|
|
3
1
|
const SCOPE_MULTICHAIN = 0;
|
|
4
2
|
const RESET_PERIOD_ONE_WEEK = 6;
|
|
5
3
|
const COMPACT_ADDRESS = '0x00000000000000171ede64904551eeDF3C6C9788';
|
|
6
|
-
|
|
7
|
-
const COMPACT_TYPED_DATA_TYPES = {
|
|
8
|
-
MultichainCompact: [
|
|
9
|
-
{ name: 'sponsor', type: 'address' },
|
|
10
|
-
{ name: 'nonce', type: 'uint256' },
|
|
11
|
-
{ name: 'expires', type: 'uint256' },
|
|
12
|
-
{ name: 'elements', type: 'Element[]' },
|
|
13
|
-
],
|
|
14
|
-
Element: [
|
|
15
|
-
{ name: 'arbiter', type: 'address' },
|
|
16
|
-
{ name: 'chainId', type: 'uint256' },
|
|
17
|
-
{ name: 'commitments', type: 'Lock[]' },
|
|
18
|
-
{ name: 'mandate', type: 'Mandate' },
|
|
19
|
-
],
|
|
20
|
-
Lock: [
|
|
21
|
-
{ name: 'lockTag', type: 'bytes12' },
|
|
22
|
-
{ name: 'token', type: 'address' },
|
|
23
|
-
{ name: 'amount', type: 'uint256' },
|
|
24
|
-
],
|
|
25
|
-
Mandate: [
|
|
26
|
-
{ name: 'target', type: 'Target' },
|
|
27
|
-
{ name: 'minGas', type: 'uint128' },
|
|
28
|
-
{ name: 'originOps', type: 'Op' },
|
|
29
|
-
{ name: 'destOps', type: 'Op' },
|
|
30
|
-
{ name: 'q', type: 'bytes32' },
|
|
31
|
-
],
|
|
32
|
-
Target: [
|
|
33
|
-
{ name: 'recipient', type: 'address' },
|
|
34
|
-
{ name: 'tokenOut', type: 'Token[]' },
|
|
35
|
-
{ name: 'targetChain', type: 'uint256' },
|
|
36
|
-
{ name: 'fillExpiry', type: 'uint256' },
|
|
37
|
-
],
|
|
38
|
-
Token: [
|
|
39
|
-
{ name: 'token', type: 'address' },
|
|
40
|
-
{ name: 'amount', type: 'uint256' },
|
|
41
|
-
],
|
|
42
|
-
Op: [
|
|
43
|
-
{ name: 'vt', type: 'bytes32' },
|
|
44
|
-
{ name: 'ops', type: 'Ops[]' },
|
|
45
|
-
],
|
|
46
|
-
Ops: [
|
|
47
|
-
{ name: 'to', type: 'address' },
|
|
48
|
-
{ name: 'value', type: 'uint256' },
|
|
49
|
-
{ name: 'data', type: 'bytes' },
|
|
50
|
-
],
|
|
51
|
-
};
|
|
52
|
-
function getCompactTypedData(intentOp) {
|
|
53
|
-
const typedData = {
|
|
54
|
-
domain: {
|
|
55
|
-
name: 'The Compact',
|
|
56
|
-
version: '1',
|
|
57
|
-
chainId: Number(intentOp.elements[0].chainId),
|
|
58
|
-
verifyingContract: '0x73d2dc0c21fca4ec1601895d50df7f5624f07d3f',
|
|
59
|
-
},
|
|
60
|
-
types: COMPACT_TYPED_DATA_TYPES,
|
|
61
|
-
primaryType: 'MultichainCompact',
|
|
62
|
-
message: {
|
|
63
|
-
sponsor: intentOp.sponsor,
|
|
64
|
-
nonce: BigInt(intentOp.nonce),
|
|
65
|
-
expires: BigInt(intentOp.expires),
|
|
66
|
-
elements: intentOp.elements.map((element) => ({
|
|
67
|
-
arbiter: element.arbiter,
|
|
68
|
-
chainId: BigInt(element.chainId),
|
|
69
|
-
commitments: element.idsAndAmounts.map((token) => ({
|
|
70
|
-
lockTag: slice(toHex(BigInt(token[0])), 0, 12),
|
|
71
|
-
token: slice(toHex(BigInt(token[0])), 12, 32),
|
|
72
|
-
amount: BigInt(token[1]),
|
|
73
|
-
})),
|
|
74
|
-
mandate: {
|
|
75
|
-
target: {
|
|
76
|
-
recipient: element.mandate.recipient,
|
|
77
|
-
tokenOut: element.mandate.tokenOut.map((token) => ({
|
|
78
|
-
token: slice(toHex(BigInt(token[0])), 12, 32),
|
|
79
|
-
amount: BigInt(token[1]),
|
|
80
|
-
})),
|
|
81
|
-
targetChain: BigInt(element.mandate.destinationChainId),
|
|
82
|
-
fillExpiry: BigInt(element.mandate.fillDeadline),
|
|
83
|
-
},
|
|
84
|
-
minGas: BigInt(element.mandate.minGas),
|
|
85
|
-
originOps: element.mandate.preClaimOps,
|
|
86
|
-
destOps: element.mandate.destinationOps,
|
|
87
|
-
q: keccak256(element.mandate.qualifier.encodedVal),
|
|
88
|
-
},
|
|
89
|
-
})),
|
|
90
|
-
},
|
|
91
|
-
};
|
|
92
|
-
return typedData;
|
|
93
|
-
}
|
|
94
|
-
/**
|
|
95
|
-
* Get the compact digest for signing
|
|
96
|
-
* @param intentOp The intent operation
|
|
97
|
-
* @returns The digest hash
|
|
98
|
-
*/
|
|
99
|
-
function getCompactDigest(intentOp) {
|
|
100
|
-
const typedData = getCompactTypedData(intentOp);
|
|
101
|
-
return hashTypedData(typedData);
|
|
102
|
-
}
|
|
103
|
-
/**
|
|
104
|
-
* Get the Permit2 digest for signing
|
|
105
|
-
* @param intentOp The intent operation
|
|
106
|
-
* @returns The digest hash
|
|
107
|
-
*/
|
|
108
|
-
function getPermit2Digest(element, nonce, expires) {
|
|
109
|
-
const typedData = getPermit2TypedData(element, nonce, expires);
|
|
110
|
-
return hashTypedData(typedData);
|
|
111
|
-
}
|
|
112
|
-
export { SCOPE_MULTICHAIN, RESET_PERIOD_ONE_WEEK, COMPACT_ADDRESS, getCompactTypedData, getCompactDigest, getPermit2Digest, };
|
|
4
|
+
export { SCOPE_MULTICHAIN, RESET_PERIOD_ONE_WEEK, COMPACT_ADDRESS };
|
|
@@ -50,6 +50,15 @@ declare class IntentStatusTimeoutError extends ExecutionError {
|
|
|
50
50
|
traceId?: string;
|
|
51
51
|
});
|
|
52
52
|
}
|
|
53
|
+
declare class QuoteNotInPreparedTransactionError extends ExecutionError {
|
|
54
|
+
constructor(params?: {
|
|
55
|
+
context?: {
|
|
56
|
+
intentId?: string;
|
|
57
|
+
};
|
|
58
|
+
errorType?: string;
|
|
59
|
+
traceId?: string;
|
|
60
|
+
});
|
|
61
|
+
}
|
|
53
62
|
declare class Eip7702InitSignatureRequiredError extends ExecutionError {
|
|
54
63
|
constructor(params?: {
|
|
55
64
|
context?: any;
|
|
@@ -58,5 +67,5 @@ declare class Eip7702InitSignatureRequiredError extends ExecutionError {
|
|
|
58
67
|
});
|
|
59
68
|
}
|
|
60
69
|
declare function isExecutionError(error: Error): error is ExecutionError;
|
|
61
|
-
export { isExecutionError, ExecutionError, Eip7702InitSignatureRequiredError, OrderPathRequiredForIntentsError, SessionChainRequiredError, IntentFailedError, IntentStatusTimeoutError, SignerNotSupportedError, };
|
|
70
|
+
export { isExecutionError, ExecutionError, Eip7702InitSignatureRequiredError, OrderPathRequiredForIntentsError, QuoteNotInPreparedTransactionError, SessionChainRequiredError, IntentFailedError, IntentStatusTimeoutError, SignerNotSupportedError, };
|
|
62
71
|
//# sourceMappingURL=error.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../../../execution/error.ts"],"names":[],"mappings":"AAAA,cAAM,cAAe,SAAQ,KAAK;IAChC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAQ;IACjC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAK;IAC9B,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAQ;IACnC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAQ;gBAErB,MAAM,CAAC,EAAE;QACnB,OAAO,CAAC,EAAE,MAAM,CAAA;QAChB,OAAO,CAAC,EAAE,GAAG,CAAA;QACb,SAAS,CAAC,EAAE,MAAM,CAAA;QAClB,OAAO,CAAC,EAAE,MAAM,CAAA;KACjB;IAQD,IAAI,OAAO,WAEV;IAED,IAAI,OAAO,QAEV;IAED,IAAI,SAAS,WAEZ;IAED,IAAI,OAAO,WAEV;CACF;AAED,cAAM,uBAAwB,SAAQ,cAAc;gBACtC,MAAM,CAAC,EAAE;QACnB,OAAO,CAAC,EAAE,GAAG,CAAA;QACb,SAAS,CAAC,EAAE,MAAM,CAAA;QAClB,OAAO,CAAC,EAAE,MAAM,CAAA;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,wBAAyB,SAAQ,cAAc;gBACvC,MAAM,CAAC,EAAE;QACnB,OAAO,CAAC,EAAE,GAAG,CAAA;QACb,SAAS,CAAC,EAAE,MAAM,CAAA;QAClB,OAAO,CAAC,EAAE,MAAM,CAAA;KACjB;CAMF;AAED,cAAM,kCAAmC,SAAQ,cAAc;gBACjD,MAAM,CAAC,EAAE;QACnB,OAAO,CAAC,EAAE;YAAE,QAAQ,CAAC,EAAE,MAAM,CAAA;SAAE,CAAA;QAC/B,SAAS,CAAC,EAAE,MAAM,CAAA;QAClB,OAAO,CAAC,EAAE,MAAM,CAAA;KACjB;CAOF;AAED,cAAM,iCAAkC,SAAQ,cAAc;gBAChD,MAAM,CAAC,EAAE;QACnB,OAAO,CAAC,EAAE,GAAG,CAAA;QACb,SAAS,CAAC,EAAE,MAAM,CAAA;QAClB,OAAO,CAAC,EAAE,MAAM,CAAA;KACjB;CAOF;AAED,iBAAS,gBAAgB,CAAC,KAAK,EAAE,KAAK,GAAG,KAAK,IAAI,cAAc,CAE/D;AAED,OAAO,EACL,gBAAgB,EAChB,cAAc,EACd,iCAAiC,EACjC,gCAAgC,EAChC,kCAAkC,EAClC,yBAAyB,EACzB,iBAAiB,EACjB,wBAAwB,EACxB,uBAAuB,GACxB,CAAA"}
|
|
@@ -63,6 +63,14 @@ class IntentStatusTimeoutError extends ExecutionError {
|
|
|
63
63
|
});
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
|
+
class QuoteNotInPreparedTransactionError extends ExecutionError {
|
|
67
|
+
constructor(params) {
|
|
68
|
+
super({
|
|
69
|
+
message: 'Selected quote does not belong to the prepared transaction. Re-prepare and try again.',
|
|
70
|
+
...params,
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
}
|
|
66
74
|
class Eip7702InitSignatureRequiredError extends ExecutionError {
|
|
67
75
|
constructor(params) {
|
|
68
76
|
super({
|
|
@@ -74,4 +82,4 @@ class Eip7702InitSignatureRequiredError extends ExecutionError {
|
|
|
74
82
|
function isExecutionError(error) {
|
|
75
83
|
return error instanceof ExecutionError;
|
|
76
84
|
}
|
|
77
|
-
export { isExecutionError, ExecutionError, Eip7702InitSignatureRequiredError, OrderPathRequiredForIntentsError, SessionChainRequiredError, IntentFailedError, IntentStatusTimeoutError, SignerNotSupportedError, };
|
|
85
|
+
export { isExecutionError, ExecutionError, Eip7702InitSignatureRequiredError, OrderPathRequiredForIntentsError, QuoteNotInPreparedTransactionError, SessionChainRequiredError, IntentFailedError, IntentStatusTimeoutError, SignerNotSupportedError, };
|
|
@@ -4,7 +4,7 @@ import { type AuthProvider } from '../auth/provider.js';
|
|
|
4
4
|
import { type IntentOpStatus, type SplitIntentsInput } from '../orchestrator/index.js';
|
|
5
5
|
import type { SettlementLayer } from '../orchestrator/types.js';
|
|
6
6
|
import type { CalldataInput, CallInput, RhinestoneAccountConfig, RhinestoneConfig, SignerSet, SourceAssetInput, Sponsorship, TokenRequest, TokenSymbol, Transaction, UserOperationTransaction } from '../types.js';
|
|
7
|
-
import { ExecutionError, IntentFailedError, IntentStatusTimeoutError, isExecutionError, OrderPathRequiredForIntentsError, SessionChainRequiredError, SignerNotSupportedError } from './error.js';
|
|
7
|
+
import { ExecutionError, IntentFailedError, IntentStatusTimeoutError, isExecutionError, OrderPathRequiredForIntentsError, QuoteNotInPreparedTransactionError, SessionChainRequiredError, SignerNotSupportedError } from './error.js';
|
|
8
8
|
import type { TransactionResult, UserOperationResult } from './utils.js';
|
|
9
9
|
interface TransactionStatus {
|
|
10
10
|
fill: {
|
|
@@ -28,16 +28,15 @@ declare function sendTransactionInternal(config: RhinestoneConfig, sourceChains:
|
|
|
28
28
|
eip7702InitSignature?: Hex;
|
|
29
29
|
settlementLayers?: SettlementLayer[];
|
|
30
30
|
sourceAssets?: SourceAssetInput;
|
|
31
|
-
lockFunds?: boolean;
|
|
32
31
|
feeAsset?: Address | TokenSymbol;
|
|
33
32
|
}): Promise<TransactionResult>;
|
|
34
33
|
declare function sendUserOperationInternal(config: RhinestoneConfig, chain: Chain, callInputs: CalldataInput[], signers?: SignerSet): Promise<UserOperationResult>;
|
|
35
34
|
declare function waitForExecution(config: RhinestoneConfig, result: TransactionResult | UserOperationResult, acceptsPreconfirmations: boolean): Promise<TransactionStatus | UserOperationReceipt>;
|
|
36
35
|
declare function getPortfolio(config: RhinestoneConfig, onTestnets: boolean): Promise<import("../orchestrator/index.js").Portfolio>;
|
|
37
|
-
declare function getIntentStatus(authProvider: AuthProvider, endpointUrl: string | undefined, intentId:
|
|
36
|
+
declare function getIntentStatus(authProvider: AuthProvider, endpointUrl: string | undefined, intentId: string, headers?: Record<string, string>): Promise<TransactionStatus & {
|
|
38
37
|
status: IntentOpStatus['status'];
|
|
39
38
|
}>;
|
|
40
39
|
declare function splitIntents(authProvider: AuthProvider, endpointUrl: string | undefined, input: SplitIntentsInput, headers?: Record<string, string>): Promise<import("../orchestrator/index.js").SplitIntentsResult>;
|
|
41
|
-
export { sendTransaction, sendTransactionInternal, sendUserOperation, sendUserOperationInternal, waitForExecution, getPortfolio, getIntentStatus, splitIntents, isExecutionError, ExecutionError, IntentFailedError, IntentStatusTimeoutError, OrderPathRequiredForIntentsError, SessionChainRequiredError, SignerNotSupportedError, };
|
|
40
|
+
export { sendTransaction, sendTransactionInternal, sendUserOperation, sendUserOperationInternal, waitForExecution, getPortfolio, getIntentStatus, splitIntents, isExecutionError, ExecutionError, IntentFailedError, IntentStatusTimeoutError, OrderPathRequiredForIntentsError, QuoteNotInPreparedTransactionError, SessionChainRequiredError, SignerNotSupportedError, };
|
|
42
41
|
export type { TransactionStatus, TransactionResult, UserOperationResult };
|
|
43
42
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../execution/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAE,KAAK,KAAK,EAAsB,KAAK,GAAG,EAAE,MAAM,MAAM,CAAA;AAC7E,OAAO,K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gDAgBxE;AAED,iBAAe,eAAe,CAC5B,YAAY,EAAE,YAAY,EAC1B,WAAW,EAAE,MAAM,GAAG,SAAS,EAC/B,QAAQ,EAAE,MAAM,EAChB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC/B,OAAO,CACR,iBAAiB,GAAG;IAClB,MAAM,EAAE,cAAc,CAAC,QAAQ,CAAC,CAAA;CACjC,CACF,CAcA;AAED,iBAAe,YAAY,CACzB,YAAY,EAAE,YAAY,EAC1B,WAAW,EAAE,MAAM,GAAG,SAAS,EAC/B,KAAK,EAAE,iBAAiB,EACxB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,yDAIjC;AAED,OAAO,EACL,eAAe,EACf,uBAAuB,EACvB,iBAAiB,EACjB,yBAAyB,EACzB,gBAAgB,EAChB,YAAY,EACZ,eAAe,EACf,YAAY,EAEZ,gBAAgB,EAChB,cAAc,EACd,iBAAiB,EACjB,wBAAwB,EACxB,gCAAgC,EAChC,kCAAkC,EAClC,yBAAyB,EACzB,uBAAuB,GACxB,CAAA;AACD,YAAY,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,CAAA"}
|
|
@@ -4,7 +4,7 @@ import { createTransport, getBundlerClient } from '../accounts/utils.js';
|
|
|
4
4
|
import { createAuthProvider } from '../auth/provider.js';
|
|
5
5
|
import { getOrchestrator, INTENT_STATUS_COMPLETED, INTENT_STATUS_FAILED, INTENT_STATUS_FILLED, INTENT_STATUS_PRECONFIRMED, isRateLimited, isRetryable, } from '../orchestrator/index.js';
|
|
6
6
|
import { getChainById, getSupportedChainIds, isTestnet, } from '../orchestrator/registry.js';
|
|
7
|
-
import { ExecutionError, IntentFailedError, IntentStatusTimeoutError, isExecutionError, OrderPathRequiredForIntentsError, SessionChainRequiredError, SignerNotSupportedError, } from './error.js';
|
|
7
|
+
import { ExecutionError, IntentFailedError, IntentStatusTimeoutError, isExecutionError, OrderPathRequiredForIntentsError, QuoteNotInPreparedTransactionError, SessionChainRequiredError, SignerNotSupportedError, } from './error.js';
|
|
8
8
|
import { getTargetExecutionSignature, getTokenRequests, getValidatorAccount, parseCalls, prepareTransactionAsIntent, resolveCallInputs, signAuthorizationsInternal, signIntent, submitIntentInternal, } from './utils.js';
|
|
9
9
|
const POLL_INITIAL_MS = 500;
|
|
10
10
|
const POLL_SLOW_AFTER_MS = 15000;
|
|
@@ -47,7 +47,7 @@ async function sendTransactionInternal(config, sourceChains, targetChain, option
|
|
|
47
47
|
throw new SignerNotSupportedError();
|
|
48
48
|
}
|
|
49
49
|
else {
|
|
50
|
-
return await sendTransactionAsIntent(config, sourceChains, targetChain, resolvedCalls, options.gasLimit, tokenRequests, options.recipient, options.signers, options.sponsored, options.eip7702InitSignature, options.settlementLayers, options.sourceAssets, options.feeAsset
|
|
50
|
+
return await sendTransactionAsIntent(config, sourceChains, targetChain, resolvedCalls, options.gasLimit, tokenRequests, options.recipient, options.signers, options.sponsored, options.eip7702InitSignature, options.settlementLayers, options.sourceAssets, options.feeAsset);
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
53
|
async function sendUserOperationInternal(config, chain, callInputs, signers) {
|
|
@@ -73,18 +73,23 @@ async function sendUserOperationInternal(config, chain, callInputs, signers) {
|
|
|
73
73
|
chain: chain.id,
|
|
74
74
|
};
|
|
75
75
|
}
|
|
76
|
-
async function sendTransactionAsIntent(config, sourceChains, targetChain, callInputs, gasLimit, tokenRequests, recipient, signers, sponsored, eip7702InitSignature, settlementLayers, sourceAssets, feeAsset
|
|
77
|
-
const prepared = await prepareTransactionAsIntent(config, sourceChains, targetChain, callInputs, gasLimit, tokenRequests, recipient, sponsored ?? false, eip7702InitSignature, settlementLayers, sourceAssets, feeAsset,
|
|
76
|
+
async function sendTransactionAsIntent(config, sourceChains, targetChain, callInputs, gasLimit, tokenRequests, recipient, signers, sponsored, eip7702InitSignature, settlementLayers, sourceAssets, feeAsset) {
|
|
77
|
+
const prepared = await prepareTransactionAsIntent(config, sourceChains, targetChain, callInputs, gasLimit, tokenRequests, recipient, sponsored ?? false, eip7702InitSignature, settlementLayers, sourceAssets, feeAsset, undefined, undefined, signers);
|
|
78
78
|
if (!prepared) {
|
|
79
79
|
throw new OrderPathRequiredForIntentsError();
|
|
80
80
|
}
|
|
81
|
-
const {
|
|
82
|
-
const
|
|
83
|
-
const
|
|
81
|
+
const { quotes, intentInput } = prepared;
|
|
82
|
+
const quote = quotes.best;
|
|
83
|
+
const { originSignatures, destinationSignature } = await signIntent(config, quote.signData, targetChain, signers);
|
|
84
|
+
const targetExecutionSignature = await getTargetExecutionSignature(config, quote.signData, targetChain, signers);
|
|
84
85
|
const authorizations = config.eoa
|
|
85
|
-
? await signAuthorizationsInternal(config,
|
|
86
|
+
? await signAuthorizationsInternal(config, {
|
|
87
|
+
sourceChains,
|
|
88
|
+
targetChain,
|
|
89
|
+
eip7702InitSignature,
|
|
90
|
+
})
|
|
86
91
|
: [];
|
|
87
|
-
return await submitIntentInternal(config, sourceChains, targetChain,
|
|
92
|
+
return await submitIntentInternal(config, sourceChains, targetChain, quote, originSignatures, destinationSignature, targetExecutionSignature, authorizations, false, intentInput);
|
|
88
93
|
}
|
|
89
94
|
async function waitForExecution(config, result, acceptsPreconfirmations) {
|
|
90
95
|
const validStatuses = new Set([
|
|
@@ -106,13 +111,13 @@ async function waitForExecution(config, result, acceptsPreconfirmations) {
|
|
|
106
111
|
if (now - startTs >= POLL_MAX_WAIT_MS) {
|
|
107
112
|
throw new IntentStatusTimeoutError({
|
|
108
113
|
context: {
|
|
109
|
-
intentId: result.id
|
|
114
|
+
intentId: result.id,
|
|
110
115
|
},
|
|
111
116
|
});
|
|
112
117
|
}
|
|
113
118
|
const orchestrator = getOrchestrator(config._authProvider ?? createAuthProvider(config), config.endpointUrl, config.headers);
|
|
114
119
|
try {
|
|
115
|
-
intentStatus = await orchestrator.
|
|
120
|
+
intentStatus = await orchestrator.getIntent(result.id);
|
|
116
121
|
// reset error backoff on success
|
|
117
122
|
errorBackoffMs = POLL_ERROR_BACKOFF_MS;
|
|
118
123
|
const elapsed = Date.now() - startTs;
|
|
@@ -122,7 +127,7 @@ async function waitForExecution(config, result, acceptsPreconfirmations) {
|
|
|
122
127
|
}
|
|
123
128
|
catch (err) {
|
|
124
129
|
if (isRateLimited(err)) {
|
|
125
|
-
const retryAfter = err
|
|
130
|
+
const retryAfter = err.retryAfter;
|
|
126
131
|
let retryMs = nextDelayMs;
|
|
127
132
|
if (retryAfter) {
|
|
128
133
|
const parsed = Number(retryAfter);
|
|
@@ -152,10 +157,9 @@ async function waitForExecution(config, result, acceptsPreconfirmations) {
|
|
|
152
157
|
}
|
|
153
158
|
}
|
|
154
159
|
if (intentStatus.status === INTENT_STATUS_FAILED) {
|
|
155
|
-
const intentId = result.id.toString();
|
|
156
160
|
throw new IntentFailedError({
|
|
157
161
|
context: {
|
|
158
|
-
intentId,
|
|
162
|
+
intentId: result.id,
|
|
159
163
|
},
|
|
160
164
|
});
|
|
161
165
|
}
|
|
@@ -200,7 +204,7 @@ async function getPortfolio(config, onTestnets) {
|
|
|
200
204
|
}
|
|
201
205
|
async function getIntentStatus(authProvider, endpointUrl, intentId, headers) {
|
|
202
206
|
const orchestrator = getOrchestrator(authProvider, endpointUrl, headers);
|
|
203
|
-
const internalStatus = await orchestrator.
|
|
207
|
+
const internalStatus = await orchestrator.getIntent(intentId);
|
|
204
208
|
return {
|
|
205
209
|
status: internalStatus.status,
|
|
206
210
|
fill: {
|
|
@@ -215,8 +219,8 @@ async function getIntentStatus(authProvider, endpointUrl, intentId, headers) {
|
|
|
215
219
|
}
|
|
216
220
|
async function splitIntents(authProvider, endpointUrl, input, headers) {
|
|
217
221
|
const orchestrator = getOrchestrator(authProvider, endpointUrl, headers);
|
|
218
|
-
return orchestrator.
|
|
222
|
+
return orchestrator.getSplit(input);
|
|
219
223
|
}
|
|
220
224
|
export { sendTransaction, sendTransactionInternal, sendUserOperation, sendUserOperationInternal, waitForExecution, getPortfolio, getIntentStatus, splitIntents,
|
|
221
225
|
// Errors
|
|
222
|
-
isExecutionError, ExecutionError, IntentFailedError, IntentStatusTimeoutError, OrderPathRequiredForIntentsError, SessionChainRequiredError, SignerNotSupportedError, };
|
|
226
|
+
isExecutionError, ExecutionError, IntentFailedError, IntentStatusTimeoutError, OrderPathRequiredForIntentsError, QuoteNotInPreparedTransactionError, SessionChainRequiredError, SignerNotSupportedError, };
|