@rhinestone/sdk 1.0.0-beta.39 → 1.0.0-beta.40
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/errors/index.d.ts +2 -2
- package/dist/src/errors/index.d.ts.map +1 -1
- package/dist/src/errors/index.js +16 -1
- package/dist/src/execution/compact.d.ts +2 -2
- package/dist/src/execution/compact.d.ts.map +1 -1
- package/dist/src/execution/compact.js +2 -2
- package/dist/src/execution/index.d.ts.map +1 -1
- package/dist/src/execution/index.js +2 -2
- package/dist/src/execution/permit2.d.ts +2 -2
- package/dist/src/execution/permit2.d.ts.map +1 -1
- package/dist/src/execution/permit2.js +28 -19
- package/dist/src/execution/types.d.ts +2 -1
- package/dist/src/execution/types.d.ts.map +1 -1
- package/dist/src/execution/utils.d.ts +7 -3
- package/dist/src/execution/utils.d.ts.map +1 -1
- package/dist/src/execution/utils.js +55 -37
- package/dist/src/orchestrator/client.d.ts.map +1 -1
- package/dist/src/orchestrator/client.js +145 -52
- package/dist/src/orchestrator/error.d.ts +111 -1
- package/dist/src/orchestrator/error.d.ts.map +1 -1
- package/dist/src/orchestrator/error.js +128 -1
- package/dist/src/orchestrator/index.d.ts +2 -2
- package/dist/src/orchestrator/index.d.ts.map +1 -1
- package/dist/src/orchestrator/index.js +16 -1
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AccountConfigurationNotSupportedError, AccountError, Eip7702AccountMustHaveEoaError, Eip7702NotSupportedForAccountError, ExistingEip7702AccountsNotSupportedError, FactoryArgsNotAvailableError, isAccountError, SigningNotSupportedForAccountError, SmartSessionsNotEnabledError, WalletClientNoConnectedAccountError } from '../accounts';
|
|
2
2
|
import { ExecutionError, IntentFailedError, isExecutionError, OrderPathRequiredForIntentsError, SessionChainRequiredError, SignerNotSupportedError } from '../execution';
|
|
3
|
-
import { AuthenticationRequiredError, InsufficientBalanceError, IntentNotFoundError, InvalidApiKeyError, InvalidIntentSignatureError, isOrchestratorError, NoPathFoundError, OnlyOneTargetTokenAmountCanBeUnsetError, OrchestratorError, TokenNotSupportedError, UnsupportedChainError, UnsupportedChainIdError, UnsupportedTokenError } from '../orchestrator';
|
|
4
|
-
export { isAccountError, AccountError, AccountConfigurationNotSupportedError, Eip7702AccountMustHaveEoaError, ExistingEip7702AccountsNotSupportedError, FactoryArgsNotAvailableError, SmartSessionsNotEnabledError, SigningNotSupportedForAccountError, Eip7702NotSupportedForAccountError, WalletClientNoConnectedAccountError, isExecutionError, ExecutionError, IntentFailedError, OrderPathRequiredForIntentsError, SessionChainRequiredError, SignerNotSupportedError, isOrchestratorError, AuthenticationRequiredError, InsufficientBalanceError, InvalidApiKeyError, InvalidIntentSignatureError, NoPathFoundError, OnlyOneTargetTokenAmountCanBeUnsetError, OrchestratorError, IntentNotFoundError, TokenNotSupportedError, UnsupportedChainError, UnsupportedChainIdError, UnsupportedTokenError, };
|
|
3
|
+
import { AuthenticationRequiredError, BadRequestError, BodyParserError, ConflictError, ForbiddenError, InsufficientBalanceError, IntentNotFoundError, InternalServerError, InvalidApiKeyError, InvalidIntentSignatureError, isAuthError, isOrchestratorError, isRateLimited, isRetryable, isValidationError, NoPathFoundError, OnlyOneTargetTokenAmountCanBeUnsetError, OrchestratorError, RateLimitedError, ResourceNotFoundError, SchemaValidationError, ServiceUnavailableError, TokenNotSupportedError, UnauthorizedError, UnprocessableEntityError, UnsupportedChainError, UnsupportedChainIdError, UnsupportedTokenError } from '../orchestrator';
|
|
4
|
+
export { isAccountError, AccountError, AccountConfigurationNotSupportedError, Eip7702AccountMustHaveEoaError, ExistingEip7702AccountsNotSupportedError, FactoryArgsNotAvailableError, SmartSessionsNotEnabledError, SigningNotSupportedForAccountError, Eip7702NotSupportedForAccountError, WalletClientNoConnectedAccountError, isExecutionError, ExecutionError, IntentFailedError, OrderPathRequiredForIntentsError, SessionChainRequiredError, SignerNotSupportedError, isOrchestratorError, isRetryable, isAuthError, isValidationError, isRateLimited, AuthenticationRequiredError, BadRequestError, BodyParserError, ConflictError, ForbiddenError, InsufficientBalanceError, InvalidApiKeyError, InvalidIntentSignatureError, NoPathFoundError, OnlyOneTargetTokenAmountCanBeUnsetError, OrchestratorError, IntentNotFoundError, InternalServerError, ResourceNotFoundError, RateLimitedError, SchemaValidationError, ServiceUnavailableError, UnprocessableEntityError, UnauthorizedError, TokenNotSupportedError, UnsupportedChainError, UnsupportedChainIdError, 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,8BAA8B,EAC9B,kCAAkC,EAClC,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,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,iBAAiB,CAAA;AAExB,OAAO,EAEL,cAAc,EACd,YAAY,EACZ,qCAAqC,EACrC,8BAA8B,EAC9B,wCAAwC,EACxC,4BAA4B,EAC5B,4BAA4B,EAC5B,kCAAkC,EAClC,kCAAkC,EAClC,mCAAmC,EAEnC,gBAAgB,EAChB,cAAc,EACd,iBAAiB,EACjB,gCAAgC,EAChC,yBAAyB,EACzB,uBAAuB,EAEvB,mBAAmB,EACnB,2BAA2B,EAC3B,wBAAwB,EACxB,kBAAkB,EAClB,2BAA2B,EAC3B,gBAAgB,EAChB,uCAAuC,EACvC,iBAAiB,EACjB,mBAAmB,EACnB,sBAAsB,EACtB,qBAAqB,EACrB,uBAAuB,EACvB,qBAAqB,GACtB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../errors/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qCAAqC,EACrC,YAAY,EACZ,8BAA8B,EAC9B,kCAAkC,EAClC,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,eAAe,EACf,eAAe,EACf,aAAa,EACb,cAAc,EACd,wBAAwB,EACxB,mBAAmB,EACnB,mBAAmB,EACnB,kBAAkB,EAClB,2BAA2B,EAC3B,WAAW,EACX,mBAAmB,EACnB,aAAa,EACb,WAAW,EACX,iBAAiB,EACjB,gBAAgB,EAChB,uCAAuC,EACvC,iBAAiB,EACjB,gBAAgB,EAChB,qBAAqB,EACrB,qBAAqB,EACrB,uBAAuB,EACvB,sBAAsB,EACtB,iBAAiB,EACjB,wBAAwB,EACxB,qBAAqB,EACrB,uBAAuB,EACvB,qBAAqB,EACtB,MAAM,iBAAiB,CAAA;AAExB,OAAO,EAEL,cAAc,EACd,YAAY,EACZ,qCAAqC,EACrC,8BAA8B,EAC9B,wCAAwC,EACxC,4BAA4B,EAC5B,4BAA4B,EAC5B,kCAAkC,EAClC,kCAAkC,EAClC,mCAAmC,EAEnC,gBAAgB,EAChB,cAAc,EACd,iBAAiB,EACjB,gCAAgC,EAChC,yBAAyB,EACzB,uBAAuB,EAEvB,mBAAmB,EACnB,WAAW,EACX,WAAW,EACX,iBAAiB,EACjB,aAAa,EACb,2BAA2B,EAC3B,eAAe,EACf,eAAe,EACf,aAAa,EACb,cAAc,EACd,wBAAwB,EACxB,kBAAkB,EAClB,2BAA2B,EAC3B,gBAAgB,EAChB,uCAAuC,EACvC,iBAAiB,EACjB,mBAAmB,EACnB,mBAAmB,EACnB,qBAAqB,EACrB,gBAAgB,EAChB,qBAAqB,EACrB,uBAAuB,EACvB,wBAAwB,EACxB,iBAAiB,EACjB,sBAAsB,EACtB,qBAAqB,EACrB,uBAAuB,EACvB,qBAAqB,GACtB,CAAA"}
|
package/dist/src/errors/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
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.isOrchestratorError = exports.SignerNotSupportedError = exports.SessionChainRequiredError = exports.OrderPathRequiredForIntentsError = exports.IntentFailedError = exports.ExecutionError = exports.isExecutionError = exports.WalletClientNoConnectedAccountError = exports.Eip7702NotSupportedForAccountError = exports.SigningNotSupportedForAccountError = exports.SmartSessionsNotEnabledError = exports.FactoryArgsNotAvailableError = exports.ExistingEip7702AccountsNotSupportedError = exports.Eip7702AccountMustHaveEoaError = exports.AccountConfigurationNotSupportedError = exports.AccountError = exports.isAccountError = void 0;
|
|
3
|
+
exports.UnsupportedTokenError = exports.UnsupportedChainIdError = exports.UnsupportedChainError = exports.TokenNotSupportedError = exports.UnauthorizedError = exports.UnprocessableEntityError = exports.ServiceUnavailableError = exports.SchemaValidationError = exports.RateLimitedError = exports.ResourceNotFoundError = exports.InternalServerError = exports.IntentNotFoundError = exports.OrchestratorError = exports.OnlyOneTargetTokenAmountCanBeUnsetError = exports.NoPathFoundError = exports.InvalidIntentSignatureError = exports.InvalidApiKeyError = exports.InsufficientBalanceError = exports.ForbiddenError = exports.ConflictError = exports.BodyParserError = exports.BadRequestError = exports.AuthenticationRequiredError = exports.isRateLimited = exports.isValidationError = exports.isAuthError = exports.isRetryable = exports.isOrchestratorError = exports.SignerNotSupportedError = exports.SessionChainRequiredError = exports.OrderPathRequiredForIntentsError = exports.IntentFailedError = exports.ExecutionError = exports.isExecutionError = exports.WalletClientNoConnectedAccountError = exports.Eip7702NotSupportedForAccountError = exports.SigningNotSupportedForAccountError = exports.SmartSessionsNotEnabledError = exports.FactoryArgsNotAvailableError = exports.ExistingEip7702AccountsNotSupportedError = exports.Eip7702AccountMustHaveEoaError = exports.AccountConfigurationNotSupportedError = exports.AccountError = exports.isAccountError = void 0;
|
|
4
4
|
const accounts_1 = require("../accounts");
|
|
5
5
|
Object.defineProperty(exports, "AccountConfigurationNotSupportedError", { enumerable: true, get: function () { return accounts_1.AccountConfigurationNotSupportedError; } });
|
|
6
6
|
Object.defineProperty(exports, "AccountError", { enumerable: true, get: function () { return accounts_1.AccountError; } });
|
|
@@ -21,15 +21,30 @@ Object.defineProperty(exports, "SessionChainRequiredError", { enumerable: true,
|
|
|
21
21
|
Object.defineProperty(exports, "SignerNotSupportedError", { enumerable: true, get: function () { return execution_1.SignerNotSupportedError; } });
|
|
22
22
|
const orchestrator_1 = require("../orchestrator");
|
|
23
23
|
Object.defineProperty(exports, "AuthenticationRequiredError", { enumerable: true, get: function () { return orchestrator_1.AuthenticationRequiredError; } });
|
|
24
|
+
Object.defineProperty(exports, "BadRequestError", { enumerable: true, get: function () { return orchestrator_1.BadRequestError; } });
|
|
25
|
+
Object.defineProperty(exports, "BodyParserError", { enumerable: true, get: function () { return orchestrator_1.BodyParserError; } });
|
|
26
|
+
Object.defineProperty(exports, "ConflictError", { enumerable: true, get: function () { return orchestrator_1.ConflictError; } });
|
|
27
|
+
Object.defineProperty(exports, "ForbiddenError", { enumerable: true, get: function () { return orchestrator_1.ForbiddenError; } });
|
|
24
28
|
Object.defineProperty(exports, "InsufficientBalanceError", { enumerable: true, get: function () { return orchestrator_1.InsufficientBalanceError; } });
|
|
25
29
|
Object.defineProperty(exports, "IntentNotFoundError", { enumerable: true, get: function () { return orchestrator_1.IntentNotFoundError; } });
|
|
30
|
+
Object.defineProperty(exports, "InternalServerError", { enumerable: true, get: function () { return orchestrator_1.InternalServerError; } });
|
|
26
31
|
Object.defineProperty(exports, "InvalidApiKeyError", { enumerable: true, get: function () { return orchestrator_1.InvalidApiKeyError; } });
|
|
27
32
|
Object.defineProperty(exports, "InvalidIntentSignatureError", { enumerable: true, get: function () { return orchestrator_1.InvalidIntentSignatureError; } });
|
|
33
|
+
Object.defineProperty(exports, "isAuthError", { enumerable: true, get: function () { return orchestrator_1.isAuthError; } });
|
|
28
34
|
Object.defineProperty(exports, "isOrchestratorError", { enumerable: true, get: function () { return orchestrator_1.isOrchestratorError; } });
|
|
35
|
+
Object.defineProperty(exports, "isRateLimited", { enumerable: true, get: function () { return orchestrator_1.isRateLimited; } });
|
|
36
|
+
Object.defineProperty(exports, "isRetryable", { enumerable: true, get: function () { return orchestrator_1.isRetryable; } });
|
|
37
|
+
Object.defineProperty(exports, "isValidationError", { enumerable: true, get: function () { return orchestrator_1.isValidationError; } });
|
|
29
38
|
Object.defineProperty(exports, "NoPathFoundError", { enumerable: true, get: function () { return orchestrator_1.NoPathFoundError; } });
|
|
30
39
|
Object.defineProperty(exports, "OnlyOneTargetTokenAmountCanBeUnsetError", { enumerable: true, get: function () { return orchestrator_1.OnlyOneTargetTokenAmountCanBeUnsetError; } });
|
|
31
40
|
Object.defineProperty(exports, "OrchestratorError", { enumerable: true, get: function () { return orchestrator_1.OrchestratorError; } });
|
|
41
|
+
Object.defineProperty(exports, "RateLimitedError", { enumerable: true, get: function () { return orchestrator_1.RateLimitedError; } });
|
|
42
|
+
Object.defineProperty(exports, "ResourceNotFoundError", { enumerable: true, get: function () { return orchestrator_1.ResourceNotFoundError; } });
|
|
43
|
+
Object.defineProperty(exports, "SchemaValidationError", { enumerable: true, get: function () { return orchestrator_1.SchemaValidationError; } });
|
|
44
|
+
Object.defineProperty(exports, "ServiceUnavailableError", { enumerable: true, get: function () { return orchestrator_1.ServiceUnavailableError; } });
|
|
32
45
|
Object.defineProperty(exports, "TokenNotSupportedError", { enumerable: true, get: function () { return orchestrator_1.TokenNotSupportedError; } });
|
|
46
|
+
Object.defineProperty(exports, "UnauthorizedError", { enumerable: true, get: function () { return orchestrator_1.UnauthorizedError; } });
|
|
47
|
+
Object.defineProperty(exports, "UnprocessableEntityError", { enumerable: true, get: function () { return orchestrator_1.UnprocessableEntityError; } });
|
|
33
48
|
Object.defineProperty(exports, "UnsupportedChainError", { enumerable: true, get: function () { return orchestrator_1.UnsupportedChainError; } });
|
|
34
49
|
Object.defineProperty(exports, "UnsupportedChainIdError", { enumerable: true, get: function () { return orchestrator_1.UnsupportedChainIdError; } });
|
|
35
50
|
Object.defineProperty(exports, "UnsupportedTokenError", { enumerable: true, get: function () { return orchestrator_1.UnsupportedTokenError; } });
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type Hex } from 'viem';
|
|
2
|
-
import type { IntentOp } from '../orchestrator/types';
|
|
2
|
+
import type { IntentOp, IntentOpElement } from '../orchestrator/types';
|
|
3
3
|
declare const COMPACT_ADDRESS = "0x73d2dc0c21fca4ec1601895d50df7f5624f07d3f";
|
|
4
4
|
declare function getCompactTypedData(intentOp: IntentOp): {
|
|
5
5
|
readonly domain: {
|
|
@@ -146,6 +146,6 @@ declare function getCompactDigest(intentOp: IntentOp): Hex;
|
|
|
146
146
|
* @param intentOp The intent operation
|
|
147
147
|
* @returns The digest hash
|
|
148
148
|
*/
|
|
149
|
-
declare function getPermit2Digest(
|
|
149
|
+
declare function getPermit2Digest(element: IntentOpElement, nonce: bigint, expires: bigint): Hex;
|
|
150
150
|
export { COMPACT_ADDRESS, getCompactTypedData, getCompactDigest, getPermit2Digest, };
|
|
151
151
|
//# sourceMappingURL=compact.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compact.d.ts","sourceRoot":"","sources":["../../../execution/compact.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,GAAG,EAA0C,MAAM,MAAM,CAAA;AACvE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;
|
|
1
|
+
{"version":3,"file":"compact.d.ts","sourceRoot":"","sources":["../../../execution/compact.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,GAAG,EAA0C,MAAM,MAAM,CAAA;AACvE,OAAO,KAAK,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAGtE,QAAA,MAAM,eAAe,+CAA+C,CAAA;AA8CpE,iBAAS,mBAAmB,CAAC,QAAQ,EAAE,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAmD9C;AAED;;;;GAIG;AACH,iBAAS,gBAAgB,CAAC,QAAQ,EAAE,QAAQ,GAAG,GAAG,CAGjD;AAED;;;;GAIG;AACH,iBAAS,gBAAgB,CACvB,OAAO,EAAE,eAAe,EACxB,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,MAAM,GACd,GAAG,CAGL;AAED,OAAO,EACL,eAAe,EACf,mBAAmB,EACnB,gBAAgB,EAChB,gBAAgB,GACjB,CAAA"}
|
|
@@ -116,7 +116,7 @@ function getCompactDigest(intentOp) {
|
|
|
116
116
|
* @param intentOp The intent operation
|
|
117
117
|
* @returns The digest hash
|
|
118
118
|
*/
|
|
119
|
-
function getPermit2Digest(
|
|
120
|
-
const typedData = (0, permit2_1.getTypedData)(
|
|
119
|
+
function getPermit2Digest(element, nonce, expires) {
|
|
120
|
+
const typedData = (0, permit2_1.getTypedData)(element, nonce, expires);
|
|
121
121
|
return (0, viem_1.hashTypedData)(typedData);
|
|
122
122
|
}
|
|
@@ -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,KAAK,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAA;AAY3E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAC5D,OAAO,KAAK,EACV,aAAa,EACb,SAAS,EACT,uBAAuB,EACvB,gBAAgB,EAChB,SAAS,EACT,gBAAgB,EAChB,YAAY,EACZ,WAAW,EACX,WAAW,EACX,wBAAwB,EACzB,MAAM,UAAU,CAAA;AACjB,OAAO,EACL,cAAc,EACd,iBAAiB,EACjB,gBAAgB,EAChB,gCAAgC,EAChC,yBAAyB,EACzB,uBAAuB,EACxB,MAAM,SAAS,CAAA;AAEhB,OAAO,KAAK,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAA;AAerE,UAAU,iBAAiB;IACzB,IAAI,EAAE;QACJ,IAAI,EAAE,GAAG,GAAG,SAAS,CAAA;QACrB,OAAO,EAAE,MAAM,CAAA;KAChB,CAAA;IACD,MAAM,EAAE;QACN,IAAI,EAAE,GAAG,GAAG,SAAS,CAAA;QACrB,OAAO,EAAE,MAAM,CAAA;KAChB,EAAE,CAAA;CACJ;AAED,iBAAe,eAAe,CAC5B,MAAM,EAAE,uBAAuB,EAC/B,WAAW,EAAE,WAAW,8BAwCzB;AAED,iBAAe,iBAAiB,CAC9B,MAAM,EAAE,uBAAuB,EAC/B,WAAW,EAAE,wBAAwB,gCAqBtC;AAED,iBAAe,uBAAuB,CACpC,MAAM,EAAE,gBAAgB,EACxB,YAAY,EAAE,KA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,CAAC,CAiDnD;AAED,iBAAe,qBAAqB,CAClC,MAAM,EAAE,gBAAgB,EACxB,KAAK,EAAE,KAAK,EACZ,YAAY,EAAE,OAAO,EACrB,QAAQ,EAAE,MAAM,EAChB,SAAS,GAAE,OAAe,GACzB,OAAO,CAAC,MAAM,CAAC,CAcjB;AAED,iBAAe,YAAY,CAAC,MAAM,EAAE,gBAAgB,EAAE,UAAU,EAAE,OAAO,gDASxE;AAED,OAAO,EACL,eAAe,EACf,uBAAuB,EACvB,iBAAiB,EACjB,yBAAyB,EACzB,gBAAgB,EAChB,qBAAqB,EACrB,YAAY,EAEZ,gBAAgB,EAChB,cAAc,EACd,iBAAiB,EACjB,gCAAgC,EAChC,yBAAyB,EACzB,uBAAuB,GACxB,CAAA;AACD,YAAY,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,CAAA"}
|
|
@@ -99,11 +99,11 @@ async function sendTransactionAsIntent(config, sourceChains, targetChain, callIn
|
|
|
99
99
|
if (!intentRoute) {
|
|
100
100
|
throw new error_1.OrderPathRequiredForIntentsError();
|
|
101
101
|
}
|
|
102
|
-
const
|
|
102
|
+
const { originSignatures, destinationSignature } = await (0, utils_2.signIntent)(config, targetChain, intentRoute.intentOp, signers);
|
|
103
103
|
const authorizations = config.eoa
|
|
104
104
|
? await (0, utils_2.signAuthorizationsInternal)(config, intentRoute)
|
|
105
105
|
: [];
|
|
106
|
-
return await (0, utils_2.submitIntentInternal)(config, sourceChains, targetChain, intentRoute.intentOp,
|
|
106
|
+
return await (0, utils_2.submitIntentInternal)(config, sourceChains, targetChain, intentRoute.intentOp, originSignatures, destinationSignature, authorizations, dryRun);
|
|
107
107
|
}
|
|
108
108
|
async function waitForExecution(config, result, acceptsPreconfirmations) {
|
|
109
109
|
const validStatuses = new Set([
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { type Address, type Chain } from 'viem';
|
|
2
|
-
import type {
|
|
2
|
+
import type { IntentOpElement } from '../orchestrator/types';
|
|
3
3
|
import type { RhinestoneConfig } from '../types';
|
|
4
4
|
import type { BatchPermit2Result, MultiChainPermit2Config, MultiChainPermit2Result, TokenPermissions } from './types';
|
|
5
|
-
declare function getTypedData(
|
|
5
|
+
declare function getTypedData(element: IntentOpElement, nonce: bigint, expires: bigint): {
|
|
6
6
|
readonly domain: {
|
|
7
7
|
readonly name: "Permit2";
|
|
8
8
|
readonly chainId: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"permit2.d.ts","sourceRoot":"","sources":["../../../execution/permit2.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,OAAO,EACZ,KAAK,KAAK,EAIX,MAAM,MAAM,CAAA;AAEb,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"permit2.d.ts","sourceRoot":"","sources":["../../../execution/permit2.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,OAAO,EACZ,KAAK,KAAK,EAIX,MAAM,MAAM,CAAA;AAEb,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAC5D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAA;AAChD,OAAO,KAAK,EACV,kBAAkB,EAClB,uBAAuB,EACvB,uBAAuB,EACvB,gBAAgB,EACjB,MAAM,SAAS,CAAA;AAQhB,iBAAS,YAAY,CACnB,OAAO,EAAE,eAAe,EACxB,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA8FhB;AAED,iBAAe,yBAAyB,CACtC,KAAK,EAAE,OAAO,EACd,OAAO,EAAE,OAAO,EAChB,YAAY,EAAE,OAAO,EACrB,YAAY,EAAE,GAAG,GAChB,OAAO,CAAC,MAAM,CAAC,CAyBjB;AAED,iBAAe,mBAAmB,CAChC,YAAY,EAAE,OAAO,EACrB,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,gBAAgB,GACvB,OAAO,CAAC,MAAM,CAAC,CAuBjB;AAED;;;GAGG;AACH,iBAAS,iBAAiB,IAAI,OAAO,CAEpC;AAED;;;;;;;;;GASG;AACH,iBAAe,gBAAgB,CAC7B,OAAO,EAAE,uBAAuB,EAAE,GACjC,OAAO,CAAC,kBAAkB,CAAC,CAyE7B;AAED;;;;;;;;;;GAUG;AACH,iBAAe,qBAAqB,CAClC,OAAO,EAAE,uBAAuB,EAAE,EAClC,UAAU,CAAC,EAAE,CACX,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,uBAAuB,KAC7B,IAAI,GACR,OAAO,CAAC,kBAAkB,CAAC,CA8D7B;AAED,OAAO,EACL,YAAY,EACZ,mBAAmB,EACnB,yBAAyB,EACzB,iBAAiB,EAEjB,gBAAgB,EAChB,qBAAqB,EAErB,KAAK,uBAAuB,EAC5B,KAAK,uBAAuB,EAC5B,KAAK,kBAAkB,GACxB,CAAA"}
|
|
@@ -12,8 +12,7 @@ const PERMIT2_ADDRESS = '0x000000000022D473030F116dDEE9F6B43aC78BA3';
|
|
|
12
12
|
function toToken(id) {
|
|
13
13
|
return `0x${(id & ((1n << 160n) - 1n)).toString(16).padStart(40, '0')}`;
|
|
14
14
|
}
|
|
15
|
-
function getTypedData(
|
|
16
|
-
const element = intentOp.elements[0];
|
|
15
|
+
function getTypedData(element, nonce, expires) {
|
|
17
16
|
const tokens = element.idsAndAmounts.map(([id, amount]) => [
|
|
18
17
|
BigInt(id),
|
|
19
18
|
BigInt(amount),
|
|
@@ -30,7 +29,7 @@ function getTypedData(intentOp) {
|
|
|
30
29
|
const typedData = {
|
|
31
30
|
domain: {
|
|
32
31
|
name: 'Permit2',
|
|
33
|
-
chainId: Number(
|
|
32
|
+
chainId: Number(element.chainId),
|
|
34
33
|
verifyingContract: PERMIT2_ADDRESS,
|
|
35
34
|
},
|
|
36
35
|
types: {
|
|
@@ -73,8 +72,8 @@ function getTypedData(intentOp) {
|
|
|
73
72
|
message: {
|
|
74
73
|
permitted: tokenPermissions,
|
|
75
74
|
spender: spender,
|
|
76
|
-
nonce:
|
|
77
|
-
deadline:
|
|
75
|
+
nonce: nonce,
|
|
76
|
+
deadline: expires,
|
|
78
77
|
mandate: {
|
|
79
78
|
target: {
|
|
80
79
|
recipient: mandate.recipient,
|
|
@@ -171,16 +170,20 @@ async function signPermit2Batch(configs) {
|
|
|
171
170
|
// Process all signing operations in parallel
|
|
172
171
|
const signingPromises = configs.map(async (config) => {
|
|
173
172
|
try {
|
|
174
|
-
//
|
|
175
|
-
const typedData = getTypedData(config.intentOp);
|
|
176
|
-
// Sign with EOA account
|
|
173
|
+
// sign each element individually for this chain sequentially to preserve order
|
|
177
174
|
if (!config.eoaAccount.signTypedData) {
|
|
178
175
|
throw new Error('EOA account does not support typed data signing');
|
|
179
176
|
}
|
|
180
|
-
const
|
|
177
|
+
const originSignatures = [];
|
|
178
|
+
for (const element of config.intentOp.elements) {
|
|
179
|
+
const typedData = getTypedData(element, BigInt(config.intentOp.nonce), BigInt(config.intentOp.expires));
|
|
180
|
+
const sig = await config.eoaAccount.signTypedData(typedData);
|
|
181
|
+
originSignatures.push(sig);
|
|
182
|
+
}
|
|
181
183
|
const result = {
|
|
182
184
|
chainId: config.chain.id,
|
|
183
|
-
|
|
185
|
+
originSignatures,
|
|
186
|
+
destinationSignature: originSignatures[0] ?? '0x',
|
|
184
187
|
success: true,
|
|
185
188
|
};
|
|
186
189
|
successfulSignatures++;
|
|
@@ -189,7 +192,8 @@ async function signPermit2Batch(configs) {
|
|
|
189
192
|
catch (error) {
|
|
190
193
|
const result = {
|
|
191
194
|
chainId: config.chain.id,
|
|
192
|
-
|
|
195
|
+
originSignatures: [],
|
|
196
|
+
destinationSignature: '0x',
|
|
193
197
|
success: false,
|
|
194
198
|
error: error instanceof Error ? error : new Error(String(error)),
|
|
195
199
|
};
|
|
@@ -199,7 +203,6 @@ async function signPermit2Batch(configs) {
|
|
|
199
203
|
});
|
|
200
204
|
// Wait for all signing operations to complete
|
|
201
205
|
const signingResults = await Promise.allSettled(signingPromises);
|
|
202
|
-
// Process results
|
|
203
206
|
for (const result of signingResults) {
|
|
204
207
|
if (result.status === 'fulfilled') {
|
|
205
208
|
results.push(result.value);
|
|
@@ -209,7 +212,8 @@ async function signPermit2Batch(configs) {
|
|
|
209
212
|
failedSignatures++;
|
|
210
213
|
results.push({
|
|
211
214
|
chainId: 0,
|
|
212
|
-
|
|
215
|
+
originSignatures: [],
|
|
216
|
+
destinationSignature: '0x',
|
|
213
217
|
success: false,
|
|
214
218
|
error: result.reason,
|
|
215
219
|
});
|
|
@@ -242,16 +246,20 @@ async function signPermit2Sequential(configs, onProgress) {
|
|
|
242
246
|
for (let i = 0; i < configs.length; i++) {
|
|
243
247
|
const config = configs[i];
|
|
244
248
|
try {
|
|
245
|
-
//
|
|
246
|
-
const typedData = getTypedData(config.intentOp);
|
|
247
|
-
// Sign with EOA account
|
|
249
|
+
// sign each element for this chain sequentially to preserve order
|
|
248
250
|
if (!config.eoaAccount.signTypedData) {
|
|
249
251
|
throw new Error('EOA account does not support typed data signing');
|
|
250
252
|
}
|
|
251
|
-
const
|
|
253
|
+
const originSignatures = [];
|
|
254
|
+
for (const element of config.intentOp.elements) {
|
|
255
|
+
const typedData = getTypedData(element, BigInt(config.intentOp.nonce), BigInt(config.intentOp.expires));
|
|
256
|
+
const sig = await config.eoaAccount.signTypedData(typedData);
|
|
257
|
+
originSignatures.push(sig);
|
|
258
|
+
}
|
|
252
259
|
const result = {
|
|
253
260
|
chainId: config.chain.id,
|
|
254
|
-
|
|
261
|
+
originSignatures,
|
|
262
|
+
destinationSignature: originSignatures[0] ?? '0x',
|
|
255
263
|
success: true,
|
|
256
264
|
};
|
|
257
265
|
results.push(result);
|
|
@@ -262,7 +270,8 @@ async function signPermit2Sequential(configs, onProgress) {
|
|
|
262
270
|
catch (error) {
|
|
263
271
|
const result = {
|
|
264
272
|
chainId: config.chain.id,
|
|
265
|
-
|
|
273
|
+
originSignatures: [],
|
|
274
|
+
destinationSignature: '0x',
|
|
266
275
|
success: false,
|
|
267
276
|
error: error instanceof Error ? error : new Error(String(error)),
|
|
268
277
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../execution/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,MAAM,CAAA;AACxD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAErD,UAAU,gBAAgB;IACxB,KAAK,EAAE,OAAO,CAAA;IACd,MAAM,EAAE,MAAM,CAAA;CACf;AAED;;GAEG;AACH,UAAU,uBAAuB;IAC/B,KAAK,EAAE,KAAK,CAAA;IACZ,QAAQ,EAAE,QAAQ,CAAA;IAClB,UAAU,EAAE,OAAO,CAAA;CACpB;AAED;;GAEG;AACH,UAAU,uBAAuB;IAC/B,OAAO,EAAE,MAAM,CAAA;IACf,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../execution/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,MAAM,CAAA;AACxD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAErD,UAAU,gBAAgB;IACxB,KAAK,EAAE,OAAO,CAAA;IACd,MAAM,EAAE,MAAM,CAAA;CACf;AAED;;GAEG;AACH,UAAU,uBAAuB;IAC/B,KAAK,EAAE,KAAK,CAAA;IACZ,QAAQ,EAAE,QAAQ,CAAA;IAClB,UAAU,EAAE,OAAO,CAAA;CACpB;AAED;;GAEG;AACH,UAAU,uBAAuB;IAC/B,OAAO,EAAE,MAAM,CAAA;IACf,gBAAgB,EAAE,GAAG,EAAE,CAAA;IACvB,oBAAoB,EAAE,GAAG,CAAA;IACzB,OAAO,EAAE,OAAO,CAAA;IAChB,KAAK,CAAC,EAAE,KAAK,CAAA;CACd;AAED;;GAEG;AACH,UAAU,kBAAkB;IAC1B,OAAO,EAAE,uBAAuB,EAAE,CAAA;IAClC,WAAW,EAAE,MAAM,CAAA;IACnB,oBAAoB,EAAE,MAAM,CAAA;IAC5B,gBAAgB,EAAE,MAAM,CAAA;IACxB,aAAa,EAAE,OAAO,CAAA;CACvB;AAED,YAAY,EACV,gBAAgB,EAChB,uBAAuB,EACvB,uBAAuB,EACvB,kBAAkB,GACnB,CAAA"}
|
|
@@ -24,7 +24,8 @@ interface PreparedUserOperationData {
|
|
|
24
24
|
transaction: UserOperationTransaction;
|
|
25
25
|
}
|
|
26
26
|
interface SignedTransactionData extends PreparedTransactionData {
|
|
27
|
-
|
|
27
|
+
originSignatures: Hex[];
|
|
28
|
+
destinationSignature: Hex;
|
|
28
29
|
}
|
|
29
30
|
interface SignedUserOperationData extends PreparedUserOperationData {
|
|
30
31
|
signature: Hex;
|
|
@@ -42,9 +43,12 @@ declare function submitTransaction(config: RhinestoneConfig, signedTransaction:
|
|
|
42
43
|
declare function submitUserOperation(config: RhinestoneConfig, signedUserOperation: SignedUserOperationData): Promise<UserOperationResult>;
|
|
43
44
|
declare function getTokenRequests(sourceChains: Chain[], targetChain: Chain, initialTokenRequests: TokenRequest[] | undefined, settlementLayers: SettlementLayer[] | undefined): TokenRequest[];
|
|
44
45
|
declare function prepareTransactionAsIntent(config: RhinestoneConfig, sourceChains: Chain[] | undefined, targetChain: Chain, callInputs: CalldataInput[], gasLimit: bigint | undefined, tokenRequests: TokenRequest[], accountAddress: Address, isSponsored: boolean, eip7702InitSignature: Hex | undefined, settlementLayers: SettlementLayer[] | undefined, sourceAssets: SourceAssetInput | undefined, feeAsset: Address | TokenSymbol | undefined, lockFunds?: boolean): Promise<IntentRoute>;
|
|
45
|
-
declare function signIntent(config: RhinestoneConfig, targetChain: Chain, intentOp: IntentOp, signers?: SignerSet): Promise
|
|
46
|
+
declare function signIntent(config: RhinestoneConfig, targetChain: Chain, intentOp: IntentOp, signers?: SignerSet): Promise<{
|
|
47
|
+
originSignatures: any[];
|
|
48
|
+
destinationSignature: `0x${string}`;
|
|
49
|
+
}>;
|
|
46
50
|
declare function getOrchestratorByChain(chainId: number, apiKey: string | undefined, orchestratorUrl?: string): import("../orchestrator").Orchestrator;
|
|
47
|
-
declare function submitIntentInternal(config: RhinestoneConfig, sourceChains: Chain[] | undefined, targetChain: Chain, intentOp: IntentOp,
|
|
51
|
+
declare function submitIntentInternal(config: RhinestoneConfig, sourceChains: Chain[] | undefined, targetChain: Chain, intentOp: IntentOp, originSignatures: Hex[], destinationSignature: Hex, authorizations: SignedAuthorizationList, dryRun: boolean): Promise<TransactionResult>;
|
|
48
52
|
declare function getValidatorAccount(config: RhinestoneConfig, signers: SignerSet | undefined, publicClient: PublicClient, chain: Chain): Promise<import("viem/account-abstraction").SmartAccount<import("viem/account-abstraction").SmartAccountImplementation<import("viem").Abi, "0.7">> | null | undefined>;
|
|
49
53
|
declare function parseCalls(calls: CalldataInput[], chainId: number): Call[];
|
|
50
54
|
export { prepareTransaction, signTransaction, signAuthorizations, signAuthorizationsInternal, signMessage, signTypedData, submitTransaction, prepareUserOperation, signUserOperation, submitUserOperation, getOrchestratorByChain, signIntent, prepareTransactionAsIntent, submitIntentInternal, getValidatorAccount, parseCalls, getTokenRequests, resolveCallInputs, };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../execution/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,OAAO,EACZ,KAAK,KAAK,EAIV,KAAK,uBAAuB,EAC5B,KAAK,GAAG,EAIR,KAAK,YAAY,EAEjB,KAAK,eAAe,EACpB,KAAK,mBAAmB,EACxB,KAAK,uBAAuB,EAC5B,KAAK,SAAS,EAGf,MAAM,MA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,OAAO,EAAE,SAAS,GAAG,SAAS,EAC9B,YAAY,EAAE,YAAY,EAC1B,KAAK,EAAE,KAAK,yKA6Bb;AAmDD,iBAAS,UAAU,CAAC,KAAK,EAAE,aAAa,EAAE,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,EAAE,CAMnE;AAgGD,OAAO,EACL,kBAAkB,EAClB,eAAe,EACf,kBAAkB,EAClB,0BAA0B,EAC1B,WAAW,EACX,aAAa,EACb,iBAAiB,EACjB,oBAAoB,EACpB,iBAAiB,EACjB,mBAAmB,EACnB,sBAAsB,EACtB,UAAU,EACV,0BAA0B,EAC1B,oBAAoB,EACpB,mBAAmB,EACnB,UAAU,EACV,gBAAgB,EAChB,iBAAiB,GAClB,CAAA;AACD,YAAY,EACV,WAAW,EACX,iBAAiB,EACjB,uBAAuB,EACvB,yBAAyB,EACzB,qBAAqB,EACrB,uBAAuB,EACvB,mBAAmB,GACpB,CAAA"}
|
|
@@ -75,11 +75,12 @@ async function resolveCallInputs(inputs, config, chain, accountAddress) {
|
|
|
75
75
|
async function signTransaction(config, preparedTransaction) {
|
|
76
76
|
const { targetChain, signers } = getTransactionParams(preparedTransaction.transaction);
|
|
77
77
|
const intentRoute = preparedTransaction.intentRoute;
|
|
78
|
-
const
|
|
78
|
+
const { originSignatures, destinationSignature } = await signIntent(config, targetChain, intentRoute.intentOp, signers);
|
|
79
79
|
return {
|
|
80
80
|
intentRoute,
|
|
81
81
|
transaction: preparedTransaction.transaction,
|
|
82
|
-
|
|
82
|
+
originSignatures,
|
|
83
|
+
destinationSignature,
|
|
83
84
|
};
|
|
84
85
|
}
|
|
85
86
|
async function signUserOperation(config, preparedUserOperation) {
|
|
@@ -159,10 +160,10 @@ async function signAuthorizationsInternal(config, data) {
|
|
|
159
160
|
return authorizations;
|
|
160
161
|
}
|
|
161
162
|
async function submitTransaction(config, signedTransaction, authorizations, dryRun = false) {
|
|
162
|
-
const { intentRoute, transaction,
|
|
163
|
+
const { intentRoute, transaction, originSignatures, destinationSignature } = signedTransaction;
|
|
163
164
|
const { sourceChains, targetChain } = getTransactionParams(transaction);
|
|
164
165
|
const intentOp = intentRoute.intentOp;
|
|
165
|
-
return await submitIntent(config, sourceChains, targetChain, intentOp,
|
|
166
|
+
return await submitIntent(config, sourceChains, targetChain, intentOp, originSignatures, destinationSignature, authorizations, dryRun);
|
|
166
167
|
}
|
|
167
168
|
async function submitUserOperation(config, signedUserOperation) {
|
|
168
169
|
const chain = signedUserOperation.transaction.chain;
|
|
@@ -287,26 +288,31 @@ async function prepareTransactionAsIntent(config, sourceChains, targetChain, cal
|
|
|
287
288
|
}
|
|
288
289
|
async function signIntent(config, targetChain, intentOp, signers) {
|
|
289
290
|
if (config.account?.type === 'eoa') {
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
291
|
+
const originSignatures = [];
|
|
292
|
+
for (const element of intentOp.elements) {
|
|
293
|
+
let digest;
|
|
294
|
+
if (config.eoa?.signTypedData) {
|
|
295
|
+
const typedData = (0, permit2_1.getTypedData)(element, BigInt(intentOp.nonce), BigInt(intentOp.expires));
|
|
296
|
+
originSignatures.push(await config.eoa.signTypedData(typedData));
|
|
297
|
+
}
|
|
298
|
+
else if (config.eoa?.sign) {
|
|
299
|
+
digest = (0, compact_1.getPermit2Digest)(element, BigInt(intentOp.nonce), BigInt(intentOp.expires));
|
|
300
|
+
originSignatures.push(await config.eoa.sign({ hash: digest }));
|
|
301
|
+
}
|
|
302
|
+
else if (config.eoa?.signMessage) {
|
|
303
|
+
digest = (0, compact_1.getPermit2Digest)(element, BigInt(intentOp.nonce), BigInt(intentOp.expires));
|
|
304
|
+
originSignatures.push(await config.eoa.signMessage({
|
|
305
|
+
message: { raw: digest },
|
|
306
|
+
}));
|
|
307
|
+
}
|
|
308
|
+
else {
|
|
309
|
+
throw new accounts_1.EoaSigningMethodNotConfiguredError('signTypedData, sign, or signMessage');
|
|
310
|
+
}
|
|
308
311
|
}
|
|
309
|
-
return
|
|
312
|
+
return {
|
|
313
|
+
originSignatures,
|
|
314
|
+
destinationSignature: originSignatures[0],
|
|
315
|
+
};
|
|
310
316
|
}
|
|
311
317
|
const validator = getValidator(config, signers);
|
|
312
318
|
if (!validator) {
|
|
@@ -314,19 +320,31 @@ async function signIntent(config, targetChain, intentOp, signers) {
|
|
|
314
320
|
}
|
|
315
321
|
const ownerValidator = (0, validators_1.getOwnerValidator)(config);
|
|
316
322
|
const isRoot = validator.address === ownerValidator.address;
|
|
317
|
-
const
|
|
318
|
-
return
|
|
323
|
+
const signatures = await getIntentSignature(config, intentOp, signers, targetChain, validator, isRoot);
|
|
324
|
+
return signatures;
|
|
319
325
|
}
|
|
320
326
|
async function getIntentSignature(config, intentOp, signers, targetChain, validator, isRoot) {
|
|
321
327
|
const withJitFlow = intentOp.elements.some((element) => element.mandate.qualifier.settlementContext?.usingJIT);
|
|
322
328
|
if (withJitFlow) {
|
|
323
|
-
return await
|
|
329
|
+
return await getPermit2Signatures(config, intentOp, signers, targetChain, validator, isRoot);
|
|
324
330
|
}
|
|
325
|
-
|
|
331
|
+
const signature = await getCompactSignature(config, intentOp, signers, targetChain, validator, isRoot);
|
|
332
|
+
return {
|
|
333
|
+
originSignatures: Array(intentOp.elements.length).fill(signature),
|
|
334
|
+
destinationSignature: signature,
|
|
335
|
+
};
|
|
326
336
|
}
|
|
327
|
-
async function
|
|
328
|
-
const
|
|
329
|
-
|
|
337
|
+
async function getPermit2Signatures(config, intentOp, signers, targetChain, validator, isRoot) {
|
|
338
|
+
const originSignatures = [];
|
|
339
|
+
for (const element of intentOp.elements) {
|
|
340
|
+
const typedData = (0, permit2_1.getTypedData)(element, BigInt(intentOp.nonce), BigInt(intentOp.expires));
|
|
341
|
+
const signature = await signIntentTypedData(config, signers, targetChain, validator, isRoot, typedData);
|
|
342
|
+
originSignatures.push(signature);
|
|
343
|
+
}
|
|
344
|
+
return {
|
|
345
|
+
originSignatures,
|
|
346
|
+
destinationSignature: originSignatures[0],
|
|
347
|
+
};
|
|
330
348
|
}
|
|
331
349
|
async function getCompactSignature(config, intentOp, signers, targetChain, validator, isRoot) {
|
|
332
350
|
const typedData = (0, compact_1.getCompactTypedData)(intentOp);
|
|
@@ -399,8 +417,8 @@ async function submitUserOp(config, chain, userOp, signature) {
|
|
|
399
417
|
chain: chain.id,
|
|
400
418
|
};
|
|
401
419
|
}
|
|
402
|
-
async function submitIntent(config, sourceChains, targetChain, intentOp,
|
|
403
|
-
return submitIntentInternal(config, sourceChains, targetChain, intentOp,
|
|
420
|
+
async function submitIntent(config, sourceChains, targetChain, intentOp, originSignatures, destinationSignature, authorizations, dryRun) {
|
|
421
|
+
return submitIntentInternal(config, sourceChains, targetChain, intentOp, originSignatures, destinationSignature, authorizations, dryRun);
|
|
404
422
|
}
|
|
405
423
|
function getOrchestratorByChain(chainId, apiKey, orchestratorUrl) {
|
|
406
424
|
if (orchestratorUrl) {
|
|
@@ -411,11 +429,11 @@ function getOrchestratorByChain(chainId, apiKey, orchestratorUrl) {
|
|
|
411
429
|
: consts_1.PROD_ORCHESTRATOR_URL;
|
|
412
430
|
return (0, orchestrator_1.getOrchestrator)(apiKey, defaultOrchestratorUrl);
|
|
413
431
|
}
|
|
414
|
-
function createSignedIntentOp(intentOp,
|
|
432
|
+
function createSignedIntentOp(intentOp, originSignatures, destinationSignature, authorizations) {
|
|
415
433
|
return {
|
|
416
434
|
...intentOp,
|
|
417
|
-
originSignatures
|
|
418
|
-
destinationSignature
|
|
435
|
+
originSignatures,
|
|
436
|
+
destinationSignature,
|
|
419
437
|
signedAuthorizations: authorizations.length > 0
|
|
420
438
|
? authorizations.map((authorization) => ({
|
|
421
439
|
chainId: authorization.chainId,
|
|
@@ -428,8 +446,8 @@ function createSignedIntentOp(intentOp, signature, authorizations) {
|
|
|
428
446
|
: undefined,
|
|
429
447
|
};
|
|
430
448
|
}
|
|
431
|
-
async function submitIntentInternal(config, sourceChains, targetChain, intentOp,
|
|
432
|
-
const signedIntentOp = createSignedIntentOp(intentOp,
|
|
449
|
+
async function submitIntentInternal(config, sourceChains, targetChain, intentOp, originSignatures, destinationSignature, authorizations, dryRun) {
|
|
450
|
+
const signedIntentOp = createSignedIntentOp(intentOp, originSignatures, destinationSignature, authorizations);
|
|
433
451
|
const orchestrator = getOrchestratorByChain(targetChain.id, config.apiKey, config.endpointUrl);
|
|
434
452
|
const intentResults = await orchestrator.submitIntent(signedIntentOp, dryRun);
|
|
435
453
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../orchestrator/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAe,MAAM,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../orchestrator/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAe,MAAM,MAAM,CAAA;AAyBhD,OAAO,KAAK,EACV,UAAU,EACV,WAAW,EACX,cAAc,EACd,YAAY,EACZ,WAAW,EACX,SAAS,EAET,cAAc,EACf,MAAM,SAAS,CAAA;AAGhB,qBAAa,YAAY;IACvB,OAAO,CAAC,SAAS,CAAQ;IACzB,OAAO,CAAC,MAAM,CAAC,CAAQ;gBAEX,SAAS,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM;IAKxC,YAAY,CAChB,WAAW,EAAE,OAAO,EACpB,MAAM,CAAC,EAAE;QACP,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAA;QACnB,MAAM,CAAC,EAAE;YACP,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,EAAE,CAAA;SAC7B,CAAA;KACF,GACA,OAAO,CAAC,SAAS,CAAC;IA+Cf,iBAAiB,CACrB,WAAW,EAAE,OAAO,EACpB,kBAAkB,EAAE,MAAM,EAC1B,uBAAuB,EAAE,OAAO,EAChC,mBAAmB,EAAE,MAAM,EAC3B,SAAS,EAAE,OAAO,GACjB,OAAO,CAAC,MAAM,CAAC;IAqDZ,aAAa,CAAC,KAAK,EAAE,WAAW,GAAG,OAAO,CAAC,UAAU,CAAC;IAQtD,cAAc,CAAC,KAAK,EAAE,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC;IAQxD,YAAY,CAChB,yBAAyB,EAAE,cAAc,EACzC,MAAM,EAAE,OAAO,GACd,OAAO,CAAC,YAAY,CAAC;IAgBlB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC;IASlE,OAAO,CAAC,UAAU;YAUJ,KAAK;IA4BnB,OAAO,CAAC,UAAU;IAkHlB,OAAO,CAAC,iBAAiB;CAwF1B"}
|
|
@@ -136,11 +136,25 @@ class Orchestrator {
|
|
|
136
136
|
async fetch(url, options) {
|
|
137
137
|
const response = await fetch(url, options);
|
|
138
138
|
if (!response.ok) {
|
|
139
|
-
|
|
139
|
+
let errorData = {};
|
|
140
|
+
try {
|
|
141
|
+
errorData = await response.json();
|
|
142
|
+
}
|
|
143
|
+
catch {
|
|
144
|
+
try {
|
|
145
|
+
const text = await response.text();
|
|
146
|
+
errorData = { message: text };
|
|
147
|
+
}
|
|
148
|
+
catch { }
|
|
149
|
+
}
|
|
150
|
+
const retryAfterHeader = response.headers?.get?.('retry-after') || undefined;
|
|
140
151
|
this.parseError({
|
|
141
152
|
response: {
|
|
142
153
|
status: response.status,
|
|
143
154
|
data: errorData,
|
|
155
|
+
headers: {
|
|
156
|
+
retryAfter: retryAfterHeader,
|
|
157
|
+
},
|
|
144
158
|
},
|
|
145
159
|
});
|
|
146
160
|
}
|
|
@@ -148,59 +162,108 @@ class Orchestrator {
|
|
|
148
162
|
}
|
|
149
163
|
parseError(error) {
|
|
150
164
|
if (error.response) {
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
165
|
+
const status = error.response.status;
|
|
166
|
+
const { headers } = error.response;
|
|
167
|
+
const { errors = [], traceId, message } = error.response.data || {};
|
|
168
|
+
let errorType = 'Unknown';
|
|
169
|
+
switch (status) {
|
|
170
|
+
case 400:
|
|
171
|
+
errorType = 'Bad Request';
|
|
172
|
+
break;
|
|
173
|
+
case 401:
|
|
174
|
+
errorType = 'Unauthorized';
|
|
175
|
+
break;
|
|
176
|
+
case 403:
|
|
177
|
+
errorType = 'Forbidden';
|
|
178
|
+
break;
|
|
179
|
+
case 404:
|
|
180
|
+
errorType = 'Not Found';
|
|
181
|
+
break;
|
|
182
|
+
case 409:
|
|
183
|
+
errorType = 'Conflict';
|
|
184
|
+
break;
|
|
185
|
+
case 422:
|
|
186
|
+
errorType = 'Unprocessable Entity';
|
|
187
|
+
break;
|
|
188
|
+
case 429:
|
|
189
|
+
errorType = 'Too Many Requests';
|
|
190
|
+
break;
|
|
191
|
+
case 500:
|
|
192
|
+
errorType = 'Internal Server Error';
|
|
193
|
+
break;
|
|
194
|
+
case 503:
|
|
195
|
+
errorType = 'Service Unavailable';
|
|
196
|
+
break;
|
|
197
|
+
default:
|
|
198
|
+
errorType = 'Unknown';
|
|
178
199
|
}
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
200
|
+
const baseParams = {
|
|
201
|
+
context: { traceId },
|
|
202
|
+
errorType,
|
|
203
|
+
traceId,
|
|
204
|
+
statusCode: status,
|
|
205
|
+
};
|
|
206
|
+
if (status === 422) {
|
|
207
|
+
// zod / json schema validation errors
|
|
208
|
+
const context = { traceId, errors };
|
|
209
|
+
throw new error_1.SchemaValidationError({
|
|
210
|
+
...baseParams,
|
|
211
|
+
context,
|
|
212
|
+
message: message || 'Schema validation error',
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
if (status === 429) {
|
|
216
|
+
const retryAfter = headers?.retryAfter;
|
|
217
|
+
const context = { traceId, retryAfter };
|
|
218
|
+
throw new error_1.RateLimitedError({
|
|
219
|
+
...baseParams,
|
|
220
|
+
context,
|
|
221
|
+
});
|
|
222
|
+
}
|
|
223
|
+
if (status === 503) {
|
|
224
|
+
throw new error_1.ServiceUnavailableError(baseParams);
|
|
182
225
|
}
|
|
183
|
-
const { errors, traceId, message } = error.response.data;
|
|
184
226
|
if (message) {
|
|
185
|
-
|
|
186
|
-
context: { traceId },
|
|
187
|
-
errorType,
|
|
188
|
-
traceId,
|
|
189
|
-
};
|
|
190
|
-
this.parseErrorMessage(message, mainErrorParams);
|
|
227
|
+
this.parseErrorMessage(message, baseParams);
|
|
191
228
|
}
|
|
192
229
|
for (const err of errors) {
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
context = { ...context, ...err.context };
|
|
197
|
-
const message = err.message;
|
|
198
|
-
const finalErrorParams = {
|
|
199
|
-
context: { ...context, traceId },
|
|
200
|
-
errorType,
|
|
201
|
-
traceId,
|
|
230
|
+
const mergedParams = {
|
|
231
|
+
...baseParams,
|
|
232
|
+
context: { ...err.context, traceId },
|
|
202
233
|
};
|
|
203
|
-
this.parseErrorMessage(message,
|
|
234
|
+
this.parseErrorMessage(err.message, mergedParams);
|
|
235
|
+
}
|
|
236
|
+
switch (status) {
|
|
237
|
+
case 400:
|
|
238
|
+
throw new error_1.BadRequestError(baseParams);
|
|
239
|
+
case 401:
|
|
240
|
+
if (message === 'Authentication is required') {
|
|
241
|
+
throw new error_1.AuthenticationRequiredError(baseParams);
|
|
242
|
+
}
|
|
243
|
+
throw new error_1.UnauthorizedError(baseParams);
|
|
244
|
+
case 403:
|
|
245
|
+
throw new error_1.ForbiddenError(baseParams);
|
|
246
|
+
case 404:
|
|
247
|
+
throw new error_1.ResourceNotFoundError(baseParams);
|
|
248
|
+
case 409:
|
|
249
|
+
throw new error_1.ConflictError(baseParams);
|
|
250
|
+
case 500:
|
|
251
|
+
if (errors && errors.length > 0) {
|
|
252
|
+
const mergedParams = {
|
|
253
|
+
...baseParams,
|
|
254
|
+
context: { ...errors[0].context, traceId },
|
|
255
|
+
};
|
|
256
|
+
throw new error_1.OrchestratorError({
|
|
257
|
+
...mergedParams,
|
|
258
|
+
message: errors[0].message || 'Internal Server Error',
|
|
259
|
+
});
|
|
260
|
+
}
|
|
261
|
+
throw new error_1.InternalServerError(baseParams);
|
|
262
|
+
default:
|
|
263
|
+
throw new error_1.OrchestratorError({
|
|
264
|
+
...baseParams,
|
|
265
|
+
message: message || errorType,
|
|
266
|
+
});
|
|
204
267
|
}
|
|
205
268
|
}
|
|
206
269
|
}
|
|
@@ -208,7 +271,8 @@ class Orchestrator {
|
|
|
208
271
|
if (message === 'Insufficient balance') {
|
|
209
272
|
throw new error_1.InsufficientBalanceError(errorParams);
|
|
210
273
|
}
|
|
211
|
-
else if (message === 'Unsupported chain id'
|
|
274
|
+
else if (message === 'Unsupported chain id' ||
|
|
275
|
+
message === 'Unsupported chain ids') {
|
|
212
276
|
throw new error_1.UnsupportedChainIdError(errorParams);
|
|
213
277
|
}
|
|
214
278
|
else if (message.startsWith('Unsupported chain ')) {
|
|
@@ -229,6 +293,10 @@ class Orchestrator {
|
|
|
229
293
|
}
|
|
230
294
|
throw new error_1.OrchestratorError({ message, ...errorParams });
|
|
231
295
|
}
|
|
296
|
+
else if (message === 'Unsupported token addresses') {
|
|
297
|
+
// generic unsupported tokens without specific symbol/chain context
|
|
298
|
+
throw new error_1.BadRequestError({ message, ...errorParams });
|
|
299
|
+
}
|
|
232
300
|
else if (message.includes('not supported on chain')) {
|
|
233
301
|
const tokenMatch = message.match(/Token (.+) not supported on chain (\d+)/);
|
|
234
302
|
if (tokenMatch) {
|
|
@@ -244,18 +312,43 @@ class Orchestrator {
|
|
|
244
312
|
else if (message === 'Invalid API key') {
|
|
245
313
|
throw new error_1.InvalidApiKeyError(errorParams);
|
|
246
314
|
}
|
|
315
|
+
else if (message === 'Insufficient permissions') {
|
|
316
|
+
throw new error_1.ForbiddenError(errorParams);
|
|
317
|
+
}
|
|
247
318
|
else if (message === 'Invalid bundle signature') {
|
|
248
319
|
throw new error_1.InvalidIntentSignatureError(errorParams);
|
|
249
320
|
}
|
|
250
|
-
else if (message === '
|
|
321
|
+
else if (message === 'Invalid checksum signature') {
|
|
322
|
+
throw new error_1.InvalidIntentSignatureError(errorParams);
|
|
323
|
+
}
|
|
324
|
+
else if (message === 'Only one target token amount can be unset' ||
|
|
325
|
+
message === 'Only one max-out transfer is allowed') {
|
|
251
326
|
throw new error_1.OnlyOneTargetTokenAmountCanBeUnsetError(errorParams);
|
|
252
327
|
}
|
|
253
|
-
else if (message === 'No
|
|
328
|
+
else if (message === 'No valid settlement plan found for the given transfers' ||
|
|
329
|
+
message === 'No valid transfers sent for settlement quotes' ||
|
|
330
|
+
message === 'No Path Found') {
|
|
254
331
|
throw new error_1.NoPathFoundError(errorParams);
|
|
255
332
|
}
|
|
256
|
-
else if (message === '
|
|
333
|
+
else if (message === 'Emissary is not enabled' ||
|
|
334
|
+
message === 'Emissary is not the expected address') {
|
|
335
|
+
throw new error_1.ForbiddenError(errorParams);
|
|
336
|
+
}
|
|
337
|
+
else if (message.includes('No such intent with nonce') ||
|
|
338
|
+
message === 'Order bundle not found') {
|
|
257
339
|
throw new error_1.IntentNotFoundError(errorParams);
|
|
258
340
|
}
|
|
341
|
+
else if (message === 'Could not retrieve a valid quote from any aggregator') {
|
|
342
|
+
throw new error_1.NoPathFoundError(errorParams);
|
|
343
|
+
}
|
|
344
|
+
else if (message === 'No aggregators available for swap') {
|
|
345
|
+
throw new error_1.InternalServerError(errorParams);
|
|
346
|
+
}
|
|
347
|
+
else if (message === 'entity.parse.failed' ||
|
|
348
|
+
message === 'entity.too.large' ||
|
|
349
|
+
message === 'encoding.unsupported') {
|
|
350
|
+
throw new error_1.BodyParserError({ message, ...errorParams });
|
|
351
|
+
}
|
|
259
352
|
else {
|
|
260
353
|
throw new error_1.OrchestratorError({ message, ...errorParams });
|
|
261
354
|
}
|
|
@@ -3,22 +3,26 @@ declare class OrchestratorError extends Error {
|
|
|
3
3
|
private readonly _context;
|
|
4
4
|
private readonly _errorType;
|
|
5
5
|
private readonly _traceId;
|
|
6
|
+
private readonly _statusCode?;
|
|
6
7
|
constructor(params?: {
|
|
7
8
|
message?: string;
|
|
8
9
|
context?: any;
|
|
9
10
|
errorType?: string;
|
|
10
11
|
traceId?: string;
|
|
12
|
+
statusCode?: number;
|
|
11
13
|
});
|
|
12
14
|
get message(): string;
|
|
13
15
|
get context(): any;
|
|
14
16
|
get errorType(): string;
|
|
15
17
|
get traceId(): string;
|
|
18
|
+
get statusCode(): number | undefined;
|
|
16
19
|
}
|
|
17
20
|
declare class InsufficientBalanceError extends OrchestratorError {
|
|
18
21
|
constructor(params?: {
|
|
19
22
|
context?: any;
|
|
20
23
|
errorType?: string;
|
|
21
24
|
traceId?: string;
|
|
25
|
+
statusCode?: number;
|
|
22
26
|
});
|
|
23
27
|
}
|
|
24
28
|
declare class UnsupportedChainIdError extends OrchestratorError {
|
|
@@ -26,6 +30,7 @@ declare class UnsupportedChainIdError extends OrchestratorError {
|
|
|
26
30
|
context?: any;
|
|
27
31
|
errorType?: string;
|
|
28
32
|
traceId?: string;
|
|
33
|
+
statusCode?: number;
|
|
29
34
|
});
|
|
30
35
|
}
|
|
31
36
|
declare class UnsupportedChainError extends OrchestratorError {
|
|
@@ -33,6 +38,7 @@ declare class UnsupportedChainError extends OrchestratorError {
|
|
|
33
38
|
context?: any;
|
|
34
39
|
errorType?: string;
|
|
35
40
|
traceId?: string;
|
|
41
|
+
statusCode?: number;
|
|
36
42
|
});
|
|
37
43
|
}
|
|
38
44
|
declare class UnsupportedTokenError extends OrchestratorError {
|
|
@@ -40,6 +46,7 @@ declare class UnsupportedTokenError extends OrchestratorError {
|
|
|
40
46
|
context?: any;
|
|
41
47
|
errorType?: string;
|
|
42
48
|
traceId?: string;
|
|
49
|
+
statusCode?: number;
|
|
43
50
|
});
|
|
44
51
|
}
|
|
45
52
|
declare class TokenNotSupportedError extends OrchestratorError {
|
|
@@ -47,6 +54,7 @@ declare class TokenNotSupportedError extends OrchestratorError {
|
|
|
47
54
|
context?: any;
|
|
48
55
|
errorType?: string;
|
|
49
56
|
traceId?: string;
|
|
57
|
+
statusCode?: number;
|
|
50
58
|
});
|
|
51
59
|
}
|
|
52
60
|
declare class AuthenticationRequiredError extends OrchestratorError {
|
|
@@ -54,6 +62,7 @@ declare class AuthenticationRequiredError extends OrchestratorError {
|
|
|
54
62
|
context?: any;
|
|
55
63
|
errorType?: string;
|
|
56
64
|
traceId?: string;
|
|
65
|
+
statusCode?: number;
|
|
57
66
|
});
|
|
58
67
|
}
|
|
59
68
|
declare class InvalidApiKeyError extends OrchestratorError {
|
|
@@ -61,6 +70,7 @@ declare class InvalidApiKeyError extends OrchestratorError {
|
|
|
61
70
|
context?: any;
|
|
62
71
|
errorType?: string;
|
|
63
72
|
traceId?: string;
|
|
73
|
+
statusCode?: number;
|
|
64
74
|
});
|
|
65
75
|
}
|
|
66
76
|
declare class InvalidIntentSignatureError extends OrchestratorError {
|
|
@@ -68,6 +78,7 @@ declare class InvalidIntentSignatureError extends OrchestratorError {
|
|
|
68
78
|
context?: any;
|
|
69
79
|
errorType?: string;
|
|
70
80
|
traceId?: string;
|
|
81
|
+
statusCode?: number;
|
|
71
82
|
});
|
|
72
83
|
}
|
|
73
84
|
declare class OnlyOneTargetTokenAmountCanBeUnsetError extends OrchestratorError {
|
|
@@ -75,6 +86,7 @@ declare class OnlyOneTargetTokenAmountCanBeUnsetError extends OrchestratorError
|
|
|
75
86
|
context?: any;
|
|
76
87
|
errorType?: string;
|
|
77
88
|
traceId?: string;
|
|
89
|
+
statusCode?: number;
|
|
78
90
|
});
|
|
79
91
|
}
|
|
80
92
|
declare class NoPathFoundError extends OrchestratorError {
|
|
@@ -82,6 +94,7 @@ declare class NoPathFoundError extends OrchestratorError {
|
|
|
82
94
|
context?: any;
|
|
83
95
|
errorType?: string;
|
|
84
96
|
traceId?: string;
|
|
97
|
+
statusCode?: number;
|
|
85
98
|
});
|
|
86
99
|
}
|
|
87
100
|
declare class IntentNotFoundError extends OrchestratorError {
|
|
@@ -89,8 +102,105 @@ declare class IntentNotFoundError extends OrchestratorError {
|
|
|
89
102
|
context?: any;
|
|
90
103
|
errorType?: string;
|
|
91
104
|
traceId?: string;
|
|
105
|
+
statusCode?: number;
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
declare class SchemaValidationError extends OrchestratorError {
|
|
109
|
+
constructor(params?: {
|
|
110
|
+
message?: string;
|
|
111
|
+
context?: any;
|
|
112
|
+
errorType?: string;
|
|
113
|
+
traceId?: string;
|
|
114
|
+
statusCode?: number;
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
declare class RateLimitedError extends OrchestratorError {
|
|
118
|
+
constructor(params?: {
|
|
119
|
+
context?: any;
|
|
120
|
+
errorType?: string;
|
|
121
|
+
traceId?: string;
|
|
122
|
+
statusCode?: number;
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
declare class ServiceUnavailableError extends OrchestratorError {
|
|
126
|
+
constructor(params?: {
|
|
127
|
+
context?: any;
|
|
128
|
+
errorType?: string;
|
|
129
|
+
traceId?: string;
|
|
130
|
+
statusCode?: number;
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
declare class UnauthorizedError extends OrchestratorError {
|
|
134
|
+
constructor(params?: {
|
|
135
|
+
context?: any;
|
|
136
|
+
errorType?: string;
|
|
137
|
+
traceId?: string;
|
|
138
|
+
statusCode?: number;
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
declare class ForbiddenError extends OrchestratorError {
|
|
142
|
+
constructor(params?: {
|
|
143
|
+
context?: any;
|
|
144
|
+
errorType?: string;
|
|
145
|
+
traceId?: string;
|
|
146
|
+
statusCode?: number;
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
declare class ResourceNotFoundError extends OrchestratorError {
|
|
150
|
+
constructor(params?: {
|
|
151
|
+
context?: any;
|
|
152
|
+
errorType?: string;
|
|
153
|
+
traceId?: string;
|
|
154
|
+
statusCode?: number;
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
declare class ConflictError extends OrchestratorError {
|
|
158
|
+
constructor(params?: {
|
|
159
|
+
context?: any;
|
|
160
|
+
errorType?: string;
|
|
161
|
+
traceId?: string;
|
|
162
|
+
statusCode?: number;
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
declare class BadRequestError extends OrchestratorError {
|
|
166
|
+
constructor(params?: {
|
|
167
|
+
message?: string;
|
|
168
|
+
context?: any;
|
|
169
|
+
errorType?: string;
|
|
170
|
+
traceId?: string;
|
|
171
|
+
statusCode?: number;
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
declare class UnprocessableEntityError extends OrchestratorError {
|
|
175
|
+
constructor(params?: {
|
|
176
|
+
message?: string;
|
|
177
|
+
context?: any;
|
|
178
|
+
errorType?: string;
|
|
179
|
+
traceId?: string;
|
|
180
|
+
statusCode?: number;
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
declare class InternalServerError extends OrchestratorError {
|
|
184
|
+
constructor(params?: {
|
|
185
|
+
context?: any;
|
|
186
|
+
errorType?: string;
|
|
187
|
+
traceId?: string;
|
|
188
|
+
statusCode?: number;
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
declare class BodyParserError extends OrchestratorError {
|
|
192
|
+
constructor(params?: {
|
|
193
|
+
message?: string;
|
|
194
|
+
context?: any;
|
|
195
|
+
errorType?: string;
|
|
196
|
+
traceId?: string;
|
|
197
|
+
statusCode?: number;
|
|
92
198
|
});
|
|
93
199
|
}
|
|
94
200
|
declare function isOrchestratorError(error: Error): error is OrchestratorError;
|
|
95
|
-
|
|
201
|
+
declare function isRateLimited(error: unknown): error is RateLimitedError;
|
|
202
|
+
declare function isValidationError(error: unknown): boolean;
|
|
203
|
+
declare function isAuthError(error: unknown): boolean;
|
|
204
|
+
declare function isRetryable(error: unknown): boolean;
|
|
205
|
+
export { isOrchestratorError, isRetryable, isAuthError, isValidationError, isRateLimited, OrchestratorError, InsufficientBalanceError, UnsupportedChainIdError, UnsupportedChainError, UnsupportedTokenError, TokenNotSupportedError, AuthenticationRequiredError, InvalidApiKeyError, InvalidIntentSignatureError, OnlyOneTargetTokenAmountCanBeUnsetError, NoPathFoundError, IntentNotFoundError, SchemaValidationError, RateLimitedError, ServiceUnavailableError, UnauthorizedError, ForbiddenError, ResourceNotFoundError, ConflictError, BadRequestError, UnprocessableEntityError, InternalServerError, BodyParserError, };
|
|
96
206
|
//# sourceMappingURL=error.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../../../orchestrator/error.ts"],"names":[],"mappings":"AAAA,cAAM,iBAAkB,SAAQ,KAAK;IACnC,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;
|
|
1
|
+
{"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../../../orchestrator/error.ts"],"names":[],"mappings":"AAAA,cAAM,iBAAkB,SAAQ,KAAK;IACnC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAQ;IACjC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAK;IAC9B,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAQ;IACnC,O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CAAA"}
|
|
@@ -1,18 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.IntentNotFoundError = exports.NoPathFoundError = exports.OnlyOneTargetTokenAmountCanBeUnsetError = exports.InvalidIntentSignatureError = exports.InvalidApiKeyError = exports.AuthenticationRequiredError = exports.TokenNotSupportedError = exports.UnsupportedTokenError = exports.UnsupportedChainError = exports.UnsupportedChainIdError = exports.InsufficientBalanceError = exports.OrchestratorError = void 0;
|
|
3
|
+
exports.BodyParserError = exports.InternalServerError = exports.UnprocessableEntityError = exports.BadRequestError = exports.ConflictError = exports.ResourceNotFoundError = exports.ForbiddenError = exports.UnauthorizedError = exports.ServiceUnavailableError = exports.RateLimitedError = exports.SchemaValidationError = exports.IntentNotFoundError = exports.NoPathFoundError = exports.OnlyOneTargetTokenAmountCanBeUnsetError = exports.InvalidIntentSignatureError = exports.InvalidApiKeyError = exports.AuthenticationRequiredError = exports.TokenNotSupportedError = exports.UnsupportedTokenError = exports.UnsupportedChainError = exports.UnsupportedChainIdError = exports.InsufficientBalanceError = exports.OrchestratorError = void 0;
|
|
4
4
|
exports.isOrchestratorError = isOrchestratorError;
|
|
5
|
+
exports.isRetryable = isRetryable;
|
|
6
|
+
exports.isAuthError = isAuthError;
|
|
7
|
+
exports.isValidationError = isValidationError;
|
|
8
|
+
exports.isRateLimited = isRateLimited;
|
|
5
9
|
class OrchestratorError extends Error {
|
|
6
10
|
_message;
|
|
7
11
|
_context;
|
|
8
12
|
_errorType;
|
|
9
13
|
_traceId;
|
|
14
|
+
_statusCode;
|
|
10
15
|
constructor(params) {
|
|
11
16
|
super();
|
|
12
17
|
this._message = params?.message || 'OrchestratorError ';
|
|
13
18
|
this._context = params?.context || {};
|
|
14
19
|
this._errorType = params?.errorType || 'Unknown';
|
|
15
20
|
this._traceId = params?.traceId || '';
|
|
21
|
+
this._statusCode = params?.statusCode;
|
|
16
22
|
}
|
|
17
23
|
get message() {
|
|
18
24
|
return this._message;
|
|
@@ -26,6 +32,9 @@ class OrchestratorError extends Error {
|
|
|
26
32
|
get traceId() {
|
|
27
33
|
return this._traceId;
|
|
28
34
|
}
|
|
35
|
+
get statusCode() {
|
|
36
|
+
return this._statusCode;
|
|
37
|
+
}
|
|
29
38
|
}
|
|
30
39
|
exports.OrchestratorError = OrchestratorError;
|
|
31
40
|
class InsufficientBalanceError extends OrchestratorError {
|
|
@@ -127,6 +136,124 @@ class IntentNotFoundError extends OrchestratorError {
|
|
|
127
136
|
}
|
|
128
137
|
}
|
|
129
138
|
exports.IntentNotFoundError = IntentNotFoundError;
|
|
139
|
+
class SchemaValidationError extends OrchestratorError {
|
|
140
|
+
constructor(params) {
|
|
141
|
+
super({
|
|
142
|
+
message: params?.message || 'Schema validation error',
|
|
143
|
+
...params,
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
exports.SchemaValidationError = SchemaValidationError;
|
|
148
|
+
class RateLimitedError extends OrchestratorError {
|
|
149
|
+
constructor(params) {
|
|
150
|
+
super({
|
|
151
|
+
message: 'Too Many Requests',
|
|
152
|
+
...params,
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
exports.RateLimitedError = RateLimitedError;
|
|
157
|
+
class ServiceUnavailableError extends OrchestratorError {
|
|
158
|
+
constructor(params) {
|
|
159
|
+
super({
|
|
160
|
+
message: 'Service Unavailable',
|
|
161
|
+
...params,
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
exports.ServiceUnavailableError = ServiceUnavailableError;
|
|
166
|
+
class UnauthorizedError extends OrchestratorError {
|
|
167
|
+
constructor(params) {
|
|
168
|
+
super({
|
|
169
|
+
message: 'Unauthorized',
|
|
170
|
+
...params,
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
exports.UnauthorizedError = UnauthorizedError;
|
|
175
|
+
class ForbiddenError extends OrchestratorError {
|
|
176
|
+
constructor(params) {
|
|
177
|
+
super({
|
|
178
|
+
message: 'Forbidden',
|
|
179
|
+
...params,
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
exports.ForbiddenError = ForbiddenError;
|
|
184
|
+
class ResourceNotFoundError extends OrchestratorError {
|
|
185
|
+
constructor(params) {
|
|
186
|
+
super({
|
|
187
|
+
message: 'Not Found',
|
|
188
|
+
...params,
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
exports.ResourceNotFoundError = ResourceNotFoundError;
|
|
193
|
+
class ConflictError extends OrchestratorError {
|
|
194
|
+
constructor(params) {
|
|
195
|
+
super({
|
|
196
|
+
message: 'Conflict',
|
|
197
|
+
...params,
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
exports.ConflictError = ConflictError;
|
|
202
|
+
class BadRequestError extends OrchestratorError {
|
|
203
|
+
constructor(params) {
|
|
204
|
+
super({
|
|
205
|
+
message: params?.message || 'Bad Request',
|
|
206
|
+
...params,
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
exports.BadRequestError = BadRequestError;
|
|
211
|
+
class UnprocessableEntityError extends OrchestratorError {
|
|
212
|
+
constructor(params) {
|
|
213
|
+
super({
|
|
214
|
+
message: params?.message || 'Unprocessable Entity',
|
|
215
|
+
...params,
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
exports.UnprocessableEntityError = UnprocessableEntityError;
|
|
220
|
+
class InternalServerError extends OrchestratorError {
|
|
221
|
+
constructor(params) {
|
|
222
|
+
super({
|
|
223
|
+
message: 'Internal Server Error',
|
|
224
|
+
...params,
|
|
225
|
+
});
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
exports.InternalServerError = InternalServerError;
|
|
229
|
+
class BodyParserError extends OrchestratorError {
|
|
230
|
+
constructor(params) {
|
|
231
|
+
super({
|
|
232
|
+
message: params?.message || 'Body parser error',
|
|
233
|
+
...params,
|
|
234
|
+
});
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
exports.BodyParserError = BodyParserError;
|
|
130
238
|
function isOrchestratorError(error) {
|
|
131
239
|
return error instanceof OrchestratorError;
|
|
132
240
|
}
|
|
241
|
+
function isRateLimited(error) {
|
|
242
|
+
return (error instanceof RateLimitedError ||
|
|
243
|
+
(error instanceof OrchestratorError && error.statusCode === 429));
|
|
244
|
+
}
|
|
245
|
+
function isValidationError(error) {
|
|
246
|
+
if (!(error instanceof OrchestratorError))
|
|
247
|
+
return false;
|
|
248
|
+
return error.statusCode === 400 || error.statusCode === 422;
|
|
249
|
+
}
|
|
250
|
+
function isAuthError(error) {
|
|
251
|
+
if (!(error instanceof OrchestratorError))
|
|
252
|
+
return false;
|
|
253
|
+
return (error.statusCode === 401 || error instanceof AuthenticationRequiredError);
|
|
254
|
+
}
|
|
255
|
+
function isRetryable(error) {
|
|
256
|
+
if (!(error instanceof OrchestratorError))
|
|
257
|
+
return false;
|
|
258
|
+
return error.statusCode === 500 || error.statusCode === 503;
|
|
259
|
+
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Orchestrator } from './client';
|
|
2
2
|
import { RHINESTONE_SPOKE_POOL_ADDRESS } from './consts';
|
|
3
|
-
import { AuthenticationRequiredError, InsufficientBalanceError, IntentNotFoundError, InvalidApiKeyError, InvalidIntentSignatureError, isOrchestratorError, NoPathFoundError, OnlyOneTargetTokenAmountCanBeUnsetError, OrchestratorError, TokenNotSupportedError, UnsupportedChainError, UnsupportedChainIdError, UnsupportedTokenError } from './error';
|
|
3
|
+
import { AuthenticationRequiredError, BadRequestError, BodyParserError, ConflictError, ForbiddenError, InsufficientBalanceError, IntentNotFoundError, InternalServerError, InvalidApiKeyError, InvalidIntentSignatureError, isAuthError, isOrchestratorError, isRateLimited, isRetryable, isValidationError, NoPathFoundError, OnlyOneTargetTokenAmountCanBeUnsetError, OrchestratorError, RateLimitedError, ResourceNotFoundError, SchemaValidationError, ServiceUnavailableError, TokenNotSupportedError, UnauthorizedError, UnprocessableEntityError, UnsupportedChainError, UnsupportedChainIdError, UnsupportedTokenError } from './error';
|
|
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
7
|
declare function getOrchestrator(apiKey?: string, orchestratorUrl?: string): Orchestrator;
|
|
8
8
|
export type { IntentCost, IntentInput, IntentOp, IntentOpStatus, IntentResult, IntentRoute, SettlementSystem, SignedIntentOp, SupportedChain, TokenConfig, Portfolio, };
|
|
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, };
|
|
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, BadRequestError, BodyParserError, ConflictError, ForbiddenError, InsufficientBalanceError, InvalidApiKeyError, InvalidIntentSignatureError, NoPathFoundError, OnlyOneTargetTokenAmountCanBeUnsetError, OrchestratorError, IntentNotFoundError, InternalServerError, ResourceNotFoundError, RateLimitedError, SchemaValidationError, ServiceUnavailableError, UnprocessableEntityError, UnauthorizedError, TokenNotSupportedError, UnsupportedChainError, UnsupportedChainIdError, UnsupportedTokenError, getOrchestrator, getWethAddress, getTokenSymbol, getTokenAddress, getSupportedTokens, isOrchestratorError, isRetryable, isAuthError, isValidationError, isRateLimited, isTokenAddressSupported, };
|
|
10
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;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
|
+
{"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,eAAe,EACf,eAAe,EACf,aAAa,EACb,cAAc,EACd,wBAAwB,EACxB,mBAAmB,EACnB,mBAAmB,EACnB,kBAAkB,EAClB,2BAA2B,EAC3B,WAAW,EACX,mBAAmB,EACnB,aAAa,EACb,WAAW,EACX,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AAgB,EAChB,qBAAqB,EACrB,uBAAuB,EACvB,wBAAwB,EACxB,iBAAiB,EACjB,sBAAsB,EACtB,qBAAqB,EACrB,uBAAuB,EACvB,qBAAqB,EACrB,eAAe,EACf,cAAc,EACd,cAAc,EACd,eAAe,EACf,kBAAkB,EAClB,mBAAmB,EACnB,WAAW,EACX,WAAW,EACX,iBAAiB,EACjB,aAAa,EACb,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.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;
|
|
3
|
+
exports.isTokenAddressSupported = exports.isRateLimited = exports.isValidationError = exports.isAuthError = exports.isRetryable = exports.isOrchestratorError = exports.getSupportedTokens = exports.getTokenAddress = exports.getTokenSymbol = exports.getWethAddress = exports.UnsupportedTokenError = exports.UnsupportedChainIdError = exports.UnsupportedChainError = exports.TokenNotSupportedError = exports.UnauthorizedError = exports.UnprocessableEntityError = exports.ServiceUnavailableError = exports.SchemaValidationError = exports.RateLimitedError = exports.ResourceNotFoundError = exports.InternalServerError = exports.IntentNotFoundError = exports.OrchestratorError = exports.OnlyOneTargetTokenAmountCanBeUnsetError = exports.NoPathFoundError = exports.InvalidIntentSignatureError = exports.InvalidApiKeyError = exports.InsufficientBalanceError = exports.ForbiddenError = exports.ConflictError = exports.BodyParserError = exports.BadRequestError = 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; } });
|
|
@@ -8,15 +8,30 @@ const consts_1 = require("./consts");
|
|
|
8
8
|
Object.defineProperty(exports, "RHINESTONE_SPOKE_POOL_ADDRESS", { enumerable: true, get: function () { return consts_1.RHINESTONE_SPOKE_POOL_ADDRESS; } });
|
|
9
9
|
const error_1 = require("./error");
|
|
10
10
|
Object.defineProperty(exports, "AuthenticationRequiredError", { enumerable: true, get: function () { return error_1.AuthenticationRequiredError; } });
|
|
11
|
+
Object.defineProperty(exports, "BadRequestError", { enumerable: true, get: function () { return error_1.BadRequestError; } });
|
|
12
|
+
Object.defineProperty(exports, "BodyParserError", { enumerable: true, get: function () { return error_1.BodyParserError; } });
|
|
13
|
+
Object.defineProperty(exports, "ConflictError", { enumerable: true, get: function () { return error_1.ConflictError; } });
|
|
14
|
+
Object.defineProperty(exports, "ForbiddenError", { enumerable: true, get: function () { return error_1.ForbiddenError; } });
|
|
11
15
|
Object.defineProperty(exports, "InsufficientBalanceError", { enumerable: true, get: function () { return error_1.InsufficientBalanceError; } });
|
|
12
16
|
Object.defineProperty(exports, "IntentNotFoundError", { enumerable: true, get: function () { return error_1.IntentNotFoundError; } });
|
|
17
|
+
Object.defineProperty(exports, "InternalServerError", { enumerable: true, get: function () { return error_1.InternalServerError; } });
|
|
13
18
|
Object.defineProperty(exports, "InvalidApiKeyError", { enumerable: true, get: function () { return error_1.InvalidApiKeyError; } });
|
|
14
19
|
Object.defineProperty(exports, "InvalidIntentSignatureError", { enumerable: true, get: function () { return error_1.InvalidIntentSignatureError; } });
|
|
20
|
+
Object.defineProperty(exports, "isAuthError", { enumerable: true, get: function () { return error_1.isAuthError; } });
|
|
15
21
|
Object.defineProperty(exports, "isOrchestratorError", { enumerable: true, get: function () { return error_1.isOrchestratorError; } });
|
|
22
|
+
Object.defineProperty(exports, "isRateLimited", { enumerable: true, get: function () { return error_1.isRateLimited; } });
|
|
23
|
+
Object.defineProperty(exports, "isRetryable", { enumerable: true, get: function () { return error_1.isRetryable; } });
|
|
24
|
+
Object.defineProperty(exports, "isValidationError", { enumerable: true, get: function () { return error_1.isValidationError; } });
|
|
16
25
|
Object.defineProperty(exports, "NoPathFoundError", { enumerable: true, get: function () { return error_1.NoPathFoundError; } });
|
|
17
26
|
Object.defineProperty(exports, "OnlyOneTargetTokenAmountCanBeUnsetError", { enumerable: true, get: function () { return error_1.OnlyOneTargetTokenAmountCanBeUnsetError; } });
|
|
18
27
|
Object.defineProperty(exports, "OrchestratorError", { enumerable: true, get: function () { return error_1.OrchestratorError; } });
|
|
28
|
+
Object.defineProperty(exports, "RateLimitedError", { enumerable: true, get: function () { return error_1.RateLimitedError; } });
|
|
29
|
+
Object.defineProperty(exports, "ResourceNotFoundError", { enumerable: true, get: function () { return error_1.ResourceNotFoundError; } });
|
|
30
|
+
Object.defineProperty(exports, "SchemaValidationError", { enumerable: true, get: function () { return error_1.SchemaValidationError; } });
|
|
31
|
+
Object.defineProperty(exports, "ServiceUnavailableError", { enumerable: true, get: function () { return error_1.ServiceUnavailableError; } });
|
|
19
32
|
Object.defineProperty(exports, "TokenNotSupportedError", { enumerable: true, get: function () { return error_1.TokenNotSupportedError; } });
|
|
33
|
+
Object.defineProperty(exports, "UnauthorizedError", { enumerable: true, get: function () { return error_1.UnauthorizedError; } });
|
|
34
|
+
Object.defineProperty(exports, "UnprocessableEntityError", { enumerable: true, get: function () { return error_1.UnprocessableEntityError; } });
|
|
20
35
|
Object.defineProperty(exports, "UnsupportedChainError", { enumerable: true, get: function () { return error_1.UnsupportedChainError; } });
|
|
21
36
|
Object.defineProperty(exports, "UnsupportedChainIdError", { enumerable: true, get: function () { return error_1.UnsupportedChainIdError; } });
|
|
22
37
|
Object.defineProperty(exports, "UnsupportedTokenError", { enumerable: true, get: function () { return error_1.UnsupportedTokenError; } });
|