@charterlabs/rhinestone-sdk 0.2.7-dev.3 → 0.2.7-dev.4
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 +55 -7
- package/dist/src/accounts/index.d.ts +28 -20
- package/dist/src/accounts/index.d.ts.map +1 -1
- package/dist/src/accounts/index.js +196 -21
- package/dist/src/accounts/index.test.js +2 -4
- 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/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 +52 -0
- package/dist/src/accounts/kernel.d.ts +1 -1
- package/dist/src/accounts/kernel.d.ts.map +1 -1
- package/dist/src/accounts/kernel.js +29 -1
- package/dist/src/accounts/kernel.test.js +35 -8
- package/dist/src/accounts/nexus.d.ts +4 -3
- package/dist/src/accounts/nexus.d.ts.map +1 -1
- package/dist/src/accounts/nexus.js +82 -14
- package/dist/src/accounts/nexus.test.js +33 -6
- package/dist/src/accounts/safe.d.ts.map +1 -1
- package/dist/src/accounts/safe.js +85 -53
- package/dist/src/accounts/safe.test.js +33 -6
- package/dist/src/accounts/signing/common.d.ts +4 -4
- package/dist/src/accounts/signing/common.d.ts.map +1 -1
- package/dist/src/accounts/signing/common.js +21 -9
- package/dist/src/accounts/signing/message.d.ts +1 -1
- package/dist/src/accounts/signing/message.d.ts.map +1 -1
- package/dist/src/accounts/signing/message.js +6 -6
- package/dist/src/accounts/signing/passkeys.d.ts +8 -1
- package/dist/src/accounts/signing/passkeys.d.ts.map +1 -1
- package/dist/src/accounts/signing/passkeys.js +35 -0
- package/dist/src/accounts/signing/passkeys.test.js +15 -0
- package/dist/src/accounts/signing/typedData.d.ts.map +1 -1
- package/dist/src/accounts/signing/typedData.js +2 -2
- package/dist/src/accounts/startale.test.js +0 -4
- 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 -166
- package/dist/src/actions/index.d.ts.map +1 -1
- package/dist/src/actions/index.js +25 -544
- 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/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 +24 -8
- package/dist/src/execution/compact.d.ts.map +1 -1
- package/dist/src/execution/compact.js +29 -103
- 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 +33 -22
- package/dist/src/execution/index.d.ts.map +1 -1
- package/dist/src/execution/index.js +57 -41
- 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 -28
- package/dist/src/execution/utils.d.ts.map +1 -1
- package/dist/src/execution/utils.js +245 -91
- package/dist/src/index.d.ts +37 -19
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +130 -66
- 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 +3 -2
- package/dist/src/modules/index.d.ts.map +1 -1
- package/dist/src/modules/index.js +16 -13
- package/dist/src/modules/index.test.js +8 -11
- package/dist/src/modules/read.d.ts.map +1 -1
- package/dist/src/modules/read.js +4 -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 +29 -10
- package/dist/src/modules/validators/core.test.js +4 -4
- package/dist/src/modules/validators/smart-sessions.test.js +0 -3
- package/dist/src/modules/validators/webauthn-contract.d.ts.map +1 -1
- package/dist/src/orchestrator/client.d.ts +2 -1
- package/dist/src/orchestrator/client.d.ts.map +1 -1
- package/dist/src/orchestrator/client.js +36 -14
- package/dist/src/orchestrator/consts.d.ts +1 -2
- package/dist/src/orchestrator/consts.d.ts.map +1 -1
- package/dist/src/orchestrator/consts.js +1 -3
- package/dist/src/orchestrator/registry.d.ts +3 -25
- package/dist/src/orchestrator/registry.d.ts.map +1 -1
- package/dist/src/orchestrator/registry.js +82 -46
- package/dist/src/orchestrator/registry.test.js +7 -7
- package/dist/src/orchestrator/types.d.ts +35 -31
- package/dist/src/orchestrator/types.d.ts.map +1 -1
- package/dist/src/types.d.ts +64 -9
- package/dist/src/types.d.ts.map +1 -1
- package/package.json +73 -2
- package/dist/src/actions/index.test.d.ts +0 -2
- 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
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const vitest_1 = require("vitest");
|
|
4
4
|
const consts_1 = require("../../test/consts");
|
|
5
|
+
const common_1 = require("./common");
|
|
5
6
|
const index_1 = require("./index");
|
|
6
7
|
(0, vitest_1.describe)('Modules', () => {
|
|
7
8
|
(0, vitest_1.describe)('Setup', () => {
|
|
8
9
|
(0, vitest_1.test)('should use ownable validator for ECDSA owners', () => {
|
|
9
10
|
const config = {
|
|
10
|
-
rhinestoneApiKey: consts_1.MOCK_API_KEY,
|
|
11
11
|
owners: {
|
|
12
12
|
type: 'ecdsa',
|
|
13
13
|
accounts: [consts_1.accountA],
|
|
@@ -15,12 +15,11 @@ const index_1 = require("./index");
|
|
|
15
15
|
},
|
|
16
16
|
};
|
|
17
17
|
const setup = (0, index_1.getSetup)(config);
|
|
18
|
-
(0, vitest_1.expect)(setup.validators[0].address).toBe('
|
|
19
|
-
(0, vitest_1.expect)(setup.validators[0].type).toBe(
|
|
18
|
+
(0, vitest_1.expect)(setup.validators[0].address).toBe('0x000000000013fdb5234e4e3162a810f54d9f7e98');
|
|
19
|
+
(0, vitest_1.expect)(setup.validators[0].type).toBe(common_1.MODULE_TYPE_ID_VALIDATOR);
|
|
20
20
|
});
|
|
21
21
|
(0, vitest_1.test)('should use webauthn validator for passkey owners', () => {
|
|
22
22
|
const config = {
|
|
23
|
-
rhinestoneApiKey: consts_1.MOCK_API_KEY,
|
|
24
23
|
owners: {
|
|
25
24
|
type: 'passkey',
|
|
26
25
|
accounts: [consts_1.passkeyAccount],
|
|
@@ -28,12 +27,11 @@ const index_1 = require("./index");
|
|
|
28
27
|
};
|
|
29
28
|
const setup = (0, index_1.getSetup)(config);
|
|
30
29
|
(0, vitest_1.expect)(setup.validators).toHaveLength(1);
|
|
31
|
-
(0, vitest_1.expect)(setup.validators[0].address).toBe('
|
|
32
|
-
(0, vitest_1.expect)(setup.validators[0].type).toBe(
|
|
30
|
+
(0, vitest_1.expect)(setup.validators[0].address).toBe('0x0000000000578c4cb0e472a5462da43c495c3f33');
|
|
31
|
+
(0, vitest_1.expect)(setup.validators[0].type).toBe(common_1.MODULE_TYPE_ID_VALIDATOR);
|
|
33
32
|
});
|
|
34
33
|
(0, vitest_1.test)('should use smart session validator when sessions are enabled', () => {
|
|
35
34
|
const config = {
|
|
36
|
-
rhinestoneApiKey: consts_1.MOCK_API_KEY,
|
|
37
35
|
owners: {
|
|
38
36
|
type: 'ecdsa',
|
|
39
37
|
accounts: [consts_1.accountA],
|
|
@@ -54,11 +52,10 @@ const index_1 = require("./index");
|
|
|
54
52
|
if (!smartSessionValidator) {
|
|
55
53
|
return;
|
|
56
54
|
}
|
|
57
|
-
(0, vitest_1.expect)(smartSessionValidator.type).toBe(
|
|
55
|
+
(0, vitest_1.expect)(smartSessionValidator.type).toBe(common_1.MODULE_TYPE_ID_VALIDATOR);
|
|
58
56
|
});
|
|
59
57
|
(0, vitest_1.test)('should use smart session compatibility fallback for safe accounts with sessions', () => {
|
|
60
58
|
const config = {
|
|
61
|
-
rhinestoneApiKey: consts_1.MOCK_API_KEY,
|
|
62
59
|
owners: {
|
|
63
60
|
type: 'ecdsa',
|
|
64
61
|
accounts: [consts_1.accountA],
|
|
@@ -78,12 +75,12 @@ const index_1 = require("./index");
|
|
|
78
75
|
},
|
|
79
76
|
};
|
|
80
77
|
const setup = (0, index_1.getSetup)(config);
|
|
81
|
-
const smartSessionFallback = setup.fallbacks.find((fallback) => fallback.address === '
|
|
78
|
+
const smartSessionFallback = setup.fallbacks.find((fallback) => fallback.address === '0x000000000052e9685932845660777DF43C2dC496');
|
|
82
79
|
(0, vitest_1.expect)(smartSessionFallback).toBeDefined();
|
|
83
80
|
if (!smartSessionFallback) {
|
|
84
81
|
return;
|
|
85
82
|
}
|
|
86
|
-
(0, vitest_1.expect)(smartSessionFallback.type).toBe(
|
|
83
|
+
(0, vitest_1.expect)(smartSessionFallback.type).toBe(common_1.MODULE_TYPE_ID_FALLBACK);
|
|
87
84
|
});
|
|
88
85
|
vitest_1.test.todo('using the omni account should install the necessary modules');
|
|
89
86
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"read.d.ts","sourceRoot":"","sources":["../../../modules/read.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAE,KAAK,KAAK,EAAsB,MAAM,MAAM,CAAA;AAEnE,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAG3D,iBAAe,aAAa,CAC1B,WAAW,EAAE,WAAW,EACxB,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE,KAAK,EACZ,QAAQ,CAAC,EAAE,cAAc,GACxB,OAAO,CAAC,OAAO,EAAE,CAAC,
|
|
1
|
+
{"version":3,"file":"read.d.ts","sourceRoot":"","sources":["../../../modules/read.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAE,KAAK,KAAK,EAAsB,MAAM,MAAM,CAAA;AAEnE,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAG3D,iBAAe,aAAa,CAC1B,WAAW,EAAE,WAAW,EACxB,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE,KAAK,EACZ,QAAQ,CAAC,EAAE,cAAc,GACxB,OAAO,CAAC,OAAO,EAAE,CAAC,CAkDpB;AAED,iBAAe,SAAS,CACtB,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE,KAAK,EACZ,QAAQ,CAAC,EAAE,cAAc,GACxB,OAAO,CAAC;IACT,QAAQ,EAAE,OAAO,EAAE,CAAA;IACnB,SAAS,EAAE,MAAM,CAAA;CAClB,GAAG,IAAI,CAAC,CAkER;AAED,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,CAAA"}
|
package/dist/src/modules/read.js
CHANGED
|
@@ -11,6 +11,7 @@ async function getValidators(accountType, account, chain, provider) {
|
|
|
11
11
|
transport: (0, utils_1.createTransport)(chain, provider),
|
|
12
12
|
});
|
|
13
13
|
switch (accountType) {
|
|
14
|
+
case 'custom':
|
|
14
15
|
case 'safe':
|
|
15
16
|
case 'startale':
|
|
16
17
|
case 'nexus': {
|
|
@@ -47,6 +48,9 @@ async function getValidators(accountType, account, chain, provider) {
|
|
|
47
48
|
});
|
|
48
49
|
return validators[0];
|
|
49
50
|
}
|
|
51
|
+
case 'eoa': {
|
|
52
|
+
return [];
|
|
53
|
+
}
|
|
50
54
|
case 'kernel': {
|
|
51
55
|
throw new Error('Kernel not supported');
|
|
52
56
|
}
|
|
@@ -13,13 +13,15 @@ interface WebauthnCredential {
|
|
|
13
13
|
declare const OWNABLE_VALIDATOR_ADDRESS: Address;
|
|
14
14
|
declare const WEBAUTHN_VALIDATOR_ADDRESS: Address;
|
|
15
15
|
declare const MULTI_FACTOR_VALIDATOR_ADDRESS: Address;
|
|
16
|
+
declare const WEBAUTHN_V0_VALIDATOR_ADDRESS: Address;
|
|
16
17
|
declare function getOwnerValidator(config: RhinestoneAccountConfig): Module;
|
|
17
18
|
declare function getMockSignature(ownerSet: OwnerSet): Hex;
|
|
18
19
|
declare function getValidator(owners: OwnerSet): Module;
|
|
19
|
-
declare function getOwnableValidator(threshold: number, owners: Address[]): Module;
|
|
20
|
-
declare function getWebAuthnValidator(threshold: number, webAuthnCredentials: WebauthnCredential[]): Module;
|
|
20
|
+
declare function getOwnableValidator(threshold: number, owners: Address[], address?: Address): Module;
|
|
21
|
+
declare function getWebAuthnValidator(threshold: number, webAuthnCredentials: WebauthnCredential[], address?: Address): Module;
|
|
21
22
|
declare function getMultiFactorValidator(threshold: number, validators: (OwnableValidatorConfig | WebauthnValidatorConfig | null)[]): Module;
|
|
22
23
|
declare function getSocialRecoveryValidator(guardians: Account[], threshold?: number): Module;
|
|
23
|
-
|
|
24
|
+
declare function supportsEip712(validator: Module): boolean;
|
|
25
|
+
export { OWNABLE_VALIDATOR_ADDRESS, WEBAUTHN_VALIDATOR_ADDRESS, MULTI_FACTOR_VALIDATOR_ADDRESS, WEBAUTHN_V0_VALIDATOR_ADDRESS, getOwnerValidator, getOwnableValidator, getWebAuthnValidator, getMultiFactorValidator, getSocialRecoveryValidator, getValidator, getMockSignature, supportsEip712, };
|
|
24
26
|
export type { WebauthnCredential };
|
|
25
27
|
//# sourceMappingURL=core.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../../../modules/validators/core.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,OAAO,EACZ,KAAK,OAAO,EAKZ,KAAK,GAAG,EAIT,MAAM,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../../../modules/validators/core.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,OAAO,EACZ,KAAK,OAAO,EAKZ,KAAK,GAAG,EAIT,MAAM,MAAM,CAAA;AAGb,OAAO,KAAK,EACV,sBAAsB,EACtB,QAAQ,EACR,uBAAuB,EACvB,uBAAuB,EACxB,MAAM,aAAa,CAAA;AAEpB,OAAO,EAA4B,KAAK,MAAM,EAAE,MAAM,WAAW,CAAA;AAEjE,UAAU,SAAS;IACjB,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAC3B,CAAC,EAAE,MAAM,CAAA;IACT,CAAC,EAAE,MAAM,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A"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MULTI_FACTOR_VALIDATOR_ADDRESS = exports.WEBAUTHN_VALIDATOR_ADDRESS = exports.OWNABLE_VALIDATOR_ADDRESS = void 0;
|
|
3
|
+
exports.WEBAUTHN_V0_VALIDATOR_ADDRESS = exports.MULTI_FACTOR_VALIDATOR_ADDRESS = exports.WEBAUTHN_VALIDATOR_ADDRESS = exports.OWNABLE_VALIDATOR_ADDRESS = void 0;
|
|
4
4
|
exports.getOwnerValidator = getOwnerValidator;
|
|
5
5
|
exports.getOwnableValidator = getOwnableValidator;
|
|
6
6
|
exports.getWebAuthnValidator = getWebAuthnValidator;
|
|
@@ -8,18 +8,28 @@ exports.getMultiFactorValidator = getMultiFactorValidator;
|
|
|
8
8
|
exports.getSocialRecoveryValidator = getSocialRecoveryValidator;
|
|
9
9
|
exports.getValidator = getValidator;
|
|
10
10
|
exports.getMockSignature = getMockSignature;
|
|
11
|
+
exports.supportsEip712 = supportsEip712;
|
|
11
12
|
const viem_1 = require("viem");
|
|
13
|
+
const error_1 = require("../../accounts/error");
|
|
12
14
|
const common_1 = require("../common");
|
|
13
|
-
const OWNABLE_VALIDATOR_ADDRESS = '
|
|
15
|
+
const OWNABLE_VALIDATOR_ADDRESS = '0x000000000013fdb5234e4e3162a810f54d9f7e98';
|
|
14
16
|
exports.OWNABLE_VALIDATOR_ADDRESS = OWNABLE_VALIDATOR_ADDRESS;
|
|
15
|
-
const WEBAUTHN_VALIDATOR_ADDRESS = '
|
|
17
|
+
const WEBAUTHN_VALIDATOR_ADDRESS = '0x0000000000578c4cb0e472a5462da43c495c3f33';
|
|
16
18
|
exports.WEBAUTHN_VALIDATOR_ADDRESS = WEBAUTHN_VALIDATOR_ADDRESS;
|
|
17
|
-
const SOCIAL_RECOVERY_VALIDATOR_ADDRESS = '
|
|
18
|
-
const MULTI_FACTOR_VALIDATOR_ADDRESS = '
|
|
19
|
+
const SOCIAL_RECOVERY_VALIDATOR_ADDRESS = '0xa04d053b3c8021e8d5bf641816c42daa75d8b597';
|
|
20
|
+
const MULTI_FACTOR_VALIDATOR_ADDRESS = '0xf6bdf42c9be18ceca5c06c42a43daf7fbbe7896b';
|
|
19
21
|
exports.MULTI_FACTOR_VALIDATOR_ADDRESS = MULTI_FACTOR_VALIDATOR_ADDRESS;
|
|
22
|
+
// Legacy
|
|
23
|
+
const OWNABLE_V0_VALIDATOR_ADDRESS = '0x2483da3a338895199e5e538530213157e931bf06';
|
|
24
|
+
const OWNABLE_BETA_VALIDATOR_ADDRESS = '0x0000000000e9e6e96bcaa3c113187cdb7e38aed9';
|
|
25
|
+
const WEBAUTHN_V0_VALIDATOR_ADDRESS = '0x0000000000578c4cb0e472a5462da43c495c3f33';
|
|
26
|
+
exports.WEBAUTHN_V0_VALIDATOR_ADDRESS = WEBAUTHN_V0_VALIDATOR_ADDRESS;
|
|
20
27
|
const ECDSA_MOCK_SIGNATURE = '0x81d4b4981670cb18f99f0b4a66446df1bf5b204d24cfcb659bf38ba27a4359b5711649ec2423c5e1247245eba2964679b6a1dbb85c992ae40b9b00c6935b02ff1b';
|
|
21
28
|
const WEBAUTHN_MOCK_SIGNATURE = '0x0000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000001b9b86eb98fda3ed4d797d9e690588dfadf17b329a76a47cec935bebf92d7ddc80000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000120000000000000000000000000000000000000000000000000000000000000001700000000000000000000000000000000000000000000000000000000000000019b2e9410bb6850f9f660a03d609d5a844fb96bcdc87a15139b03ee22c70f469100d2b865a215c3bf786387064effa8fcedcb1d625b5148f8a1236d5e3ff11acf000000000000000000000000000000000000000000000000000000000000002549960de5880e8c687434170f6476605b8fe4aeb9a28632c7995cf3ba831d9763050000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000867b2274797065223a22776562617574686e2e676574222c226368616c6c656e6765223a22396a4546696a75684557724d34534f572d7443684a625545484550343456636a634a2d42716f3166544d38222c226f726967696e223a22687474703a2f2f6c6f63616c686f73743a38303830222c2263726f73734f726967696e223a66616c73657d0000000000000000000000000000000000000000000000000000';
|
|
22
29
|
function getOwnerValidator(config) {
|
|
30
|
+
if (!config.owners) {
|
|
31
|
+
throw new error_1.OwnersFieldRequiredError();
|
|
32
|
+
}
|
|
23
33
|
return getValidator(config.owners);
|
|
24
34
|
}
|
|
25
35
|
function getMockSignature(ownerSet) {
|
|
@@ -65,7 +75,7 @@ function getMockSignature(ownerSet) {
|
|
|
65
75
|
function getValidator(owners) {
|
|
66
76
|
switch (owners.type) {
|
|
67
77
|
case 'ecdsa':
|
|
68
|
-
return getOwnableValidator(owners.threshold ?? 1, owners.accounts.map((account) => account.address));
|
|
78
|
+
return getOwnableValidator(owners.threshold ?? 1, owners.accounts.map((account) => account.address), owners.module);
|
|
69
79
|
case 'passkey':
|
|
70
80
|
return getWebAuthnValidator(owners.threshold ?? 1, owners.accounts.map((account) => ({
|
|
71
81
|
pubKey: account.publicKey,
|
|
@@ -76,9 +86,9 @@ function getValidator(owners) {
|
|
|
76
86
|
}
|
|
77
87
|
}
|
|
78
88
|
}
|
|
79
|
-
function getOwnableValidator(threshold, owners) {
|
|
89
|
+
function getOwnableValidator(threshold, owners, address) {
|
|
80
90
|
return {
|
|
81
|
-
address: OWNABLE_VALIDATOR_ADDRESS,
|
|
91
|
+
address: address ?? OWNABLE_VALIDATOR_ADDRESS,
|
|
82
92
|
initData: (0, viem_1.encodeAbiParameters)([
|
|
83
93
|
{ name: 'threshold', type: 'uint256' },
|
|
84
94
|
{ name: 'owners', type: 'address[]' },
|
|
@@ -91,7 +101,7 @@ function getOwnableValidator(threshold, owners) {
|
|
|
91
101
|
type: common_1.MODULE_TYPE_ID_VALIDATOR,
|
|
92
102
|
};
|
|
93
103
|
}
|
|
94
|
-
function getWebAuthnValidator(threshold, webAuthnCredentials) {
|
|
104
|
+
function getWebAuthnValidator(threshold, webAuthnCredentials, address) {
|
|
95
105
|
function getPublicKey(webAuthnCredential) {
|
|
96
106
|
if (typeof webAuthnCredential.pubKey === 'string' ||
|
|
97
107
|
webAuthnCredential.pubKey instanceof Uint8Array) {
|
|
@@ -112,7 +122,7 @@ function getWebAuthnValidator(threshold, webAuthnCredentials) {
|
|
|
112
122
|
}
|
|
113
123
|
const publicKeys = webAuthnCredentials.map(getPublicKey);
|
|
114
124
|
return {
|
|
115
|
-
address: WEBAUTHN_VALIDATOR_ADDRESS,
|
|
125
|
+
address: address ?? WEBAUTHN_VALIDATOR_ADDRESS,
|
|
116
126
|
initData: (0, viem_1.encodeAbiParameters)([
|
|
117
127
|
{ name: 'threshold', type: 'uint256' },
|
|
118
128
|
{
|
|
@@ -220,3 +230,12 @@ function parsePublicKey(publicKey) {
|
|
|
220
230
|
y: BigInt((0, viem_1.bytesToHex)(y)),
|
|
221
231
|
};
|
|
222
232
|
}
|
|
233
|
+
function supportsEip712(validator) {
|
|
234
|
+
switch (validator.address.toLowerCase()) {
|
|
235
|
+
case OWNABLE_BETA_VALIDATOR_ADDRESS: // Ownable Validator V1-beta
|
|
236
|
+
case OWNABLE_V0_VALIDATOR_ADDRESS: // Ownable Validator V0
|
|
237
|
+
return false;
|
|
238
|
+
default:
|
|
239
|
+
return true;
|
|
240
|
+
}
|
|
241
|
+
}
|
|
@@ -14,7 +14,7 @@ const core_1 = require("./core");
|
|
|
14
14
|
});
|
|
15
15
|
(0, vitest_1.expect)(validator.type).toEqual(common_1.MODULE_TYPE_ID_VALIDATOR);
|
|
16
16
|
(0, vitest_1.expect)((0, viem_1.isAddress)(validator.address)).toEqual(true);
|
|
17
|
-
(0, vitest_1.expect)(validator.address).toEqual('
|
|
17
|
+
(0, vitest_1.expect)(validator.address).toEqual('0x000000000013fdb5234e4e3162a810f54d9f7e98');
|
|
18
18
|
(0, vitest_1.expect)(validator.initData).toEqual('0x000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000001000000000000000000000000f6c02c78ded62973b43bfa523b247da099486936');
|
|
19
19
|
});
|
|
20
20
|
(0, vitest_1.test)('ECDSA: two addresses', () => {
|
|
@@ -24,7 +24,7 @@ const core_1 = require("./core");
|
|
|
24
24
|
});
|
|
25
25
|
(0, vitest_1.expect)(validator.type).toEqual(common_1.MODULE_TYPE_ID_VALIDATOR);
|
|
26
26
|
(0, vitest_1.expect)((0, viem_1.isAddress)(validator.address)).toEqual(true);
|
|
27
|
-
(0, vitest_1.expect)(validator.address).toEqual('
|
|
27
|
+
(0, vitest_1.expect)(validator.address).toEqual('0x000000000013fdb5234e4e3162a810f54d9f7e98');
|
|
28
28
|
(0, vitest_1.expect)(validator.initData).toEqual('0x0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000020000000000000000000000006092086a3dc0020cd604a68fcf5d430007d51bb7000000000000000000000000f6c02c78ded62973b43bfa523b247da099486936');
|
|
29
29
|
});
|
|
30
30
|
(0, vitest_1.test)('ECDSA: three addresses, custom threshold', () => {
|
|
@@ -35,7 +35,7 @@ const core_1 = require("./core");
|
|
|
35
35
|
});
|
|
36
36
|
(0, vitest_1.expect)(validator.type).toEqual(common_1.MODULE_TYPE_ID_VALIDATOR);
|
|
37
37
|
(0, vitest_1.expect)((0, viem_1.isAddress)(validator.address)).toEqual(true);
|
|
38
|
-
(0, vitest_1.expect)(validator.address).toEqual('
|
|
38
|
+
(0, vitest_1.expect)(validator.address).toEqual('0x000000000013fdb5234e4e3162a810f54d9f7e98');
|
|
39
39
|
(0, vitest_1.expect)(validator.initData).toEqual('0x0000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000030000000000000000000000006092086a3dc0020cd604a68fcf5d430007d51bb7000000000000000000000000c27b7578151c5ef713c62c65db09763d57ac3596000000000000000000000000f6c02c78ded62973b43bfa523b247da099486936');
|
|
40
40
|
});
|
|
41
41
|
(0, vitest_1.test)('Passkey', () => {
|
|
@@ -45,7 +45,7 @@ const core_1 = require("./core");
|
|
|
45
45
|
});
|
|
46
46
|
(0, vitest_1.expect)(validator.type).toEqual(common_1.MODULE_TYPE_ID_VALIDATOR);
|
|
47
47
|
(0, vitest_1.expect)((0, viem_1.isAddress)(validator.address)).toEqual(true);
|
|
48
|
-
(0, vitest_1.expect)(validator.address).toEqual('
|
|
48
|
+
(0, vitest_1.expect)(validator.address).toEqual('0x0000000000578c4cb0e472a5462da43c495c3f33');
|
|
49
49
|
(0, vitest_1.expect)(validator.initData).toEqual('0x000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000001580a9af0569ad3905b26a703201b358aa0904236642ebe79b22a19d00d3737637d46f725a5427ae45a9569259bf67e1e16b187d7b3ad1ed70138c4f0409677d10000000000000000000000000000000000000000000000000000000000000000');
|
|
50
50
|
});
|
|
51
51
|
});
|
|
@@ -34,7 +34,6 @@ const smart_sessions_2 = require("./smart-sessions");
|
|
|
34
34
|
type: 'ecdsa',
|
|
35
35
|
accounts: [consts_1.accountA],
|
|
36
36
|
},
|
|
37
|
-
rhinestoneApiKey: consts_1.MOCK_API_KEY,
|
|
38
37
|
})).toBeNull();
|
|
39
38
|
});
|
|
40
39
|
(0, vitest_1.test)('empty session list', () => {
|
|
@@ -43,7 +42,6 @@ const smart_sessions_2 = require("./smart-sessions");
|
|
|
43
42
|
type: 'ecdsa',
|
|
44
43
|
accounts: [consts_1.accountA],
|
|
45
44
|
},
|
|
46
|
-
rhinestoneApiKey: consts_1.MOCK_API_KEY,
|
|
47
45
|
sessions: [],
|
|
48
46
|
})).not.toBeNull();
|
|
49
47
|
});
|
|
@@ -53,7 +51,6 @@ const smart_sessions_2 = require("./smart-sessions");
|
|
|
53
51
|
type: 'ecdsa',
|
|
54
52
|
accounts: [consts_1.accountA],
|
|
55
53
|
},
|
|
56
|
-
rhinestoneApiKey: consts_1.MOCK_API_KEY,
|
|
57
54
|
sessions: [
|
|
58
55
|
{
|
|
59
56
|
owners: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webauthn-contract.d.ts","sourceRoot":"","sources":["../../../../modules/validators/webauthn-contract.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"webauthn-contract.d.ts","sourceRoot":"","sources":["../../../../modules/validators/webauthn-contract.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,OAAO,EACZ,KAAK,KAAK,EAGV,KAAK,GAAG,EACT,MAAM,MAAM,CAAA;AAGb,OAAO,KAAK,EAAE,IAAI,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAGvD;;GAEG;AACH,QAAA,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAyFlB,CAAA;AAEV;;;;;;;;GAQG;AACH,iBAAe,oBAAoB,CACjC,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,EACf,cAAc,EAAE,OAAO,EACvB,KAAK,EAAE,KAAK,EACZ,QAAQ,CAAC,EAAE,cAAc,GACxB,OAAO,CAAC,GAAG,CAAC,CAcd;AAED;;;;;;GAMG;AACH,iBAAe,gBAAgB,CAC7B,cAAc,EAAE,OAAO,EACvB,KAAK,EAAE,KAAK,EACZ,QAAQ,CAAC,EAAE,cAAc,GACxB,OAAO,CAAC,GAAG,EAAE,CAAC,CAchB;AAED;;;;;;;GAOG;AACH,iBAAe,iBAAiB,CAC9B,YAAY,EAAE,G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,CAAA;IACf,OAAO,EAAE,MAAM,CAAA;IACf,SAAS,EAAE,OAAO,CAAA;CACnB,CAAC,CACH,CAqBA;AAED,OAAO,EACL,oBAAoB,EACpB,gBAAgB,EAChB,iBAAiB,EACjB,aAAa,EACb,aAAa,EACb,gBAAgB,EAChB,YAAY,EACZ,iBAAiB,EACjB,YAAY,EACZ,cAAc,EACd,sBAAsB,GACvB,CAAA"}
|
|
@@ -10,10 +10,11 @@ export declare class Orchestrator {
|
|
|
10
10
|
[chainId: number]: Address[];
|
|
11
11
|
};
|
|
12
12
|
}): Promise<Portfolio>;
|
|
13
|
-
getMaxTokenAmount(userAddress: Address, destinationChainId: number, destinationTokenAddress: Address, destinationGasUnits: bigint): Promise<bigint>;
|
|
13
|
+
getMaxTokenAmount(userAddress: Address, destinationChainId: number, destinationTokenAddress: Address, destinationGasUnits: bigint, sponsored: boolean): Promise<bigint>;
|
|
14
14
|
getIntentCost(input: IntentInput): Promise<IntentCost>;
|
|
15
15
|
getIntentRoute(input: IntentInput): Promise<IntentRoute>;
|
|
16
16
|
submitIntent(signedIntentOp: SignedIntentOp): Promise<IntentResult>;
|
|
17
|
+
simulateIntent(signedIntentOp: SignedIntentOp): Promise<IntentResult>;
|
|
17
18
|
getIntentOpStatus(intentId: bigint): Promise<IntentOpStatus>;
|
|
18
19
|
private parseError;
|
|
19
20
|
private parseErrorMessage;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../orchestrator/client.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,OAAO,EAAuB,MAAM,MAAM,CAAA;AAexD,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,EA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OAAO,CAAC,UAAU,CAAC;IAqBtD,cAAc,CAAC,KAAK,EAAE,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC;IAqBxD,YAAY,CAAC,cAAc,EAAE,cAAc,GAAG,OAAO,CAAC,YAAY,CAAC;IAqBnE,cAAc,CAAC,cAAc,EAAE,cAAc,GAAG,OAAO,CAAC,YAAY,CAAC;IAqBrE,iBAAiB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC;IAkBlE,OAAO,CAAC,UAAU;IA0ElB,OAAO,CAAC,iBAAiB;CAmD1B"}
|
|
@@ -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,
|
|
@@ -63,7 +63,6 @@ class Orchestrator {
|
|
|
63
63
|
data: '0x',
|
|
64
64
|
},
|
|
65
65
|
],
|
|
66
|
-
delegations: {},
|
|
67
66
|
},
|
|
68
67
|
destinationExecutions: [],
|
|
69
68
|
destinationChainId,
|
|
@@ -73,6 +72,14 @@ class Orchestrator {
|
|
|
73
72
|
tokenAddress: destinationTokenAddress,
|
|
74
73
|
},
|
|
75
74
|
],
|
|
75
|
+
options: {
|
|
76
|
+
topupCompact: false,
|
|
77
|
+
sponsorSettings: {
|
|
78
|
+
gasSponsored: sponsored,
|
|
79
|
+
bridgeFeesSponsored: sponsored,
|
|
80
|
+
swapFeesSponsored: sponsored,
|
|
81
|
+
},
|
|
82
|
+
},
|
|
76
83
|
});
|
|
77
84
|
if (!intentCost.hasFulfilledAll) {
|
|
78
85
|
return 0n;
|
|
@@ -86,17 +93,16 @@ class Orchestrator {
|
|
|
86
93
|
if (tokenAmount < 0n) {
|
|
87
94
|
throw new Error(`Balance not available. Make sure the account is deployed`);
|
|
88
95
|
}
|
|
89
|
-
|
|
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;
|
|
90
101
|
}
|
|
91
102
|
async getIntentCost(input) {
|
|
92
103
|
try {
|
|
93
104
|
const response = await axios_1.default.post(`${this.serverUrl}/intents/cost`, {
|
|
94
|
-
...(0, utils_1.convertBigIntFields)(
|
|
95
|
-
...input,
|
|
96
|
-
tokenTransfers: input.tokenTransfers.map((transfer) => ({
|
|
97
|
-
tokenAddress: transfer.tokenAddress,
|
|
98
|
-
})),
|
|
99
|
-
}),
|
|
105
|
+
...(0, utils_1.convertBigIntFields)(input),
|
|
100
106
|
}, {
|
|
101
107
|
headers: {
|
|
102
108
|
'x-api-key': this.apiKey,
|
|
@@ -106,7 +112,7 @@ class Orchestrator {
|
|
|
106
112
|
}
|
|
107
113
|
catch (error) {
|
|
108
114
|
this.parseError(error);
|
|
109
|
-
throw new
|
|
115
|
+
throw new error_1.OrchestratorError({ message: 'Failed to get intent cost' });
|
|
110
116
|
}
|
|
111
117
|
}
|
|
112
118
|
async getIntentRoute(input) {
|
|
@@ -122,7 +128,7 @@ class Orchestrator {
|
|
|
122
128
|
}
|
|
123
129
|
catch (error) {
|
|
124
130
|
this.parseError(error);
|
|
125
|
-
throw new
|
|
131
|
+
throw new error_1.OrchestratorError({ message: 'Failed to get intent route' });
|
|
126
132
|
}
|
|
127
133
|
}
|
|
128
134
|
async submitIntent(signedIntentOp) {
|
|
@@ -138,7 +144,23 @@ class Orchestrator {
|
|
|
138
144
|
}
|
|
139
145
|
catch (error) {
|
|
140
146
|
this.parseError(error);
|
|
141
|
-
throw new
|
|
147
|
+
throw new error_1.OrchestratorError({ message: 'Failed to submit intent' });
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
async simulateIntent(signedIntentOp) {
|
|
151
|
+
try {
|
|
152
|
+
const response = await axios_1.default.post(`${this.serverUrl}/intent-operations/simulate`, {
|
|
153
|
+
signedIntentOp: (0, utils_1.convertBigIntFields)(signedIntentOp),
|
|
154
|
+
}, {
|
|
155
|
+
headers: {
|
|
156
|
+
'x-api-key': this.apiKey,
|
|
157
|
+
},
|
|
158
|
+
});
|
|
159
|
+
return response.data;
|
|
160
|
+
}
|
|
161
|
+
catch (error) {
|
|
162
|
+
this.parseError(error);
|
|
163
|
+
throw new error_1.OrchestratorError({ message: 'Failed to simulate intent' });
|
|
142
164
|
}
|
|
143
165
|
}
|
|
144
166
|
async getIntentOpStatus(intentId) {
|
|
@@ -152,7 +174,7 @@ class Orchestrator {
|
|
|
152
174
|
}
|
|
153
175
|
catch (error) {
|
|
154
176
|
this.parseError(error);
|
|
155
|
-
throw new
|
|
177
|
+
throw new error_1.OrchestratorError({ message: 'Failed to get intent op status' });
|
|
156
178
|
}
|
|
157
179
|
}
|
|
158
180
|
parseError(error) {
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
declare const PROD_ORCHESTRATOR_URL = "https://v1.orchestrator.rhinestone.dev";
|
|
2
2
|
declare const STAGING_ORCHESTRATOR_URL = "https://staging.v1.orchestrator.rhinestone.dev";
|
|
3
|
-
declare const DEV_ORCHESTRATOR_URL = "https://dev.v1.orchestrator.rhinestone.dev";
|
|
4
3
|
declare const RHINESTONE_SPOKE_POOL_ADDRESS = "0x000000000060f6e853447881951574cdd0663530";
|
|
5
|
-
export { PROD_ORCHESTRATOR_URL, STAGING_ORCHESTRATOR_URL,
|
|
4
|
+
export { PROD_ORCHESTRATOR_URL, STAGING_ORCHESTRATOR_URL, RHINESTONE_SPOKE_POOL_ADDRESS, };
|
|
6
5
|
//# sourceMappingURL=consts.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"consts.d.ts","sourceRoot":"","sources":["../../../orchestrator/consts.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,qBAAqB,2CAA2C,CAAA;AACtE,QAAA,MAAM,wBAAwB,mDACoB,CAAA;AAClD,QAAA,MAAM,
|
|
1
|
+
{"version":3,"file":"consts.d.ts","sourceRoot":"","sources":["../../../orchestrator/consts.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,qBAAqB,2CAA2C,CAAA;AACtE,QAAA,MAAM,wBAAwB,mDACoB,CAAA;AAClD,QAAA,MAAM,6BAA6B,+CACW,CAAA;AAE9C,OAAO,EACL,qBAAqB,EACrB,wBAAwB,EACxB,6BAA6B,GAC9B,CAAA"}
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.RHINESTONE_SPOKE_POOL_ADDRESS = exports.
|
|
3
|
+
exports.RHINESTONE_SPOKE_POOL_ADDRESS = exports.STAGING_ORCHESTRATOR_URL = exports.PROD_ORCHESTRATOR_URL = void 0;
|
|
4
4
|
const PROD_ORCHESTRATOR_URL = 'https://v1.orchestrator.rhinestone.dev';
|
|
5
5
|
exports.PROD_ORCHESTRATOR_URL = PROD_ORCHESTRATOR_URL;
|
|
6
6
|
const STAGING_ORCHESTRATOR_URL = 'https://staging.v1.orchestrator.rhinestone.dev';
|
|
7
7
|
exports.STAGING_ORCHESTRATOR_URL = STAGING_ORCHESTRATOR_URL;
|
|
8
|
-
const DEV_ORCHESTRATOR_URL = 'https://dev.v1.orchestrator.rhinestone.dev';
|
|
9
|
-
exports.DEV_ORCHESTRATOR_URL = DEV_ORCHESTRATOR_URL;
|
|
10
8
|
const RHINESTONE_SPOKE_POOL_ADDRESS = '0x000000000060f6e853447881951574cdd0663530';
|
|
11
9
|
exports.RHINESTONE_SPOKE_POOL_ADDRESS = RHINESTONE_SPOKE_POOL_ADDRESS;
|
|
@@ -1,32 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { Address, 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
|
-
declare function getTokenAddress(
|
|
29
|
-
declare function getChainById(chainId: number): Chain
|
|
7
|
+
declare function getTokenAddress(token: TokenSymbol | Address, chainId: number): Address;
|
|
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":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,MAAM,CAAA;AAe1C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AAE3C,OAAO,KAAK,EAAkB,WAAW,EAAE,MAAM,SAAS,CAAA;AAE1D,iBAAS,oBAAoB,IAAI,MAAM,EAAE,CAGxC;AAQD,iBAAS,cAAc,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO,CAc7C;AAED,iBAAS,cAAc,CAAC,YAAY,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAgBtE;AAED,iBAAS,eAAe,CACtB,KAAK,EAAE,WAAW,GAAG,OAAO,EAC5B,OAAO,EAAE,MAAM,GACd,OAAO,CAST;AAQD,iBAAS,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,KAAK,CAkB5C;AAED,iBAAS,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAG3C;AAED,iBAAS,uBAAuB,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAU3E;AAED,iBAAS,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,WAAW,EAAE,CAU1D;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"}
|