@rhinestone/sdk 1.0.0-alpha.8 → 1.0.0-beta.38
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/accounts/error.d.ts +38 -3
- package/dist/src/accounts/error.d.ts.map +1 -1
- package/dist/src/accounts/error.js +57 -7
- package/dist/src/accounts/index.d.ts +30 -15
- package/dist/src/accounts/index.d.ts.map +1 -1
- package/dist/src/accounts/index.js +304 -138
- package/dist/src/accounts/index.test.js +3 -5
- package/dist/src/accounts/json-rpc/index.d.ts +5 -0
- package/dist/src/accounts/json-rpc/index.d.ts.map +1 -0
- package/dist/src/accounts/json-rpc/index.js +16 -0
- package/dist/src/accounts/json-rpc/index.test.d.ts.map +1 -0
- package/dist/src/accounts/json-rpc/index.test.js +16 -0
- package/dist/src/accounts/json-rpc/providers.d.ts +4 -0
- package/dist/src/accounts/json-rpc/providers.d.ts.map +1 -0
- package/dist/src/accounts/json-rpc/providers.js +14 -0
- package/dist/src/accounts/json-rpc/providers.test.d.ts +2 -0
- package/dist/src/accounts/json-rpc/providers.test.d.ts.map +1 -0
- package/dist/src/accounts/json-rpc/providers.test.js +15 -0
- package/dist/src/accounts/kernel.d.ts +4 -3
- package/dist/src/accounts/kernel.d.ts.map +1 -1
- package/dist/src/accounts/kernel.js +32 -6
- package/dist/src/accounts/kernel.test.js +41 -19
- package/dist/src/accounts/nexus.d.ts +14 -7
- package/dist/src/accounts/nexus.d.ts.map +1 -1
- package/dist/src/accounts/nexus.js +191 -34
- package/dist/src/accounts/nexus.test.js +44 -18
- package/dist/src/accounts/safe.d.ts +2 -2
- package/dist/src/accounts/safe.d.ts.map +1 -1
- package/dist/src/accounts/safe.js +88 -58
- package/dist/src/accounts/safe.test.js +40 -14
- package/dist/src/accounts/signing/common.d.ts +27 -0
- package/dist/src/accounts/signing/common.d.ts.map +1 -0
- package/dist/src/accounts/signing/common.js +145 -0
- package/dist/src/accounts/signing/message.d.ts +5 -0
- package/dist/src/accounts/signing/message.d.ts.map +1 -0
- package/dist/src/accounts/signing/message.js +47 -0
- package/dist/src/accounts/signing/passkeys.d.ts +36 -0
- package/dist/src/accounts/signing/passkeys.d.ts.map +1 -0
- package/dist/src/accounts/signing/passkeys.js +125 -0
- package/dist/src/accounts/signing/passkeys.test.d.ts +2 -0
- package/dist/src/accounts/signing/passkeys.test.d.ts.map +1 -0
- package/dist/src/accounts/signing/passkeys.test.js +88 -0
- package/dist/src/accounts/signing/typedData.d.ts +5 -0
- package/dist/src/accounts/signing/typedData.d.ts.map +1 -0
- package/dist/src/accounts/signing/typedData.js +35 -0
- package/dist/src/accounts/startale.d.ts +20 -0
- package/dist/src/accounts/startale.d.ts.map +1 -0
- package/dist/src/accounts/startale.js +100 -0
- package/dist/src/accounts/startale.test.d.ts +2 -0
- package/dist/src/accounts/startale.test.d.ts.map +1 -0
- package/dist/src/accounts/startale.test.js +92 -0
- package/dist/src/accounts/utils.d.ts +4 -4
- package/dist/src/accounts/utils.d.ts.map +1 -1
- package/dist/src/accounts/utils.js +3 -40
- package/dist/src/accounts/walletClient.d.ts +7 -0
- package/dist/src/accounts/walletClient.d.ts.map +1 -0
- package/dist/src/accounts/walletClient.js +38 -0
- package/dist/src/actions/compact.d.ts +13 -0
- package/dist/src/actions/compact.d.ts.map +1 -0
- package/dist/src/actions/compact.js +210 -0
- package/dist/src/actions/ecdsa.d.ts +35 -0
- package/dist/src/actions/ecdsa.d.ts.map +1 -0
- package/dist/src/actions/ecdsa.js +114 -0
- package/dist/src/actions/ecdsa.test.d.ts +2 -0
- package/dist/src/actions/ecdsa.test.d.ts.map +1 -0
- package/dist/src/actions/ecdsa.test.js +99 -0
- package/dist/src/actions/index.d.ts +23 -38
- package/dist/src/actions/index.d.ts.map +1 -1
- package/dist/src/actions/index.js +29 -294
- package/dist/src/actions/mfa.d.ts +37 -0
- package/dist/src/actions/mfa.d.ts.map +1 -0
- package/dist/src/actions/mfa.js +133 -0
- package/dist/src/actions/passkeys.d.ts +37 -0
- package/dist/src/actions/passkeys.d.ts.map +1 -0
- package/dist/src/actions/passkeys.js +129 -0
- package/dist/src/actions/passkeys.test.d.ts +2 -0
- package/dist/src/actions/passkeys.test.d.ts.map +1 -0
- package/dist/src/actions/passkeys.test.js +54 -0
- package/dist/src/actions/recovery.d.ts +33 -0
- package/dist/src/actions/recovery.d.ts.map +1 -0
- package/dist/src/actions/recovery.js +193 -0
- package/dist/src/actions/recovery.test.d.ts +2 -0
- package/dist/src/actions/recovery.test.d.ts.map +1 -0
- package/dist/src/actions/recovery.test.js +168 -0
- package/dist/src/actions/smart-session.d.ts +6 -0
- package/dist/src/actions/smart-session.d.ts.map +1 -1
- package/dist/src/actions/smart-session.js +6 -0
- package/dist/src/errors/index.d.ts +5 -0
- package/dist/src/errors/index.d.ts.map +1 -0
- package/dist/src/errors/index.js +35 -0
- package/dist/src/execution/compact.d.ts +150 -7
- package/dist/src/execution/compact.d.ts.map +1 -1
- package/dist/src/execution/compact.js +112 -95
- package/dist/src/execution/error.d.ts +2 -9
- package/dist/src/execution/error.d.ts.map +1 -1
- package/dist/src/execution/error.js +4 -13
- package/dist/src/execution/index.d.ts +34 -22
- package/dist/src/execution/index.d.ts.map +1 -1
- package/dist/src/execution/index.js +62 -43
- package/dist/src/execution/permit2.d.ts +148 -0
- package/dist/src/execution/permit2.d.ts.map +1 -0
- package/dist/src/execution/permit2.js +282 -0
- package/dist/src/execution/smart-session.d.ts +3 -3
- package/dist/src/execution/smart-session.d.ts.map +1 -1
- package/dist/src/execution/types.d.ts +35 -0
- package/dist/src/execution/types.d.ts.map +1 -0
- package/dist/src/execution/types.js +2 -0
- package/dist/src/execution/utils.d.ts +36 -27
- package/dist/src/execution/utils.d.ts.map +1 -1
- package/dist/src/execution/utils.js +357 -103
- package/dist/src/index.d.ts +41 -22
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +199 -65
- package/dist/src/modules/common.d.ts +10 -4
- package/dist/src/modules/common.d.ts.map +1 -1
- package/dist/src/modules/common.js +22 -1
- package/dist/src/modules/index.d.ts +4 -18
- package/dist/src/modules/index.d.ts.map +1 -1
- package/dist/src/modules/index.js +15 -63
- package/dist/src/modules/index.test.js +9 -26
- package/dist/src/modules/omni-account.d.ts +2 -1
- package/dist/src/modules/omni-account.d.ts.map +1 -1
- package/dist/src/modules/omni-account.js +3 -1
- package/dist/src/modules/read.d.ts.map +1 -1
- package/dist/src/modules/read.js +5 -0
- package/dist/src/modules/validators/core.d.ts +5 -3
- package/dist/src/modules/validators/core.d.ts.map +1 -1
- package/dist/src/modules/validators/core.js +64 -41
- package/dist/src/modules/validators/core.test.js +7 -7
- package/dist/src/modules/validators/smart-sessions.js +3 -3
- package/dist/src/modules/validators/smart-sessions.test.js +4 -7
- package/dist/src/orchestrator/client.d.ts +4 -4
- package/dist/src/orchestrator/client.d.ts.map +1 -1
- package/dist/src/orchestrator/client.js +30 -15
- package/dist/src/orchestrator/index.d.ts +2 -3
- package/dist/src/orchestrator/index.d.ts.map +1 -1
- package/dist/src/orchestrator/index.js +1 -3
- package/dist/src/orchestrator/registry.d.ts +1 -23
- package/dist/src/orchestrator/registry.d.ts.map +1 -1
- package/dist/src/orchestrator/registry.js +37 -33
- package/dist/src/orchestrator/registry.test.js +7 -7
- package/dist/src/orchestrator/types.d.ts +97 -29
- package/dist/src/orchestrator/types.d.ts.map +1 -1
- package/dist/src/orchestrator/utils.d.ts +1 -3
- package/dist/src/orchestrator/utils.d.ts.map +1 -1
- package/dist/src/orchestrator/utils.js +0 -102
- package/dist/src/types.d.ts +74 -10
- package/dist/src/types.d.ts.map +1 -1
- package/package.json +72 -1
- package/dist/src/actions/index.test.d.ts.map +0 -1
- package/dist/src/actions/index.test.js +0 -302
- package/dist/src/orchestrator/registry.json +0 -365
- /package/dist/src/{actions → accounts/json-rpc}/index.test.d.ts +0 -0
|
@@ -49,10 +49,10 @@ class Orchestrator {
|
|
|
49
49
|
}
|
|
50
50
|
catch (error) {
|
|
51
51
|
this.parseError(error);
|
|
52
|
-
throw new
|
|
52
|
+
throw new error_1.OrchestratorError({ message: 'Failed to get portfolio' });
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
|
-
async getMaxTokenAmount(userAddress, destinationChainId, destinationTokenAddress, destinationGasUnits) {
|
|
55
|
+
async getMaxTokenAmount(userAddress, destinationChainId, destinationTokenAddress, destinationGasUnits, sponsored) {
|
|
56
56
|
const intentCost = await this.getIntentCost({
|
|
57
57
|
account: {
|
|
58
58
|
address: userAddress,
|
|
@@ -72,6 +72,14 @@ class Orchestrator {
|
|
|
72
72
|
tokenAddress: destinationTokenAddress,
|
|
73
73
|
},
|
|
74
74
|
],
|
|
75
|
+
options: {
|
|
76
|
+
topupCompact: false,
|
|
77
|
+
sponsorSettings: {
|
|
78
|
+
gasSponsored: sponsored,
|
|
79
|
+
bridgeFeesSponsored: sponsored,
|
|
80
|
+
swapFeesSponsored: sponsored,
|
|
81
|
+
},
|
|
82
|
+
},
|
|
75
83
|
});
|
|
76
84
|
if (!intentCost.hasFulfilledAll) {
|
|
77
85
|
return 0n;
|
|
@@ -85,17 +93,16 @@ class Orchestrator {
|
|
|
85
93
|
if (tokenAmount < 0n) {
|
|
86
94
|
throw new Error(`Balance not available. Make sure the account is deployed`);
|
|
87
95
|
}
|
|
88
|
-
|
|
96
|
+
// `sponsorSettings` is not taken into account in the API response for now
|
|
97
|
+
// As a workaround, we use the `amountSpent` if the transaction is sponsored
|
|
98
|
+
return sponsored
|
|
99
|
+
? tokenReceived.amountSpent
|
|
100
|
+
: tokenReceived.destinationAmount;
|
|
89
101
|
}
|
|
90
102
|
async getIntentCost(input) {
|
|
91
103
|
try {
|
|
92
104
|
const response = await axios_1.default.post(`${this.serverUrl}/intents/cost`, {
|
|
93
|
-
...(0, utils_1.convertBigIntFields)(
|
|
94
|
-
...input,
|
|
95
|
-
tokenTransfers: input.tokenTransfers.map((transfer) => ({
|
|
96
|
-
tokenAddress: transfer.tokenAddress,
|
|
97
|
-
})),
|
|
98
|
-
}),
|
|
105
|
+
...(0, utils_1.convertBigIntFields)(input),
|
|
99
106
|
}, {
|
|
100
107
|
headers: {
|
|
101
108
|
'x-api-key': this.apiKey,
|
|
@@ -105,7 +112,7 @@ class Orchestrator {
|
|
|
105
112
|
}
|
|
106
113
|
catch (error) {
|
|
107
114
|
this.parseError(error);
|
|
108
|
-
throw new
|
|
115
|
+
throw new error_1.OrchestratorError({ message: 'Failed to get intent cost' });
|
|
109
116
|
}
|
|
110
117
|
}
|
|
111
118
|
async getIntentRoute(input) {
|
|
@@ -121,13 +128,19 @@ class Orchestrator {
|
|
|
121
128
|
}
|
|
122
129
|
catch (error) {
|
|
123
130
|
this.parseError(error);
|
|
124
|
-
throw new
|
|
131
|
+
throw new error_1.OrchestratorError({ message: 'Failed to get intent route' });
|
|
125
132
|
}
|
|
126
133
|
}
|
|
127
|
-
async submitIntent(
|
|
134
|
+
async submitIntent(signedIntentOpUnformatted, dryRun) {
|
|
128
135
|
try {
|
|
136
|
+
const signedIntentOp = (0, utils_1.convertBigIntFields)(signedIntentOpUnformatted);
|
|
137
|
+
if (dryRun) {
|
|
138
|
+
signedIntentOp.options = {
|
|
139
|
+
dryRun: true,
|
|
140
|
+
};
|
|
141
|
+
}
|
|
129
142
|
const response = await axios_1.default.post(`${this.serverUrl}/intent-operations`, {
|
|
130
|
-
signedIntentOp
|
|
143
|
+
signedIntentOp,
|
|
131
144
|
}, {
|
|
132
145
|
headers: {
|
|
133
146
|
'x-api-key': this.apiKey,
|
|
@@ -137,7 +150,7 @@ class Orchestrator {
|
|
|
137
150
|
}
|
|
138
151
|
catch (error) {
|
|
139
152
|
this.parseError(error);
|
|
140
|
-
throw new
|
|
153
|
+
throw new error_1.OrchestratorError({ message: 'Failed to submit intent' });
|
|
141
154
|
}
|
|
142
155
|
}
|
|
143
156
|
async getIntentOpStatus(intentId) {
|
|
@@ -151,7 +164,9 @@ class Orchestrator {
|
|
|
151
164
|
}
|
|
152
165
|
catch (error) {
|
|
153
166
|
this.parseError(error);
|
|
154
|
-
throw new
|
|
167
|
+
throw new error_1.OrchestratorError({
|
|
168
|
+
message: 'Failed to get intent op status',
|
|
169
|
+
});
|
|
155
170
|
}
|
|
156
171
|
}
|
|
157
172
|
parseError(error) {
|
|
@@ -4,8 +4,7 @@ import { AuthenticationRequiredError, InsufficientBalanceError, IntentNotFoundEr
|
|
|
4
4
|
import { getSupportedTokens, getTokenAddress, getTokenSymbol, getWethAddress, isTokenAddressSupported } from './registry';
|
|
5
5
|
import type { IntentCost, IntentInput, IntentOp, IntentOpStatus, IntentResult, IntentRoute, Portfolio, SettlementSystem, SignedIntentOp, SupportedChain, TokenConfig } from './types';
|
|
6
6
|
import { INTENT_STATUS_COMPLETED, INTENT_STATUS_EXPIRED, INTENT_STATUS_FAILED, INTENT_STATUS_FILLED, INTENT_STATUS_PARTIALLY_COMPLETED, INTENT_STATUS_PENDING, INTENT_STATUS_PRECONFIRMED, INTENT_STATUS_UNKNOWN } from './types';
|
|
7
|
-
|
|
8
|
-
declare function getOrchestrator(apiKey: string, orchestratorUrl?: string): Orchestrator;
|
|
7
|
+
declare function getOrchestrator(apiKey?: string, orchestratorUrl?: string): Orchestrator;
|
|
9
8
|
export type { IntentCost, IntentInput, IntentOp, IntentOpStatus, IntentResult, IntentRoute, SettlementSystem, SignedIntentOp, SupportedChain, TokenConfig, Portfolio, };
|
|
10
|
-
export { INTENT_STATUS_PENDING, INTENT_STATUS_EXPIRED, INTENT_STATUS_PARTIALLY_COMPLETED, INTENT_STATUS_COMPLETED, INTENT_STATUS_FILLED, INTENT_STATUS_FAILED, INTENT_STATUS_PRECONFIRMED, INTENT_STATUS_UNKNOWN, RHINESTONE_SPOKE_POOL_ADDRESS, Orchestrator, AuthenticationRequiredError, InsufficientBalanceError, InvalidApiKeyError, InvalidIntentSignatureError, NoPathFoundError, OnlyOneTargetTokenAmountCanBeUnsetError, OrchestratorError, IntentNotFoundError, TokenNotSupportedError, UnsupportedChainError, UnsupportedChainIdError, UnsupportedTokenError, getOrchestrator,
|
|
9
|
+
export { INTENT_STATUS_PENDING, INTENT_STATUS_EXPIRED, INTENT_STATUS_PARTIALLY_COMPLETED, INTENT_STATUS_COMPLETED, INTENT_STATUS_FILLED, INTENT_STATUS_FAILED, INTENT_STATUS_PRECONFIRMED, INTENT_STATUS_UNKNOWN, RHINESTONE_SPOKE_POOL_ADDRESS, Orchestrator, AuthenticationRequiredError, InsufficientBalanceError, InvalidApiKeyError, InvalidIntentSignatureError, NoPathFoundError, OnlyOneTargetTokenAmountCanBeUnsetError, OrchestratorError, IntentNotFoundError, TokenNotSupportedError, UnsupportedChainError, UnsupportedChainIdError, UnsupportedTokenError, getOrchestrator, getWethAddress, getTokenSymbol, getTokenAddress, getSupportedTokens, isOrchestratorError, isTokenAddressSupported, };
|
|
11
10
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../orchestrator/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AACvC,OAAO,EAAyB,6BAA6B,EAAE,MAAM,UAAU,CAAA;AAC/E,OAAO,EACL,2BAA2B,EAC3B,wBAAwB,EACxB,mBAAmB,EACnB,kBAAkB,EAClB,2BAA2B,EAC3B,mBAAmB,EACnB,gBAAgB,EAChB,uCAAuC,EACvC,iBAAiB,EACjB,sBAAsB,EACtB,qBAAqB,EACrB,uBAAuB,EACvB,qBAAqB,EACtB,MAAM,SAAS,CAAA;AAChB,OAAO,EACL,kBAAkB,EAClB,eAAe,EACf,cAAc,EACd,cAAc,EACd,uBAAuB,EACxB,MAAM,YAAY,CAAA;AACnB,OAAO,KAAK,EACV,UAAU,EACV,WAAW,EACX,QAAQ,EACR,cAAc,EACd,YAAY,EACZ,WAAW,EACX,SAAS,EACT,gBAAgB,EAChB,cAAc,EACd,cAAc,EACd,WAAW,EACZ,MAAM,SAAS,CAAA;AAChB,OAAO,EACL,uBAAuB,EACvB,qBAAqB,EACrB,oBAAoB,EACpB,oBAAoB,EACpB,iCAAiC,EACjC,qBAAqB,EACrB,0BAA0B,EAC1B,qBAAqB,EACtB,MAAM,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../orchestrator/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AACvC,OAAO,EAAyB,6BAA6B,EAAE,MAAM,UAAU,CAAA;AAC/E,OAAO,EACL,2BAA2B,EAC3B,wBAAwB,EACxB,mBAAmB,EACnB,kBAAkB,EAClB,2BAA2B,EAC3B,mBAAmB,EACnB,gBAAgB,EAChB,uCAAuC,EACvC,iBAAiB,EACjB,sBAAsB,EACtB,qBAAqB,EACrB,uBAAuB,EACvB,qBAAqB,EACtB,MAAM,SAAS,CAAA;AAChB,OAAO,EACL,kBAAkB,EAClB,eAAe,EACf,cAAc,EACd,cAAc,EACd,uBAAuB,EACxB,MAAM,YAAY,CAAA;AACnB,OAAO,KAAK,EACV,UAAU,EACV,WAAW,EACX,QAAQ,EACR,cAAc,EACd,YAAY,EACZ,WAAW,EACX,SAAS,EACT,gBAAgB,EAChB,cAAc,EACd,cAAc,EACd,WAAW,EACZ,MAAM,SAAS,CAAA;AAChB,OAAO,EACL,uBAAuB,EACvB,qBAAqB,EACrB,oBAAoB,EACpB,oBAAoB,EACpB,iCAAiC,EACjC,qBAAqB,EACrB,0BAA0B,EAC1B,qBAAqB,EACtB,MAAM,SAAS,CAAA;AAEhB,iBAAS,eAAe,CACtB,MAAM,CAAC,EAAE,MAAM,EACf,eAAe,CAAC,EAAE,MAAM,GACvB,YAAY,CAEd;AAED,YAAY,EACV,UAAU,EACV,WAAW,EACX,QAAQ,EACR,cAAc,EACd,YAAY,EACZ,WAAW,EACX,gBAAgB,EAChB,cAAc,EACd,cAAc,EACd,WAAW,EACX,SAAS,GACV,CAAA;AACD,OAAO,EACL,qBAAqB,EACrB,qBAAqB,EACrB,iCAAiC,EACjC,uBAAuB,EACvB,oBAAoB,EACpB,oBAAoB,EACpB,0BAA0B,EAC1B,qBAAqB,EACrB,6BAA6B,EAC7B,YAAY,EACZ,2BAA2B,EAC3B,wBAAwB,EACxB,kBAAkB,EAClB,2BAA2B,EAC3B,gBAAgB,EAChB,uCAAuC,EACvC,iBAAiB,EACjB,mBAAmB,EACnB,sBAAsB,EACtB,qBAAqB,EACrB,uBAAuB,EACvB,qBAAqB,EACrB,eAAe,EACf,cAAc,EACd,cAAc,EACd,eAAe,EACf,kBAAkB,EAClB,mBAAmB,EACnB,uBAAuB,GACxB,CAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isTokenAddressSupported = exports.isOrchestratorError = exports.getSupportedTokens = exports.getTokenAddress = exports.getTokenSymbol = exports.getWethAddress = exports.
|
|
3
|
+
exports.isTokenAddressSupported = exports.isOrchestratorError = exports.getSupportedTokens = exports.getTokenAddress = exports.getTokenSymbol = exports.getWethAddress = exports.UnsupportedTokenError = exports.UnsupportedChainIdError = exports.UnsupportedChainError = exports.TokenNotSupportedError = exports.IntentNotFoundError = exports.OrchestratorError = exports.OnlyOneTargetTokenAmountCanBeUnsetError = exports.NoPathFoundError = exports.InvalidIntentSignatureError = exports.InvalidApiKeyError = exports.InsufficientBalanceError = exports.AuthenticationRequiredError = exports.Orchestrator = exports.RHINESTONE_SPOKE_POOL_ADDRESS = exports.INTENT_STATUS_UNKNOWN = exports.INTENT_STATUS_PRECONFIRMED = exports.INTENT_STATUS_FAILED = exports.INTENT_STATUS_FILLED = exports.INTENT_STATUS_COMPLETED = exports.INTENT_STATUS_PARTIALLY_COMPLETED = exports.INTENT_STATUS_EXPIRED = exports.INTENT_STATUS_PENDING = void 0;
|
|
4
4
|
exports.getOrchestrator = getOrchestrator;
|
|
5
5
|
const client_1 = require("./client");
|
|
6
6
|
Object.defineProperty(exports, "Orchestrator", { enumerable: true, get: function () { return client_1.Orchestrator; } });
|
|
@@ -35,8 +35,6 @@ Object.defineProperty(exports, "INTENT_STATUS_PARTIALLY_COMPLETED", { enumerable
|
|
|
35
35
|
Object.defineProperty(exports, "INTENT_STATUS_PENDING", { enumerable: true, get: function () { return types_1.INTENT_STATUS_PENDING; } });
|
|
36
36
|
Object.defineProperty(exports, "INTENT_STATUS_PRECONFIRMED", { enumerable: true, get: function () { return types_1.INTENT_STATUS_PRECONFIRMED; } });
|
|
37
37
|
Object.defineProperty(exports, "INTENT_STATUS_UNKNOWN", { enumerable: true, get: function () { return types_1.INTENT_STATUS_UNKNOWN; } });
|
|
38
|
-
const utils_1 = require("./utils");
|
|
39
|
-
Object.defineProperty(exports, "getIntentOpHash", { enumerable: true, get: function () { return utils_1.getIntentOpHash; } });
|
|
40
38
|
function getOrchestrator(apiKey, orchestratorUrl) {
|
|
41
39
|
return new client_1.Orchestrator(orchestratorUrl ?? consts_1.PROD_ORCHESTRATOR_URL, apiKey);
|
|
42
40
|
}
|
|
@@ -1,32 +1,11 @@
|
|
|
1
1
|
import { type Address, type Chain } from 'viem';
|
|
2
2
|
import type { TokenSymbol } from '../types';
|
|
3
3
|
import type { TokenConfig } from './types';
|
|
4
|
-
interface TokenEntry {
|
|
5
|
-
symbol: string;
|
|
6
|
-
address: Address;
|
|
7
|
-
decimals: number;
|
|
8
|
-
balanceSlot: number | null;
|
|
9
|
-
}
|
|
10
|
-
interface ChainContracts {
|
|
11
|
-
spokepool: Address;
|
|
12
|
-
hook: Address;
|
|
13
|
-
originModule: Address;
|
|
14
|
-
targetModule: Address;
|
|
15
|
-
sameChainModule: Address;
|
|
16
|
-
}
|
|
17
|
-
interface ChainEntry {
|
|
18
|
-
name: string;
|
|
19
|
-
contracts: ChainContracts;
|
|
20
|
-
tokens: TokenEntry[];
|
|
21
|
-
}
|
|
22
|
-
interface Registry {
|
|
23
|
-
[chainId: string]: ChainEntry;
|
|
24
|
-
}
|
|
25
4
|
declare function getSupportedChainIds(): number[];
|
|
26
5
|
declare function getWethAddress(chain: Chain): Address;
|
|
27
6
|
declare function getTokenSymbol(tokenAddress: Address, chainId: number): string;
|
|
28
7
|
declare function getTokenAddress(tokenSymbol: TokenSymbol, chainId: number): Address;
|
|
29
|
-
declare function getChainById(chainId: number): Chain
|
|
8
|
+
declare function getChainById(chainId: number): Chain;
|
|
30
9
|
declare function isTestnet(chainId: number): boolean;
|
|
31
10
|
declare function isTokenAddressSupported(address: Address, chainId: number): boolean;
|
|
32
11
|
declare function getSupportedTokens(chainId: number): TokenConfig[];
|
|
@@ -35,5 +14,4 @@ declare function getDefaultAccountAccessList(onTestnets?: boolean): {
|
|
|
35
14
|
};
|
|
36
15
|
declare function resolveTokenAddress(token: TokenSymbol | Address, chainId: number): Address;
|
|
37
16
|
export { getTokenSymbol, getTokenAddress, getWethAddress, getChainById, getSupportedTokens, getSupportedChainIds, isTestnet, isTokenAddressSupported, getDefaultAccountAccessList, resolveTokenAddress, };
|
|
38
|
-
export type { TokenEntry, ChainContracts, ChainEntry, Registry };
|
|
39
17
|
//# sourceMappingURL=registry.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../../orchestrator/registry.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../../orchestrator/registry.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,OAAO,EAAE,KAAK,KAAK,EAA0B,MAAM,MAAM,CAAA;AAcvE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AAE3C,OAAO,KAAK,EAAkB,WAAW,EAAE,MAAM,SAAS,CAAA;AAE1D,iBAAS,oBAAoB,IAAI,MAAM,EAAE,CAExC;AAMD,iBAAS,cAAc,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO,CAY7C;AAED,iBAAS,cAAc,CAAC,YAAY,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAetE;AAED,iBAAS,eAAe,CAAC,WAAW,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAsB3E;AAOD,iBAAS,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,KAAK,CAmB5C;AAED,iBAAS,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAG3C;AAED,iBAAS,uBAAuB,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAS3E;AAED,iBAAS,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,WAAW,EAAE,CAO1D;AAED,iBAAS,2BAA2B,CAAC,UAAU,CAAC,EAAE,OAAO;;EAaxD;AAED,iBAAS,mBAAmB,CAC1B,KAAK,EAAE,WAAW,GAAG,OAAO,EAC5B,OAAO,EAAE,MAAM,GACd,OAAO,CAKT;AAED,OAAO,EACL,cAAc,EACd,eAAe,EACf,cAAc,EACd,YAAY,EACZ,kBAAkB,EAClB,oBAAoB,EACpB,SAAS,EACT,uBAAuB,EACvB,2BAA2B,EAC3B,mBAAmB,GACpB,CAAA"}
|
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.getTokenSymbol = getTokenSymbol;
|
|
7
4
|
exports.getTokenAddress = getTokenAddress;
|
|
@@ -13,76 +10,83 @@ exports.isTestnet = isTestnet;
|
|
|
13
10
|
exports.isTokenAddressSupported = isTokenAddressSupported;
|
|
14
11
|
exports.getDefaultAccountAccessList = getDefaultAccountAccessList;
|
|
15
12
|
exports.resolveTokenAddress = resolveTokenAddress;
|
|
13
|
+
const shared_configs_1 = require("@rhinestone/shared-configs");
|
|
16
14
|
const viem_1 = require("viem");
|
|
17
15
|
const chains_1 = require("viem/chains");
|
|
18
|
-
const
|
|
19
|
-
const registry = registry_json_1.default;
|
|
16
|
+
const error_1 = require("./error");
|
|
20
17
|
function getSupportedChainIds() {
|
|
21
|
-
return
|
|
18
|
+
return shared_configs_1.chains.map((chain) => chain.id);
|
|
22
19
|
}
|
|
23
20
|
function getChainEntry(chainId) {
|
|
24
|
-
return
|
|
21
|
+
return shared_configs_1.chainRegistry[chainId.toString()];
|
|
25
22
|
}
|
|
26
23
|
function getWethAddress(chain) {
|
|
27
24
|
const chainEntry = getChainEntry(chain.id);
|
|
28
25
|
if (!chainEntry) {
|
|
29
|
-
throw new
|
|
26
|
+
throw new error_1.UnsupportedChainError(chain.id);
|
|
30
27
|
}
|
|
31
28
|
const wethToken = chainEntry.tokens.find((token) => token.symbol === 'WETH');
|
|
32
29
|
if (!wethToken) {
|
|
33
|
-
throw new
|
|
30
|
+
throw new error_1.UnsupportedTokenError('WETH', chain.id);
|
|
34
31
|
}
|
|
35
32
|
return wethToken.address;
|
|
36
33
|
}
|
|
37
34
|
function getTokenSymbol(tokenAddress, chainId) {
|
|
38
35
|
const chainEntry = getChainEntry(chainId);
|
|
39
36
|
if (!chainEntry) {
|
|
40
|
-
throw new
|
|
37
|
+
throw new error_1.UnsupportedChainError(chainId);
|
|
41
38
|
}
|
|
42
39
|
const token = chainEntry.tokens.find((t) => t.address.toLowerCase() === tokenAddress.toLowerCase());
|
|
43
40
|
if (!token) {
|
|
44
|
-
throw new
|
|
41
|
+
throw new error_1.UnsupportedTokenError(tokenAddress, chainId);
|
|
45
42
|
}
|
|
46
43
|
return token.symbol;
|
|
47
44
|
}
|
|
48
45
|
function getTokenAddress(tokenSymbol, chainId) {
|
|
49
|
-
if (chainId ===
|
|
50
|
-
throw new
|
|
46
|
+
if (chainId === chains_1.polygon.id && tokenSymbol === 'ETH') {
|
|
47
|
+
throw new error_1.UnsupportedTokenError(tokenSymbol, chainId);
|
|
48
|
+
}
|
|
49
|
+
if (chainId === chains_1.sonic.id && tokenSymbol !== 'USDC') {
|
|
50
|
+
throw new error_1.UnsupportedTokenError(tokenSymbol, chainId);
|
|
51
51
|
}
|
|
52
52
|
if (tokenSymbol === 'ETH') {
|
|
53
53
|
return viem_1.zeroAddress;
|
|
54
54
|
}
|
|
55
55
|
const chainEntry = getChainEntry(chainId);
|
|
56
56
|
if (!chainEntry) {
|
|
57
|
-
throw new
|
|
57
|
+
throw new error_1.UnsupportedChainError(chainId);
|
|
58
58
|
}
|
|
59
59
|
const token = chainEntry.tokens.find((t) => t.symbol === tokenSymbol);
|
|
60
60
|
if (!token) {
|
|
61
|
-
throw new
|
|
61
|
+
throw new error_1.UnsupportedTokenError(tokenSymbol, chainId);
|
|
62
62
|
}
|
|
63
63
|
return token.address;
|
|
64
64
|
}
|
|
65
|
+
function isChainIdSupported(chainId) {
|
|
66
|
+
const chainIds = shared_configs_1.chains.map((chain) => chain.id);
|
|
67
|
+
return chainIds.includes(chainId);
|
|
68
|
+
}
|
|
65
69
|
function getChainById(chainId) {
|
|
66
|
-
const
|
|
67
|
-
chains_1.mainnet,
|
|
68
|
-
chains_1.sepolia,
|
|
69
|
-
chains_1.base,
|
|
70
|
-
chains_1.baseSepolia,
|
|
71
|
-
chains_1.arbitrum,
|
|
72
|
-
chains_1.arbitrumSepolia,
|
|
73
|
-
chains_1.optimism,
|
|
74
|
-
chains_1.optimismSepolia,
|
|
75
|
-
chains_1.polygon,
|
|
76
|
-
chains_1.
|
|
77
|
-
chains_1.
|
|
78
|
-
|
|
79
|
-
|
|
70
|
+
const chains = {
|
|
71
|
+
[chains_1.mainnet.id]: chains_1.mainnet,
|
|
72
|
+
[chains_1.sepolia.id]: chains_1.sepolia,
|
|
73
|
+
[chains_1.base.id]: chains_1.base,
|
|
74
|
+
[chains_1.baseSepolia.id]: chains_1.baseSepolia,
|
|
75
|
+
[chains_1.arbitrum.id]: chains_1.arbitrum,
|
|
76
|
+
[chains_1.arbitrumSepolia.id]: chains_1.arbitrumSepolia,
|
|
77
|
+
[chains_1.optimism.id]: chains_1.optimism,
|
|
78
|
+
[chains_1.optimismSepolia.id]: chains_1.optimismSepolia,
|
|
79
|
+
[chains_1.polygon.id]: chains_1.polygon,
|
|
80
|
+
[chains_1.soneium.id]: chains_1.soneium,
|
|
81
|
+
[chains_1.sonic.id]: chains_1.sonic,
|
|
82
|
+
};
|
|
83
|
+
if (!isChainIdSupported(chainId)) {
|
|
84
|
+
throw new error_1.UnsupportedChainError(chainId);
|
|
85
|
+
}
|
|
86
|
+
return chains[chainId];
|
|
80
87
|
}
|
|
81
88
|
function isTestnet(chainId) {
|
|
82
89
|
const chain = getChainById(chainId);
|
|
83
|
-
if (!chain) {
|
|
84
|
-
throw new Error(`Chain not supported: ${chainId}`);
|
|
85
|
-
}
|
|
86
90
|
return chain.testnet ?? false;
|
|
87
91
|
}
|
|
88
92
|
function isTokenAddressSupported(address, chainId) {
|
|
@@ -95,7 +99,7 @@ function isTokenAddressSupported(address, chainId) {
|
|
|
95
99
|
function getSupportedTokens(chainId) {
|
|
96
100
|
const chainEntry = getChainEntry(chainId);
|
|
97
101
|
if (!chainEntry) {
|
|
98
|
-
throw new
|
|
102
|
+
throw new error_1.UnsupportedChainError(chainId);
|
|
99
103
|
}
|
|
100
104
|
return chainEntry.tokens;
|
|
101
105
|
}
|
|
@@ -69,11 +69,11 @@ const UNSUPPORTED_TOKEN_ADDRESS = '0x1234567890123456789012345678901234567890';
|
|
|
69
69
|
(0, vitest_1.describe)('getChainById', () => {
|
|
70
70
|
(0, vitest_1.test)('returns correct chain for supported ID', () => {
|
|
71
71
|
const chain = (0, registry_1.getChainById)(chains_1.mainnet.id);
|
|
72
|
-
(0, vitest_1.expect)(chain
|
|
73
|
-
(0, vitest_1.expect)(chain
|
|
72
|
+
(0, vitest_1.expect)(chain.id).toBe(chains_1.mainnet.id);
|
|
73
|
+
(0, vitest_1.expect)(chain.name).toBe(chains_1.mainnet.name);
|
|
74
74
|
});
|
|
75
|
-
(0, vitest_1.test)('
|
|
76
|
-
(0, vitest_1.expect)((0, registry_1.getChainById)(UNSUPPORTED_CHAIN_ID)).
|
|
75
|
+
(0, vitest_1.test)('throws error for unsupported chain', () => {
|
|
76
|
+
(0, vitest_1.expect)(() => (0, registry_1.getChainById)(UNSUPPORTED_CHAIN_ID)).toThrow(`Unsupported chain ${UNSUPPORTED_CHAIN_ID}`);
|
|
77
77
|
});
|
|
78
78
|
});
|
|
79
79
|
(0, vitest_1.describe)('isTestnet', () => {
|
|
@@ -84,7 +84,7 @@ const UNSUPPORTED_TOKEN_ADDRESS = '0x1234567890123456789012345678901234567890';
|
|
|
84
84
|
(0, vitest_1.expect)((0, registry_1.isTestnet)(chains_1.sepolia.id)).toBe(true);
|
|
85
85
|
});
|
|
86
86
|
(0, vitest_1.test)('throws error for unsupported chain', () => {
|
|
87
|
-
(0, vitest_1.expect)(() => (0, registry_1.isTestnet)(UNSUPPORTED_CHAIN_ID)).toThrow(`
|
|
87
|
+
(0, vitest_1.expect)(() => (0, registry_1.isTestnet)(UNSUPPORTED_CHAIN_ID)).toThrow(`Unsupported chain ${UNSUPPORTED_CHAIN_ID}`);
|
|
88
88
|
});
|
|
89
89
|
});
|
|
90
90
|
(0, vitest_1.describe)('isTokenAddressSupported', () => {
|
|
@@ -104,7 +104,7 @@ const UNSUPPORTED_TOKEN_ADDRESS = '0x1234567890123456789012345678901234567890';
|
|
|
104
104
|
(0, vitest_1.expect)(tokens.find((t) => t.symbol === TOKEN_SYMBOLS.USDC)).toBeDefined();
|
|
105
105
|
});
|
|
106
106
|
(0, vitest_1.test)('throws error for unsupported chain', () => {
|
|
107
|
-
(0, vitest_1.expect)(() => (0, registry_1.getSupportedTokens)(UNSUPPORTED_CHAIN_ID)).toThrow(`
|
|
107
|
+
(0, vitest_1.expect)(() => (0, registry_1.getSupportedTokens)(UNSUPPORTED_CHAIN_ID)).toThrow(`Unsupported chain ${UNSUPPORTED_CHAIN_ID}`);
|
|
108
108
|
});
|
|
109
109
|
});
|
|
110
110
|
(0, vitest_1.describe)('getDefaultAccountAccessList', () => {
|
|
@@ -128,7 +128,7 @@ const UNSUPPORTED_TOKEN_ADDRESS = '0x1234567890123456789012345678901234567890';
|
|
|
128
128
|
(0, vitest_1.expect)(result).toBe(TOKEN_ADDRESSES.ETHEREUM_USDC);
|
|
129
129
|
});
|
|
130
130
|
(0, vitest_1.test)('throw error for unsupported token', () => {
|
|
131
|
-
(0, vitest_1.expect)(() => (0, registry_1.resolveTokenAddress)(TOKEN_SYMBOLS.USDT, chains_1.baseSepolia.id)).toThrow(`Unsupported token
|
|
131
|
+
(0, vitest_1.expect)(() => (0, registry_1.resolveTokenAddress)(TOKEN_SYMBOLS.USDT, chains_1.baseSepolia.id)).toThrow(`Unsupported token ${TOKEN_SYMBOLS.USDT} for chain ${chains_1.baseSepolia.id}`);
|
|
132
132
|
});
|
|
133
133
|
(0, vitest_1.test)('throws error for unsupported chain', () => {
|
|
134
134
|
(0, vitest_1.expect)(() => (0, registry_1.resolveTokenAddress)(TOKEN_SYMBOLS.USDC, UNSUPPORTED_CHAIN_ID)).toThrow(`Unsupported chain ${UNSUPPORTED_CHAIN_ID}`);
|
|
@@ -1,15 +1,9 @@
|
|
|
1
|
+
import type { SupportedChain, SupportedMainnet, SupportedOPStackMainnet, SupportedOPStackTestnet, SupportedTestnet } from '@rhinestone/shared-configs';
|
|
1
2
|
import type { Address, Hex } from 'viem';
|
|
2
|
-
import type { UserOperationReceipt } from 'viem/account-abstraction';
|
|
3
|
-
import type { arbitrum, arbitrumSepolia, base, baseSepolia, mainnet, optimism, optimismSepolia, polygon, sepolia, soneium, zksync } from 'viem/chains';
|
|
4
|
-
type SupportedTestnet = typeof sepolia.id | typeof baseSepolia.id | typeof arbitrumSepolia.id | typeof optimismSepolia.id;
|
|
5
|
-
type SupportedMainnet = typeof mainnet.id | typeof base.id | typeof arbitrum.id | typeof optimism.id | typeof polygon.id | typeof zksync.id | typeof soneium.id;
|
|
6
|
-
type SupportedOPStackMainnet = typeof optimism.id | typeof base.id | typeof soneium.id;
|
|
7
|
-
type SupportedOPStackTestnet = typeof optimismSepolia.id | typeof baseSepolia.id;
|
|
8
|
-
type SupportedChain = SupportedMainnet | SupportedTestnet;
|
|
9
3
|
type SupportedTokenSymbol = 'ETH' | 'WETH' | 'USDC' | 'USDT';
|
|
10
4
|
type SupportedToken = SupportedTokenSymbol | Address;
|
|
11
|
-
type
|
|
12
|
-
type AccountStatus = 'NOT_DEPLOYED' |
|
|
5
|
+
type AccountType = 'GENERIC' | 'ERC7579' | 'EOA';
|
|
6
|
+
type AccountStatus = 'NOT_DEPLOYED' | AccountType;
|
|
13
7
|
declare const INTENT_STATUS_PENDING = "PENDING";
|
|
14
8
|
declare const INTENT_STATUS_FAILED = "FAILED";
|
|
15
9
|
declare const INTENT_STATUS_EXPIRED = "EXPIRED";
|
|
@@ -46,6 +40,18 @@ interface Execution {
|
|
|
46
40
|
value: bigint;
|
|
47
41
|
data: Hex;
|
|
48
42
|
}
|
|
43
|
+
export type SettlementLayer = 'SAME_CHAIN' | 'ACROSS' | 'ECO' | 'RELAY';
|
|
44
|
+
interface IntentOptions {
|
|
45
|
+
topupCompact: boolean;
|
|
46
|
+
feeToken?: Address | SupportedTokenSymbol;
|
|
47
|
+
sponsorSettings?: SponsorSettings;
|
|
48
|
+
settlementLayers?: SettlementLayer[];
|
|
49
|
+
}
|
|
50
|
+
interface SponsorSettings {
|
|
51
|
+
gasSponsored: boolean;
|
|
52
|
+
bridgeFeesSponsored: boolean;
|
|
53
|
+
swapFeesSponsored: boolean;
|
|
54
|
+
}
|
|
49
55
|
interface PortfolioToken {
|
|
50
56
|
symbol: string;
|
|
51
57
|
decimals: number;
|
|
@@ -66,11 +72,14 @@ type Portfolio = PortfolioToken[];
|
|
|
66
72
|
interface IntentInput {
|
|
67
73
|
account: {
|
|
68
74
|
address: Address;
|
|
69
|
-
accountType:
|
|
75
|
+
accountType: AccountType;
|
|
70
76
|
setupOps: {
|
|
71
77
|
to: Address;
|
|
72
78
|
data: Hex;
|
|
73
79
|
}[];
|
|
80
|
+
delegations?: Record<number, {
|
|
81
|
+
contract: Address;
|
|
82
|
+
}>;
|
|
74
83
|
};
|
|
75
84
|
destinationChainId: number;
|
|
76
85
|
destinationExecutions: Execution[];
|
|
@@ -80,8 +89,9 @@ interface IntentInput {
|
|
|
80
89
|
amount?: bigint;
|
|
81
90
|
}[];
|
|
82
91
|
accountAccessList?: AccountAccessList;
|
|
92
|
+
options: IntentOptions;
|
|
83
93
|
}
|
|
84
|
-
type SettlementSystem = 'SAME_CHAIN' | 'ACROSS';
|
|
94
|
+
type SettlementSystem = 'SAME_CHAIN' | 'ACROSS' | 'RELAY';
|
|
85
95
|
interface IntentCost {
|
|
86
96
|
hasFulfilledAll: boolean;
|
|
87
97
|
tokensReceived: [
|
|
@@ -102,24 +112,37 @@ interface IntentCost {
|
|
|
102
112
|
};
|
|
103
113
|
};
|
|
104
114
|
}
|
|
115
|
+
interface IntentOpElementMandate {
|
|
116
|
+
recipient: Address;
|
|
117
|
+
tokenOut: [[string, string]];
|
|
118
|
+
destinationChainId: string;
|
|
119
|
+
fillDeadline: string;
|
|
120
|
+
destinationOps: Execution[];
|
|
121
|
+
preClaimOps: Execution[];
|
|
122
|
+
qualifier: {
|
|
123
|
+
settlementContext: {
|
|
124
|
+
settlementLayer: SettlementLayer;
|
|
125
|
+
usingJIT: boolean;
|
|
126
|
+
using7579: boolean;
|
|
127
|
+
};
|
|
128
|
+
encodedVal: Hex;
|
|
129
|
+
};
|
|
130
|
+
v: number;
|
|
131
|
+
minGas: bigint;
|
|
132
|
+
}
|
|
105
133
|
interface IntentOpElement {
|
|
106
134
|
arbiter: Address;
|
|
107
135
|
chainId: string;
|
|
108
136
|
idsAndAmounts: [[string, string]];
|
|
109
137
|
beforeFill: boolean;
|
|
110
|
-
smartAccountStatus:
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
destinationOps: Execution[];
|
|
117
|
-
preClaimOps: Execution[];
|
|
118
|
-
qualifier: {
|
|
119
|
-
settlementSystem: SettlementSystem;
|
|
120
|
-
encodedVal: Hex;
|
|
121
|
-
};
|
|
138
|
+
smartAccountStatus: {
|
|
139
|
+
accountType: 'smartAccount';
|
|
140
|
+
isDeployed: boolean;
|
|
141
|
+
isERC7579: boolean;
|
|
142
|
+
erc7579AccountType: string;
|
|
143
|
+
erc7579AccountVersion: string;
|
|
122
144
|
};
|
|
145
|
+
mandate: IntentOpElementMandate;
|
|
123
146
|
}
|
|
124
147
|
interface IntentOp {
|
|
125
148
|
sponsor: Address;
|
|
@@ -128,7 +151,7 @@ interface IntentOp {
|
|
|
128
151
|
elements: IntentOpElement[];
|
|
129
152
|
serverSignature: string;
|
|
130
153
|
signedMetadata: {
|
|
131
|
-
quotes: unknown
|
|
154
|
+
quotes: Record<Address, unknown[]>;
|
|
132
155
|
tokenPrices: Record<string, number>;
|
|
133
156
|
opGasParams: Record<string, {
|
|
134
157
|
l1BaseFee: string;
|
|
@@ -139,8 +162,49 @@ interface IntentOp {
|
|
|
139
162
|
estimatedCalldataSize: number;
|
|
140
163
|
};
|
|
141
164
|
gasPrices: Record<string, string>;
|
|
165
|
+
account: AccountWithContext;
|
|
142
166
|
};
|
|
143
167
|
}
|
|
168
|
+
interface Account {
|
|
169
|
+
address: Address;
|
|
170
|
+
accountType: AccountType;
|
|
171
|
+
setupOps: Pick<Execution, 'to' | 'data'>[];
|
|
172
|
+
delegations?: Delegations;
|
|
173
|
+
emissaryConfig?: EmissarySetupConfig;
|
|
174
|
+
}
|
|
175
|
+
type AccountWithContext = Omit<Account, 'delegations'> & {
|
|
176
|
+
accountContext: {
|
|
177
|
+
[chainId: number]: AccountStatus;
|
|
178
|
+
};
|
|
179
|
+
requiredDelegations?: Delegations;
|
|
180
|
+
};
|
|
181
|
+
interface Delegation {
|
|
182
|
+
contract: Address;
|
|
183
|
+
}
|
|
184
|
+
type Delegations = Record<number, Delegation>;
|
|
185
|
+
interface EmissarySetupConfig {
|
|
186
|
+
configId: number;
|
|
187
|
+
validatorAddress: Address;
|
|
188
|
+
emissaryAddress: Address;
|
|
189
|
+
emissaryConfig: EmissaryConfig;
|
|
190
|
+
emissaryEnable: EmissaryEnable;
|
|
191
|
+
}
|
|
192
|
+
interface EmissaryConfig {
|
|
193
|
+
configId: number;
|
|
194
|
+
allocator: Address;
|
|
195
|
+
scope: number;
|
|
196
|
+
resetPeriod: number;
|
|
197
|
+
validator: Address;
|
|
198
|
+
validatorConfig: Hex;
|
|
199
|
+
}
|
|
200
|
+
interface EmissaryEnable {
|
|
201
|
+
allocatorSig: Hex;
|
|
202
|
+
userSig: Hex;
|
|
203
|
+
expires: bigint;
|
|
204
|
+
nonce: bigint;
|
|
205
|
+
allChainIds: bigint[];
|
|
206
|
+
chainIndex: bigint;
|
|
207
|
+
}
|
|
144
208
|
interface IntentRoute {
|
|
145
209
|
intentOp: IntentOp;
|
|
146
210
|
intentCost: IntentCost;
|
|
@@ -154,6 +218,14 @@ interface IntentResult {
|
|
|
154
218
|
type SignedIntentOp = IntentOp & {
|
|
155
219
|
originSignatures: Hex[];
|
|
156
220
|
destinationSignature: Hex;
|
|
221
|
+
signedAuthorizations?: readonly {
|
|
222
|
+
chainId: number;
|
|
223
|
+
address: Address;
|
|
224
|
+
nonce: number;
|
|
225
|
+
yParity: number;
|
|
226
|
+
r: Hex;
|
|
227
|
+
s: Hex;
|
|
228
|
+
}[];
|
|
157
229
|
};
|
|
158
230
|
interface TokenConfig {
|
|
159
231
|
symbol: string;
|
|
@@ -183,10 +255,6 @@ interface IntentOpStatus {
|
|
|
183
255
|
fillTransactionHash?: Hex;
|
|
184
256
|
claims: Claim[];
|
|
185
257
|
}
|
|
186
|
-
interface UserOpStatus {
|
|
187
|
-
type: 'userop';
|
|
188
|
-
receipt: UserOperationReceipt;
|
|
189
|
-
}
|
|
190
258
|
interface PortfolioTokenChainResponse {
|
|
191
259
|
chainId: number;
|
|
192
260
|
accountStatus: AccountStatus;
|
|
@@ -206,6 +274,6 @@ interface PortfolioTokenResponse {
|
|
|
206
274
|
tokenChainBalance: PortfolioTokenChainResponse[];
|
|
207
275
|
}
|
|
208
276
|
type PortfolioResponse = PortfolioTokenResponse[];
|
|
209
|
-
export type { TokenConfig, SupportedChain, SettlementSystem, IntentInput, IntentCost, IntentRoute, IntentOp, IntentOpElement, SignedIntentOp, IntentOpStatus,
|
|
277
|
+
export type { TokenConfig, SupportedChain, SettlementSystem, IntentInput, IntentCost, IntentRoute, IntentOp, IntentOpElement, IntentOpElementMandate, SignedIntentOp, IntentOpStatus, IntentResult, PortfolioTokenResponse, PortfolioResponse, Portfolio, PortfolioToken, MappedChainTokenAccessList, UnmappedChainTokenAccessList, };
|
|
210
278
|
export { INTENT_STATUS_PENDING, INTENT_STATUS_FAILED, INTENT_STATUS_EXPIRED, INTENT_STATUS_PARTIALLY_COMPLETED, INTENT_STATUS_COMPLETED, INTENT_STATUS_FILLED, INTENT_STATUS_PRECONFIRMED, INTENT_STATUS_UNKNOWN, };
|
|
211
279
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../orchestrator/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../orchestrator/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,gBAAgB,EAChB,uBAAuB,EACvB,uBAAuB,EACvB,gBAAgB,EACjB,MAAM,4BAA4B,CAAA;AACnC,OAAO,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,MAAM,CAAA;AAExC,KAAK,oBAAoB,GAAG,KAAK,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,CAAA;AAC5D,KAAK,cAAc,GAAG,oBAAoB,GAAG,OAAO,CAAA;AAEpD,KAAK,WAAW,GAAG,SAAS,GAAG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,CAAA;KACjB,CAAA;CACF;AAED,UAAU,sBAAsB;IAC9B,SAAS,EAAE,KAAK,CAAA;IAChB,aAAa,EAAE,EAAE,CAAA;IACjB,OAAO,EAAE;QACP,MAAM,EAAE,MAAM,CAAA;QACd,QAAQ,EAAE,MAAM,CAAA;KACjB,CAAA;IACD,iBAAiB,EAAE,2BAA2B,EAAE,CAAA;CACjD;AAED,KAAK,iBAAiB,GAAG,sBAAsB,EAAE,CAAA;AAEjD,YAAY,EACV,WAAW,EACX,cAAc,EACd,gBAAgB,EAChB,WAAW,EACX,UAAU,EACV,WAAW,EACX,QAAQ,EACR,eAAe,EACf,sBAAsB,EACtB,cAAc,EACd,cAAc,EACd,YAAY,EACZ,sBAAsB,EACtB,iBAAiB,EACjB,SAAS,EACT,cAAc,EACd,0BAA0B,EAC1B,4BAA4B,GAC7B,CAAA;AACD,OAAO,EACL,qBAAqB,EACrB,oBAAoB,EACpB,qBAAqB,EACrB,iCAAiC,EACjC,uBAAuB,EACvB,oBAAoB,EACpB,0BAA0B,EAC1B,qBAAqB,GACtB,CAAA"}
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import type { IntentOp } from './types';
|
|
2
|
-
declare function getIntentOpHash(intentOp: IntentOp): `0x${string}`;
|
|
3
1
|
declare function convertBigIntFields(obj: any): any;
|
|
4
|
-
export {
|
|
2
|
+
export { convertBigIntFields };
|
|
5
3
|
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../orchestrator/utils.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../orchestrator/utils.ts"],"names":[],"mappings":"AAAA,iBAAS,mBAAmB,CAAC,GAAG,EAAE,GAAG,GAAG,GAAG,CAwB1C;AAED,OAAO,EAAE,mBAAmB,EAAE,CAAA"}
|