@rhinestone/sdk 1.4.2 → 2.0.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +89 -1
- package/dist/src/accounts/error.d.ts +1 -1
- package/dist/src/accounts/error.js +1 -19
- package/dist/src/accounts/index.d.ts +5 -5
- package/dist/src/accounts/index.js +121 -157
- package/dist/src/accounts/json-rpc/index.d.ts +1 -1
- package/dist/src/accounts/json-rpc/index.js +8 -10
- package/dist/src/accounts/json-rpc/providers.d.ts +1 -1
- package/dist/src/accounts/json-rpc/providers.js +4 -7
- package/dist/src/accounts/kernel.d.ts +3 -3
- package/dist/src/accounts/kernel.js +66 -75
- package/dist/src/accounts/nexus.d.ts +3 -3
- package/dist/src/accounts/nexus.js +62 -73
- package/dist/src/accounts/passport.d.ts +3 -3
- package/dist/src/accounts/passport.js +9 -13
- package/dist/src/accounts/safe.d.ts +3 -3
- package/dist/src/accounts/safe.js +54 -63
- package/dist/src/accounts/signing/common.d.ts +10 -4
- package/dist/src/accounts/signing/common.d.ts.map +1 -1
- package/dist/src/accounts/signing/common.js +30 -36
- package/dist/src/accounts/signing/message.d.ts +2 -2
- package/dist/src/accounts/signing/message.js +10 -12
- package/dist/src/accounts/signing/passkeys.js +11 -17
- package/dist/src/accounts/signing/typedData.d.ts +1 -1
- package/dist/src/accounts/signing/typedData.js +6 -8
- package/dist/src/accounts/startale.d.ts +3 -3
- package/dist/src/accounts/startale.js +37 -47
- package/dist/src/accounts/utils.d.ts +2 -2
- package/dist/src/accounts/utils.js +22 -28
- package/dist/src/accounts/walletClient.js +4 -8
- package/dist/src/actions/compact.d.ts +1 -1
- package/dist/src/actions/compact.js +22 -35
- package/dist/src/actions/deployment.d.ts +1 -1
- package/dist/src/actions/deployment.js +11 -13
- package/dist/src/actions/ecdsa.d.ts +1 -1
- package/dist/src/actions/ecdsa.js +14 -20
- package/dist/src/actions/index.d.ts +2 -2
- package/dist/src/actions/index.js +6 -10
- package/dist/src/actions/mfa.d.ts +1 -1
- package/dist/src/actions/mfa.js +18 -24
- package/dist/src/actions/passkeys.d.ts +2 -2
- package/dist/src/actions/passkeys.js +14 -20
- package/dist/src/actions/recovery.d.ts +1 -1
- package/dist/src/actions/recovery.js +25 -29
- package/dist/src/actions/smart-sessions.d.ts +1 -1
- package/dist/src/actions/smart-sessions.js +8 -12
- package/dist/src/auth/provider.d.ts +7 -0
- package/dist/src/auth/provider.d.ts.map +1 -0
- package/dist/src/auth/provider.js +38 -0
- package/dist/src/errors/index.d.ts +3 -3
- package/dist/src/errors/index.js +10 -54
- package/dist/src/execution/compact.d.ts +3 -3
- package/dist/src/execution/compact.js +10 -18
- package/dist/src/execution/error.js +1 -11
- package/dist/src/execution/index.d.ts +9 -8
- package/dist/src/execution/index.d.ts.map +1 -1
- package/dist/src/execution/index.js +54 -67
- package/dist/src/execution/permit2.d.ts +5 -5
- package/dist/src/execution/permit2.js +8 -13
- package/dist/src/execution/singleChainOps.d.ts +2 -2
- package/dist/src/execution/singleChainOps.js +1 -3
- package/dist/src/execution/types.d.ts +1 -1
- package/dist/src/execution/types.js +1 -2
- package/dist/src/execution/utils.d.ts +10 -6
- package/dist/src/execution/utils.d.ts.map +1 -1
- package/dist/src/execution/utils.js +159 -162
- package/dist/src/index.d.ts +10 -10
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +57 -67
- package/dist/src/jwt-server/digest.d.ts +11 -0
- package/dist/src/jwt-server/digest.d.ts.map +1 -0
- package/dist/src/jwt-server/digest.js +19 -0
- package/dist/src/jwt-server/express.d.ts +16 -0
- package/dist/src/jwt-server/express.d.ts.map +1 -0
- package/dist/src/jwt-server/express.js +23 -0
- package/dist/src/jwt-server/handlers.d.ts +10 -0
- package/dist/src/jwt-server/handlers.d.ts.map +1 -0
- package/dist/src/jwt-server/handlers.js +37 -0
- package/dist/src/jwt-server/index.d.ts +8 -0
- package/dist/src/jwt-server/index.d.ts.map +1 -0
- package/dist/src/jwt-server/index.js +7 -0
- package/dist/src/jwt-server/jcs.d.ts +12 -0
- package/dist/src/jwt-server/jcs.d.ts.map +1 -0
- package/dist/src/jwt-server/jcs.js +57 -0
- package/dist/src/jwt-server/signer.d.ts +18 -0
- package/dist/src/jwt-server/signer.d.ts.map +1 -0
- package/dist/src/jwt-server/signer.js +68 -0
- package/dist/src/jwt-server/sponsorship.d.ts +19 -0
- package/dist/src/jwt-server/sponsorship.d.ts.map +1 -0
- package/dist/src/jwt-server/sponsorship.js +51 -0
- package/dist/src/jwt-server/web.d.ts +4 -0
- package/dist/src/jwt-server/web.d.ts.map +1 -0
- package/dist/src/jwt-server/web.js +23 -0
- package/dist/src/modules/abi/smart-session-emissary.js +1 -3
- package/dist/src/modules/abi/smart-sessions.js +1 -4
- package/dist/src/modules/chain-abstraction.js +1 -5
- package/dist/src/modules/common.d.ts +1 -1
- package/dist/src/modules/common.js +1 -13
- package/dist/src/modules/index.d.ts +5 -5
- package/dist/src/modules/index.js +35 -50
- package/dist/src/modules/legacy.d.ts +2 -2
- package/dist/src/modules/legacy.js +11 -14
- package/dist/src/modules/read.d.ts +1 -1
- package/dist/src/modules/read.js +11 -15
- package/dist/src/modules/validators/core.d.ts +2 -2
- package/dist/src/modules/validators/core.js +26 -44
- package/dist/src/modules/validators/index.d.ts +2 -2
- package/dist/src/modules/validators/index.js +3 -19
- package/dist/src/modules/validators/policies/claim/permit2.d.ts +1 -1
- package/dist/src/modules/validators/policies/claim/permit2.js +39 -44
- package/dist/src/modules/validators/policies/claim/types.js +11 -14
- package/dist/src/modules/validators/smart-sessions.d.ts +4 -4
- package/dist/src/modules/validators/smart-sessions.d.ts.map +1 -1
- package/dist/src/modules/validators/smart-sessions.js +77 -97
- package/dist/src/orchestrator/client.d.ts +10 -5
- package/dist/src/orchestrator/client.d.ts.map +1 -1
- package/dist/src/orchestrator/client.js +73 -66
- package/dist/src/orchestrator/consts.d.ts +1 -1
- package/dist/src/orchestrator/consts.d.ts.map +1 -1
- package/dist/src/orchestrator/consts.js +2 -8
- package/dist/src/orchestrator/error.js +1 -33
- package/dist/src/orchestrator/index.d.ts +8 -7
- package/dist/src/orchestrator/index.d.ts.map +1 -1
- package/dist/src/orchestrator/index.js +8 -57
- package/dist/src/orchestrator/registry.d.ts +2 -2
- package/dist/src/orchestrator/registry.js +19 -33
- package/dist/src/orchestrator/types.d.ts +5 -1
- package/dist/src/orchestrator/types.d.ts.map +1 -1
- package/dist/src/orchestrator/types.js +1 -17
- package/dist/src/orchestrator/utils.js +1 -3
- package/dist/src/types.d.ts +29 -5
- package/dist/src/types.d.ts.map +1 -1
- package/dist/src/types.js +1 -2
- package/dist/src/utils/index.d.ts +2 -2
- package/dist/src/utils/index.js +9 -15
- package/package.json +29 -98
- package/dist/src/accounts/index.test.d.ts +0 -2
- package/dist/src/accounts/index.test.d.ts.map +0 -1
- package/dist/src/accounts/index.test.js +0 -33
- package/dist/src/accounts/json-rpc/index.test.d.ts +0 -2
- package/dist/src/accounts/json-rpc/index.test.d.ts.map +0 -1
- package/dist/src/accounts/json-rpc/index.test.js +0 -35
- package/dist/src/accounts/json-rpc/providers.test.d.ts +0 -2
- package/dist/src/accounts/json-rpc/providers.test.d.ts.map +0 -1
- package/dist/src/accounts/json-rpc/providers.test.js +0 -43
- package/dist/src/accounts/kernel.test.d.ts +0 -2
- package/dist/src/accounts/kernel.test.d.ts.map +0 -1
- package/dist/src/accounts/kernel.test.js +0 -132
- package/dist/src/accounts/nexus.test.d.ts +0 -2
- package/dist/src/accounts/nexus.test.d.ts.map +0 -1
- package/dist/src/accounts/nexus.test.js +0 -118
- package/dist/src/accounts/safe.test.d.ts +0 -2
- package/dist/src/accounts/safe.test.d.ts.map +0 -1
- package/dist/src/accounts/safe.test.js +0 -168
- package/dist/src/accounts/signing/passkeys.test.d.ts +0 -2
- package/dist/src/accounts/signing/passkeys.test.d.ts.map +0 -1
- package/dist/src/accounts/signing/passkeys.test.js +0 -88
- package/dist/src/accounts/startale.test.d.ts +0 -2
- package/dist/src/accounts/startale.test.d.ts.map +0 -1
- package/dist/src/accounts/startale.test.js +0 -189
- package/dist/src/accounts/utils.test.d.ts +0 -2
- package/dist/src/accounts/utils.test.d.ts.map +0 -1
- package/dist/src/accounts/utils.test.js +0 -49
- package/dist/src/actions/ecdsa.test.d.ts +0 -2
- package/dist/src/actions/ecdsa.test.d.ts.map +0 -1
- package/dist/src/actions/ecdsa.test.js +0 -99
- package/dist/src/actions/passkeys.test.d.ts +0 -2
- package/dist/src/actions/passkeys.test.d.ts.map +0 -1
- package/dist/src/actions/passkeys.test.js +0 -54
- package/dist/src/actions/recovery.test.d.ts +0 -2
- package/dist/src/actions/recovery.test.d.ts.map +0 -1
- package/dist/src/actions/recovery.test.js +0 -168
- package/dist/src/execution/signing.test.d.ts +0 -2
- package/dist/src/execution/signing.test.d.ts.map +0 -1
- package/dist/src/execution/signing.test.js +0 -465
- package/dist/src/execution/utils.test.d.ts +0 -2
- package/dist/src/execution/utils.test.d.ts.map +0 -1
- package/dist/src/execution/utils.test.js +0 -388
- package/dist/src/modules/index.test.d.ts +0 -2
- package/dist/src/modules/index.test.d.ts.map +0 -1
- package/dist/src/modules/index.test.js +0 -81
- package/dist/src/modules/validators/core.test.d.ts +0 -2
- package/dist/src/modules/validators/core.test.d.ts.map +0 -1
- package/dist/src/modules/validators/core.test.js +0 -101
- package/dist/src/modules/validators/policies/claim/permit2.test.d.ts +0 -2
- package/dist/src/modules/validators/policies/claim/permit2.test.d.ts.map +0 -1
- package/dist/src/modules/validators/policies/claim/permit2.test.js +0 -519
- package/dist/src/modules/validators/smart-sessions.test.d.ts +0 -2
- package/dist/src/modules/validators/smart-sessions.test.d.ts.map +0 -1
- package/dist/src/modules/validators/smart-sessions.test.js +0 -311
- package/dist/src/orchestrator/registry.test.d.ts +0 -2
- package/dist/src/orchestrator/registry.test.d.ts.map +0 -1
- package/dist/src/orchestrator/registry.test.js +0 -154
- package/dist/src/utils/index.test.d.ts +0 -2
- package/dist/src/utils/index.test.d.ts.map +0 -1
- package/dist/src/utils/index.test.js +0 -42
- package/dist/test/consts.d.ts +0 -10
- package/dist/test/consts.d.ts.map +0 -1
- package/dist/test/consts.js +0 -22
- package/dist/test/utils/utils.d.ts +0 -5
- package/dist/test/utils/utils.d.ts.map +0 -1
- package/dist/test/utils/utils.js +0 -20
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type SponsorshipFilter } from './sponsorship.js';
|
|
2
|
+
export interface JwtCredentials {
|
|
3
|
+
privateKey: JsonWebKey;
|
|
4
|
+
integratorId: string;
|
|
5
|
+
projectId: string;
|
|
6
|
+
appId: string;
|
|
7
|
+
keyId: string;
|
|
8
|
+
audience?: string;
|
|
9
|
+
}
|
|
10
|
+
export interface JwtSignerConfig {
|
|
11
|
+
jwt: JwtCredentials;
|
|
12
|
+
shouldSponsor?: SponsorshipFilter;
|
|
13
|
+
}
|
|
14
|
+
export declare function createJwtSigner(config: JwtSignerConfig): {
|
|
15
|
+
accessToken: () => Promise<string>;
|
|
16
|
+
getIntentExtensionToken: (intentInput: unknown) => Promise<string>;
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=signer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signer.d.ts","sourceRoot":"","sources":["../../../jwt-server/signer.ts"],"names":[],"mappings":"AAEA,OAAO,EAGL,KAAK,iBAAiB,EACvB,MAAM,eAAe,CAAA;AAEtB,MAAM,WAAW,cAAc;IAC7B,UAAU,EAAE,UAAU,CAAA;IACtB,YAAY,EAAE,MAAM,CAAA;IACpB,SAAS,EAAE,MAAM,CAAA;IACjB,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB;AAED,MAAM,WAAW,eAAe;IAC9B,GAAG,EAAE,cAAc,CAAA;IACnB,aAAa,CAAC,EAAE,iBAAiB,CAAA;CAClC;AAeD,wBAAgB,eAAe,CAAC,MAAM,EAAE,eAAe,GAAG;IACxD,WAAW,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,CAAA;IAClC,uBAAuB,EAAE,CAAC,WAAW,EAAE,OAAO,KAAK,OAAO,CAAC,MAAM,CAAC,CAAA;CACnE,CAoEA"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { importJWK, SignJWT } from 'jose';
|
|
2
|
+
import { computeIntentInputDigest } from './digest.js';
|
|
3
|
+
import { shouldSponsor as checkSponsor, SponsorshipDeniedError, } from './sponsorship.js';
|
|
4
|
+
function pickAlg(jwk) {
|
|
5
|
+
if (jwk.kty === 'EC') {
|
|
6
|
+
if (jwk.crv === 'P-256')
|
|
7
|
+
return 'ES256';
|
|
8
|
+
if (jwk.crv === 'P-384')
|
|
9
|
+
return 'ES384';
|
|
10
|
+
if (jwk.crv === 'P-521')
|
|
11
|
+
return 'ES512';
|
|
12
|
+
throw new Error(`Unsupported EC curve: ${jwk.crv}`);
|
|
13
|
+
}
|
|
14
|
+
if (jwk.kty === 'RSA')
|
|
15
|
+
return 'RS256';
|
|
16
|
+
throw new Error(`Unsupported JWK kty: ${jwk.kty}`);
|
|
17
|
+
}
|
|
18
|
+
export function createJwtSigner(config) {
|
|
19
|
+
const { jwt: { privateKey, integratorId, projectId, appId, keyId, audience = 'rhinestone-api', }, shouldSponsor: filters, } = config;
|
|
20
|
+
const alg = pickAlg(privateKey);
|
|
21
|
+
let cachedKey = null;
|
|
22
|
+
async function getKey() {
|
|
23
|
+
if (!cachedKey) {
|
|
24
|
+
cachedKey = (await importJWK(privateKey, alg));
|
|
25
|
+
}
|
|
26
|
+
return cachedKey;
|
|
27
|
+
}
|
|
28
|
+
async function accessToken() {
|
|
29
|
+
const key = await getKey();
|
|
30
|
+
return new SignJWT({ typ: 'access', app_id: appId })
|
|
31
|
+
.setProtectedHeader({ alg, kid: keyId })
|
|
32
|
+
.setIssuer(integratorId)
|
|
33
|
+
.setSubject(projectId)
|
|
34
|
+
.setAudience(audience)
|
|
35
|
+
.setIssuedAt()
|
|
36
|
+
.setExpirationTime('1h')
|
|
37
|
+
.sign(key);
|
|
38
|
+
}
|
|
39
|
+
async function getIntentExtensionToken(intentInput) {
|
|
40
|
+
if (filters) {
|
|
41
|
+
const allowed = await checkSponsor(intentInput, filters);
|
|
42
|
+
if (!allowed) {
|
|
43
|
+
throw new SponsorshipDeniedError();
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
const key = await getKey();
|
|
47
|
+
const digest = await computeIntentInputDigest(intentInput);
|
|
48
|
+
return new SignJWT({
|
|
49
|
+
typ: 'intent_extension',
|
|
50
|
+
app_id: appId,
|
|
51
|
+
jti: crypto.randomUUID(),
|
|
52
|
+
policy: {
|
|
53
|
+
sponsorship: {
|
|
54
|
+
scope: 'intent',
|
|
55
|
+
intent_input: { digest },
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
})
|
|
59
|
+
.setProtectedHeader({ alg, kid: keyId })
|
|
60
|
+
.setIssuer(integratorId)
|
|
61
|
+
.setSubject(projectId)
|
|
62
|
+
.setAudience(audience)
|
|
63
|
+
.setIssuedAt()
|
|
64
|
+
.setExpirationTime('5m')
|
|
65
|
+
.sign(key);
|
|
66
|
+
}
|
|
67
|
+
return { accessToken, getIntentExtensionToken };
|
|
68
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { Address, Hex } from 'viem';
|
|
2
|
+
export declare class SponsorshipDeniedError extends Error {
|
|
3
|
+
constructor();
|
|
4
|
+
}
|
|
5
|
+
type MaybeAsync<T> = T | Promise<T>;
|
|
6
|
+
export interface SponsorshipFilter {
|
|
7
|
+
chain?: (chain: {
|
|
8
|
+
id: number;
|
|
9
|
+
}) => MaybeAsync<boolean>;
|
|
10
|
+
account?: (address: Address) => MaybeAsync<boolean>;
|
|
11
|
+
calls?: (calls: {
|
|
12
|
+
to: Address;
|
|
13
|
+
value: bigint;
|
|
14
|
+
data: Hex;
|
|
15
|
+
}[]) => MaybeAsync<boolean>;
|
|
16
|
+
}
|
|
17
|
+
export declare function shouldSponsor(intentInput: unknown, filters: SponsorshipFilter): Promise<boolean>;
|
|
18
|
+
export {};
|
|
19
|
+
//# sourceMappingURL=sponsorship.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sponsorship.d.ts","sourceRoot":"","sources":["../../../jwt-server/sponsorship.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,MAAM,CAAA;AAExC,qBAAa,sBAAuB,SAAQ,KAAK;;CAKhD;AAED,KAAK,UAAU,CAAC,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAA;AAEnC,MAAM,WAAW,iBAAiB;IAChC,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE,KAAK,UAAU,CAAC,OAAO,CAAC,CAAA;IACtD,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,UAAU,CAAC,OAAO,CAAC,CAAA;IACnD,KAAK,CAAC,EAAE,CACN,KAAK,EAAE;QAAE,EAAE,EAAE,OAAO,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,GAAG,CAAA;KAAE,EAAE,KAC/C,UAAU,CAAC,OAAO,CAAC,CAAA;CACzB;AAiDD,wBAAsB,aAAa,CACjC,WAAW,EAAE,OAAO,EACpB,OAAO,EAAE,iBAAiB,GACzB,OAAO,CAAC,OAAO,CAAC,CAclB"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
export class SponsorshipDeniedError extends Error {
|
|
2
|
+
constructor() {
|
|
3
|
+
super('Sponsorship denied');
|
|
4
|
+
this.name = 'SponsorshipDeniedError';
|
|
5
|
+
}
|
|
6
|
+
}
|
|
7
|
+
function parseIntentInput(intentInput) {
|
|
8
|
+
if (typeof intentInput !== 'object' || intentInput === null) {
|
|
9
|
+
throw new Error('intentInput must be a non-null object');
|
|
10
|
+
}
|
|
11
|
+
const input = intentInput;
|
|
12
|
+
const chainId = input.destinationChainId;
|
|
13
|
+
if (typeof chainId !== 'number') {
|
|
14
|
+
throw new Error('intentInput.destinationChainId must be a number');
|
|
15
|
+
}
|
|
16
|
+
const account = input.account;
|
|
17
|
+
if (typeof account !== 'object' || account === null) {
|
|
18
|
+
throw new Error('intentInput.account must be a non-null object');
|
|
19
|
+
}
|
|
20
|
+
const address = account.address;
|
|
21
|
+
if (typeof address !== 'string') {
|
|
22
|
+
throw new Error('intentInput.account.address must be a string');
|
|
23
|
+
}
|
|
24
|
+
const executions = input.destinationExecutions;
|
|
25
|
+
if (!Array.isArray(executions)) {
|
|
26
|
+
throw new Error('intentInput.destinationExecutions must be an array');
|
|
27
|
+
}
|
|
28
|
+
const calls = executions.map((exec) => ({
|
|
29
|
+
to: exec.to,
|
|
30
|
+
value: BigInt(exec.value),
|
|
31
|
+
data: exec.data,
|
|
32
|
+
}));
|
|
33
|
+
return {
|
|
34
|
+
chain: { id: chainId },
|
|
35
|
+
account: address,
|
|
36
|
+
calls,
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
export async function shouldSponsor(intentInput, filters) {
|
|
40
|
+
const parsed = parseIntentInput(intentInput);
|
|
41
|
+
if (filters.chain && !(await filters.chain(parsed.chain))) {
|
|
42
|
+
return false;
|
|
43
|
+
}
|
|
44
|
+
if (filters.account && !(await filters.account(parsed.account))) {
|
|
45
|
+
return false;
|
|
46
|
+
}
|
|
47
|
+
if (filters.calls && !(await filters.calls(parsed.calls))) {
|
|
48
|
+
return false;
|
|
49
|
+
}
|
|
50
|
+
return true;
|
|
51
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { type JwtHandlerConfig } from './handlers.js';
|
|
2
|
+
export declare function createAccessTokenHandler(config: JwtHandlerConfig): (req: Request) => Promise<Response>;
|
|
3
|
+
export declare function createExtensionTokenHandler(config: JwtHandlerConfig): (req: Request) => Promise<Response>;
|
|
4
|
+
//# sourceMappingURL=web.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"web.d.ts","sourceRoot":"","sources":["../../../jwt-server/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,gBAAgB,EACtB,MAAM,YAAY,CAAA;AAEnB,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,gBAAgB,GACvB,CAAC,GAAG,EAAE,OAAO,KAAK,OAAO,CAAC,QAAQ,CAAC,CAOrC;AAED,wBAAgB,2BAA2B,CACzC,MAAM,EAAE,gBAAgB,GACvB,CAAC,GAAG,EAAE,OAAO,KAAK,OAAO,CAAC,QAAQ,CAAC,CAerC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { createCoreAccessTokenHandler, createCoreExtensionTokenHandler, } from './handlers.js';
|
|
2
|
+
export function createAccessTokenHandler(config) {
|
|
3
|
+
const handle = createCoreAccessTokenHandler(config);
|
|
4
|
+
return async () => {
|
|
5
|
+
const result = await handle();
|
|
6
|
+
return Response.json(result.body, { status: result.status });
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
export function createExtensionTokenHandler(config) {
|
|
10
|
+
const handle = createCoreExtensionTokenHandler(config);
|
|
11
|
+
return async (req) => {
|
|
12
|
+
let intentInput;
|
|
13
|
+
try {
|
|
14
|
+
const body = await req.json();
|
|
15
|
+
intentInput = body.intentInput;
|
|
16
|
+
}
|
|
17
|
+
catch {
|
|
18
|
+
return Response.json({ error: 'Invalid JSON body' }, { status: 400 });
|
|
19
|
+
}
|
|
20
|
+
const result = await handle(intentInput);
|
|
21
|
+
return Response.json(result.body, { status: result.status });
|
|
22
|
+
};
|
|
23
|
+
}
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
1
|
const abi = [
|
|
4
2
|
{
|
|
5
3
|
type: 'constructor',
|
|
@@ -562,4 +560,4 @@ const abi = [
|
|
|
562
560
|
inputs: [{ name: 'policy', type: 'address', internalType: 'address' }],
|
|
563
561
|
},
|
|
564
562
|
];
|
|
565
|
-
|
|
563
|
+
export default abi;
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.enableSessionsAbi = void 0;
|
|
4
1
|
const enableSessionsAbi = [
|
|
5
2
|
{
|
|
6
3
|
type: 'function',
|
|
@@ -128,4 +125,4 @@ const enableSessionsAbi = [
|
|
|
128
125
|
stateMutability: 'nonpayable',
|
|
129
126
|
},
|
|
130
127
|
];
|
|
131
|
-
|
|
128
|
+
export { enableSessionsAbi };
|
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.INTENT_EXECUTOR_ADDRESS_DEV = exports.INTENT_EXECUTOR_ADDRESS = void 0;
|
|
4
1
|
const INTENT_EXECUTOR_ADDRESS = '0x00000000005aD9ce1f5035FD62CA96CEf16AdAAF';
|
|
5
|
-
exports.INTENT_EXECUTOR_ADDRESS = INTENT_EXECUTOR_ADDRESS;
|
|
6
2
|
const INTENT_EXECUTOR_ADDRESS_DEV = '0xbf9b5b917a83f8adac17b0752846d41d8d7b7e17';
|
|
7
|
-
|
|
3
|
+
export { INTENT_EXECUTOR_ADDRESS, INTENT_EXECUTOR_ADDRESS_DEV };
|
|
@@ -1,24 +1,11 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MODULE_TYPE_HOOK = exports.MODULE_TYPE_FALLBACK = exports.MODULE_TYPE_EXECUTOR = exports.MODULE_TYPE_VALIDATOR = exports.MODULE_TYPE_ID_HOOK = exports.MODULE_TYPE_ID_FALLBACK = exports.MODULE_TYPE_ID_EXECUTOR = exports.MODULE_TYPE_ID_VALIDATOR = void 0;
|
|
4
|
-
exports.toModuleTypeId = toModuleTypeId;
|
|
5
|
-
exports.getModule = getModule;
|
|
6
1
|
const MODULE_TYPE_ID_VALIDATOR = 1n;
|
|
7
|
-
exports.MODULE_TYPE_ID_VALIDATOR = MODULE_TYPE_ID_VALIDATOR;
|
|
8
2
|
const MODULE_TYPE_ID_EXECUTOR = 2n;
|
|
9
|
-
exports.MODULE_TYPE_ID_EXECUTOR = MODULE_TYPE_ID_EXECUTOR;
|
|
10
3
|
const MODULE_TYPE_ID_FALLBACK = 3n;
|
|
11
|
-
exports.MODULE_TYPE_ID_FALLBACK = MODULE_TYPE_ID_FALLBACK;
|
|
12
4
|
const MODULE_TYPE_ID_HOOK = 4n;
|
|
13
|
-
exports.MODULE_TYPE_ID_HOOK = MODULE_TYPE_ID_HOOK;
|
|
14
5
|
const MODULE_TYPE_VALIDATOR = 'validator';
|
|
15
|
-
exports.MODULE_TYPE_VALIDATOR = MODULE_TYPE_VALIDATOR;
|
|
16
6
|
const MODULE_TYPE_EXECUTOR = 'executor';
|
|
17
|
-
exports.MODULE_TYPE_EXECUTOR = MODULE_TYPE_EXECUTOR;
|
|
18
7
|
const MODULE_TYPE_FALLBACK = 'fallback';
|
|
19
|
-
exports.MODULE_TYPE_FALLBACK = MODULE_TYPE_FALLBACK;
|
|
20
8
|
const MODULE_TYPE_HOOK = 'hook';
|
|
21
|
-
exports.MODULE_TYPE_HOOK = MODULE_TYPE_HOOK;
|
|
22
9
|
function toModuleTypeId(type) {
|
|
23
10
|
switch (type) {
|
|
24
11
|
case MODULE_TYPE_VALIDATOR:
|
|
@@ -40,3 +27,4 @@ function getModule(module) {
|
|
|
40
27
|
additionalContext: module.additionalContext ?? '0x',
|
|
41
28
|
};
|
|
42
29
|
}
|
|
30
|
+
export { MODULE_TYPE_ID_VALIDATOR, MODULE_TYPE_ID_EXECUTOR, MODULE_TYPE_ID_FALLBACK, MODULE_TYPE_ID_HOOK, MODULE_TYPE_VALIDATOR, MODULE_TYPE_EXECUTOR, MODULE_TYPE_FALLBACK, MODULE_TYPE_HOOK, toModuleTypeId, getModule, };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { type Chain } from 'viem';
|
|
2
|
-
import type { RhinestoneConfig } from '../types';
|
|
3
|
-
import { type ModeleSetup, type Module } from './common';
|
|
4
|
-
import { getExecutors, getOwners, getValidators } from './read';
|
|
5
|
-
import { getOwnerValidator, MULTI_FACTOR_VALIDATOR_ADDRESS, OWNABLE_VALIDATOR_ADDRESS, SMART_SESSION_EMISSARY_ADDRESS, WEBAUTHN_VALIDATOR_ADDRESS } from './validators';
|
|
6
|
-
import { getSessionDetails, signEnableSession } from './validators/smart-sessions';
|
|
2
|
+
import type { RhinestoneConfig } from '../types.js';
|
|
3
|
+
import { type ModeleSetup, type Module } from './common.js';
|
|
4
|
+
import { getExecutors, getOwners, getValidators } from './read.js';
|
|
5
|
+
import { getOwnerValidator, MULTI_FACTOR_VALIDATOR_ADDRESS, OWNABLE_VALIDATOR_ADDRESS, SMART_SESSION_EMISSARY_ADDRESS, WEBAUTHN_VALIDATOR_ADDRESS } from './validators/index.js';
|
|
6
|
+
import { getSessionDetails, signEnableSession } from './validators/smart-sessions.js';
|
|
7
7
|
declare function getSetup(config: RhinestoneConfig): ModeleSetup;
|
|
8
8
|
declare function getIntentExecutor(config: RhinestoneConfig): Module;
|
|
9
9
|
declare function isRip7212SupportedNetwork(chain: Chain): boolean;
|
|
@@ -1,37 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const chain_abstraction_1 = require("./chain-abstraction");
|
|
10
|
-
const common_1 = require("./common");
|
|
11
|
-
const read_1 = require("./read");
|
|
12
|
-
Object.defineProperty(exports, "getExecutors", { enumerable: true, get: function () { return read_1.getExecutors; } });
|
|
13
|
-
Object.defineProperty(exports, "getOwners", { enumerable: true, get: function () { return read_1.getOwners; } });
|
|
14
|
-
Object.defineProperty(exports, "getValidators", { enumerable: true, get: function () { return read_1.getValidators; } });
|
|
15
|
-
const validators_1 = require("./validators");
|
|
16
|
-
Object.defineProperty(exports, "getOwnerValidator", { enumerable: true, get: function () { return validators_1.getOwnerValidator; } });
|
|
17
|
-
Object.defineProperty(exports, "MULTI_FACTOR_VALIDATOR_ADDRESS", { enumerable: true, get: function () { return validators_1.MULTI_FACTOR_VALIDATOR_ADDRESS; } });
|
|
18
|
-
Object.defineProperty(exports, "OWNABLE_VALIDATOR_ADDRESS", { enumerable: true, get: function () { return validators_1.OWNABLE_VALIDATOR_ADDRESS; } });
|
|
19
|
-
Object.defineProperty(exports, "SMART_SESSION_EMISSARY_ADDRESS", { enumerable: true, get: function () { return validators_1.SMART_SESSION_EMISSARY_ADDRESS; } });
|
|
20
|
-
Object.defineProperty(exports, "WEBAUTHN_VALIDATOR_ADDRESS", { enumerable: true, get: function () { return validators_1.WEBAUTHN_VALIDATOR_ADDRESS; } });
|
|
21
|
-
const core_1 = require("./validators/core");
|
|
22
|
-
const smart_sessions_1 = require("./validators/smart-sessions");
|
|
23
|
-
Object.defineProperty(exports, "getSessionDetails", { enumerable: true, get: function () { return smart_sessions_1.getSessionDetails; } });
|
|
24
|
-
Object.defineProperty(exports, "signEnableSession", { enumerable: true, get: function () { return smart_sessions_1.signEnableSession; } });
|
|
1
|
+
import { encodeAbiParameters } from 'viem';
|
|
2
|
+
import { arbitrum, arbitrumSepolia, base, baseSepolia, mainnet, optimism, optimismSepolia, polygon, sepolia, soneium, } from 'viem/chains';
|
|
3
|
+
import { INTENT_EXECUTOR_ADDRESS, INTENT_EXECUTOR_ADDRESS_DEV, } from './chain-abstraction.js';
|
|
4
|
+
import { getModule, MODULE_TYPE_EXECUTOR, MODULE_TYPE_FALLBACK, MODULE_TYPE_HOOK, MODULE_TYPE_ID_EXECUTOR, MODULE_TYPE_ID_FALLBACK, MODULE_TYPE_VALIDATOR, } from './common.js';
|
|
5
|
+
import { getExecutors, getOwners, getValidators } from './read.js';
|
|
6
|
+
import { getOwnerValidator, getSmartSessionValidator, MULTI_FACTOR_VALIDATOR_ADDRESS, OWNABLE_VALIDATOR_ADDRESS, SMART_SESSION_EMISSARY_ADDRESS, WEBAUTHN_VALIDATOR_ADDRESS, } from './validators/index.js';
|
|
7
|
+
import { getSocialRecoveryValidator } from './validators/core.js';
|
|
8
|
+
import { getSessionDetails, signEnableSession, } from './validators/smart-sessions.js';
|
|
25
9
|
const SMART_SESSION_COMPATIBILITY_FALLBACK_ADDRESS = '0x000000000052e9685932845660777DF43C2dC496';
|
|
26
10
|
function getSetup(config) {
|
|
27
|
-
const ownerValidator =
|
|
28
|
-
const smartSessionValidator =
|
|
11
|
+
const ownerValidator = getOwnerValidator(config);
|
|
12
|
+
const smartSessionValidator = getSmartSessionValidator(config);
|
|
29
13
|
const validators = [ownerValidator];
|
|
30
14
|
if (smartSessionValidator) {
|
|
31
15
|
validators.push(smartSessionValidator);
|
|
32
16
|
}
|
|
33
17
|
if (config.recovery) {
|
|
34
|
-
const socialRecoveryValidator =
|
|
18
|
+
const socialRecoveryValidator = getSocialRecoveryValidator(config.recovery.guardians, config.recovery.threshold);
|
|
35
19
|
validators.push(socialRecoveryValidator);
|
|
36
20
|
}
|
|
37
21
|
const intentExecutor = getIntentExecutor(config);
|
|
@@ -43,31 +27,31 @@ function getSetup(config) {
|
|
|
43
27
|
if (enabled && config.account && config.account.type === 'safe') {
|
|
44
28
|
fallbacks.push({
|
|
45
29
|
address: compatibilityFallback ?? SMART_SESSION_COMPATIBILITY_FALLBACK_ADDRESS,
|
|
46
|
-
initData:
|
|
30
|
+
initData: encodeAbiParameters([
|
|
47
31
|
{ name: 'selector', type: 'bytes4' },
|
|
48
32
|
{ name: 'flags', type: 'bytes1' },
|
|
49
33
|
{ name: 'data', type: 'bytes' },
|
|
50
34
|
], ['0x84b0196e', '0xfe', '0x']),
|
|
51
35
|
deInitData: '0x',
|
|
52
36
|
additionalContext: '0x',
|
|
53
|
-
type:
|
|
37
|
+
type: MODULE_TYPE_ID_FALLBACK,
|
|
54
38
|
});
|
|
55
39
|
}
|
|
56
40
|
}
|
|
57
41
|
const hooks = [];
|
|
58
42
|
if (config.modules) {
|
|
59
43
|
validators.push(...config.modules
|
|
60
|
-
.filter((m) => m.type ===
|
|
61
|
-
.map((m) =>
|
|
44
|
+
.filter((m) => m.type === MODULE_TYPE_VALIDATOR)
|
|
45
|
+
.map((m) => getModule(m)));
|
|
62
46
|
executors.push(...config.modules
|
|
63
|
-
.filter((m) => m.type ===
|
|
64
|
-
.map((m) =>
|
|
47
|
+
.filter((m) => m.type === MODULE_TYPE_EXECUTOR)
|
|
48
|
+
.map((m) => getModule(m)));
|
|
65
49
|
fallbacks.push(...config.modules
|
|
66
|
-
.filter((m) => m.type ===
|
|
67
|
-
.map((m) =>
|
|
50
|
+
.filter((m) => m.type === MODULE_TYPE_FALLBACK)
|
|
51
|
+
.map((m) => getModule(m)));
|
|
68
52
|
hooks.push(...config.modules
|
|
69
|
-
.filter((m) => m.type ===
|
|
70
|
-
.map((m) =>
|
|
53
|
+
.filter((m) => m.type === MODULE_TYPE_HOOK)
|
|
54
|
+
.map((m) => getModule(m)));
|
|
71
55
|
}
|
|
72
56
|
return {
|
|
73
57
|
validators,
|
|
@@ -78,28 +62,29 @@ function getSetup(config) {
|
|
|
78
62
|
}
|
|
79
63
|
function getIntentExecutor(config) {
|
|
80
64
|
const intentExecutorAddress = config.useDevContracts === true
|
|
81
|
-
?
|
|
82
|
-
:
|
|
65
|
+
? INTENT_EXECUTOR_ADDRESS_DEV
|
|
66
|
+
: INTENT_EXECUTOR_ADDRESS;
|
|
83
67
|
return {
|
|
84
68
|
address: intentExecutorAddress,
|
|
85
69
|
initData: '0x',
|
|
86
70
|
deInitData: '0x',
|
|
87
71
|
additionalContext: '0x',
|
|
88
|
-
type:
|
|
72
|
+
type: MODULE_TYPE_ID_EXECUTOR,
|
|
89
73
|
};
|
|
90
74
|
}
|
|
91
75
|
function isRip7212SupportedNetwork(chain) {
|
|
92
76
|
const supportedChains = [
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
77
|
+
mainnet,
|
|
78
|
+
sepolia,
|
|
79
|
+
optimism,
|
|
80
|
+
optimismSepolia,
|
|
81
|
+
polygon,
|
|
82
|
+
base,
|
|
83
|
+
baseSepolia,
|
|
84
|
+
arbitrum,
|
|
85
|
+
arbitrumSepolia,
|
|
86
|
+
soneium,
|
|
103
87
|
];
|
|
104
88
|
return supportedChains.includes(chain);
|
|
105
89
|
}
|
|
90
|
+
export { OWNABLE_VALIDATOR_ADDRESS, WEBAUTHN_VALIDATOR_ADDRESS, MULTI_FACTOR_VALIDATOR_ADDRESS, SMART_SESSION_EMISSARY_ADDRESS, getSetup, getOwnerValidator, getOwners, getExecutors, getIntentExecutor, getValidators, isRip7212SupportedNetwork, getSessionDetails, signEnableSession, };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type Address } from 'viem';
|
|
2
|
-
import type { RhinestoneAccountConfig } from '../types';
|
|
3
|
-
import { type ModeleSetup } from './common';
|
|
2
|
+
import type { RhinestoneAccountConfig } from '../types.js';
|
|
3
|
+
import { type ModeleSetup } from './common.js';
|
|
4
4
|
declare function getV0Attesters(): {
|
|
5
5
|
addresses: Address[];
|
|
6
6
|
threshold: number;
|
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
exports.getV0Setup = getV0Setup;
|
|
5
|
-
const viem_1 = require("viem");
|
|
6
|
-
const _1 = require(".");
|
|
7
|
-
const common_1 = require("./common");
|
|
1
|
+
import { encodeAbiParameters } from 'viem';
|
|
2
|
+
import { getSetup } from './index.js';
|
|
3
|
+
import { getModule, MODULE_TYPE_ID_EXECUTOR, MODULE_TYPE_ID_FALLBACK, MODULE_TYPE_ID_HOOK, MODULE_TYPE_ID_VALIDATOR, } from './common.js';
|
|
8
4
|
const OMNI_ACCOUNT_MOCK_ATTESTER_ADDRESS = '0x6D0515e8E499468DCe9583626f0cA15b887f9d03';
|
|
9
5
|
const RHINESTONE_ATTESTER_ADDRESS = '0x000000333034E9f539ce08819E12c1b8Cb29084d';
|
|
10
6
|
const HOOK_ADDRESS = '0x0000000000f6Ed8Be424d673c63eeFF8b9267420';
|
|
@@ -20,7 +16,7 @@ function getV0Attesters() {
|
|
|
20
16
|
};
|
|
21
17
|
}
|
|
22
18
|
function getV0Setup(config) {
|
|
23
|
-
const defaultSetup =
|
|
19
|
+
const defaultSetup = getSetup(config);
|
|
24
20
|
// Define v0 modules
|
|
25
21
|
const v0ModuleInputs = [
|
|
26
22
|
// Same Chain Module
|
|
@@ -42,7 +38,7 @@ function getV0Setup(config) {
|
|
|
42
38
|
{
|
|
43
39
|
type: 'fallback',
|
|
44
40
|
address: TARGET_MODULE_ADDRESS,
|
|
45
|
-
initData:
|
|
41
|
+
initData: encodeAbiParameters([
|
|
46
42
|
{ name: 'selector', type: 'bytes4' },
|
|
47
43
|
{ name: 'flags', type: 'bytes1' },
|
|
48
44
|
{ name: 'data', type: 'bytes' },
|
|
@@ -50,11 +46,11 @@ function getV0Setup(config) {
|
|
|
50
46
|
},
|
|
51
47
|
];
|
|
52
48
|
// Convert and categorize v0 modules once
|
|
53
|
-
const v0Modules = v0ModuleInputs.map((m) =>
|
|
54
|
-
const v0Validators = v0Modules.filter((m) => m.type ===
|
|
55
|
-
const v0Executors = v0Modules.filter((m) => m.type ===
|
|
56
|
-
const v0Fallbacks = v0Modules.filter((m) => m.type ===
|
|
57
|
-
const v0Hooks = v0Modules.filter((m) => m.type ===
|
|
49
|
+
const v0Modules = v0ModuleInputs.map((m) => getModule(m));
|
|
50
|
+
const v0Validators = v0Modules.filter((m) => m.type === MODULE_TYPE_ID_VALIDATOR);
|
|
51
|
+
const v0Executors = v0Modules.filter((m) => m.type === MODULE_TYPE_ID_EXECUTOR);
|
|
52
|
+
const v0Fallbacks = v0Modules.filter((m) => m.type === MODULE_TYPE_ID_FALLBACK);
|
|
53
|
+
const v0Hooks = v0Modules.filter((m) => m.type === MODULE_TYPE_ID_HOOK);
|
|
58
54
|
// Merge directly with default setup
|
|
59
55
|
return {
|
|
60
56
|
validators: [...v0Validators, ...defaultSetup.validators],
|
|
@@ -63,3 +59,4 @@ function getV0Setup(config) {
|
|
|
63
59
|
hooks: [...v0Hooks, ...defaultSetup.hooks],
|
|
64
60
|
};
|
|
65
61
|
}
|
|
62
|
+
export { getV0Attesters, getV0Setup };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type Address, type Chain } from 'viem';
|
|
2
|
-
import type { AccountType, ProviderConfig } from '../types';
|
|
2
|
+
import type { AccountType, ProviderConfig } from '../types.js';
|
|
3
3
|
declare function getValidators(accountType: AccountType, account: Address, chain: Chain, provider?: ProviderConfig): Promise<Address[]>;
|
|
4
4
|
declare function getOwners(account: Address, chain: Chain, provider?: ProviderConfig): Promise<{
|
|
5
5
|
accounts: Address[];
|
package/dist/src/modules/read.js
CHANGED
|
@@ -1,15 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
exports.getExecutors = getExecutors;
|
|
5
|
-
exports.getOwners = getOwners;
|
|
6
|
-
const viem_1 = require("viem");
|
|
7
|
-
const utils_1 = require("../accounts/utils");
|
|
8
|
-
const core_1 = require("./validators/core");
|
|
1
|
+
import { createPublicClient } from 'viem';
|
|
2
|
+
import { createTransport } from '../accounts/utils.js';
|
|
3
|
+
import { OWNABLE_VALIDATOR_ADDRESS } from './validators/core.js';
|
|
9
4
|
async function getValidators(accountType, account, chain, provider) {
|
|
10
|
-
const publicClient =
|
|
5
|
+
const publicClient = createPublicClient({
|
|
11
6
|
chain,
|
|
12
|
-
transport:
|
|
7
|
+
transport: createTransport(chain, provider),
|
|
13
8
|
});
|
|
14
9
|
switch (accountType) {
|
|
15
10
|
case 'safe':
|
|
@@ -58,11 +53,11 @@ async function getValidators(accountType, account, chain, provider) {
|
|
|
58
53
|
}
|
|
59
54
|
}
|
|
60
55
|
async function getOwners(account, chain, provider) {
|
|
61
|
-
const publicClient =
|
|
56
|
+
const publicClient = createPublicClient({
|
|
62
57
|
chain,
|
|
63
|
-
transport:
|
|
58
|
+
transport: createTransport(chain, provider),
|
|
64
59
|
});
|
|
65
|
-
const moduleAddress =
|
|
60
|
+
const moduleAddress = OWNABLE_VALIDATOR_ADDRESS;
|
|
66
61
|
const [ownerResult, thresholdResult] = await publicClient.multicall({
|
|
67
62
|
contracts: [
|
|
68
63
|
{
|
|
@@ -125,9 +120,9 @@ async function getOwners(account, chain, provider) {
|
|
|
125
120
|
};
|
|
126
121
|
}
|
|
127
122
|
async function getExecutors(accountType, account, chain, provider) {
|
|
128
|
-
const publicClient =
|
|
123
|
+
const publicClient = createPublicClient({
|
|
129
124
|
chain,
|
|
130
|
-
transport:
|
|
125
|
+
transport: createTransport(chain, provider),
|
|
131
126
|
});
|
|
132
127
|
switch (accountType) {
|
|
133
128
|
case 'safe':
|
|
@@ -175,3 +170,4 @@ async function getExecutors(accountType, account, chain, provider) {
|
|
|
175
170
|
}
|
|
176
171
|
}
|
|
177
172
|
}
|
|
173
|
+
export { getValidators, getExecutors, getOwners };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type Account, type Address, type Hex } from 'viem';
|
|
2
|
-
import type { ENSValidatorConfig, OwnableValidatorConfig, OwnerSet, RhinestoneAccountConfig, WebauthnValidatorConfig } from '../../types';
|
|
3
|
-
import { type Module } from '../common';
|
|
2
|
+
import type { ENSValidatorConfig, OwnableValidatorConfig, OwnerSet, RhinestoneAccountConfig, WebauthnValidatorConfig } from '../../types.js';
|
|
3
|
+
import { type Module } from '../common.js';
|
|
4
4
|
declare const SMART_SESSION_EMISSARY_ADDRESS_DEV: Address;
|
|
5
5
|
declare const SMART_SESSION_EMISSARY_ADDRESS: Address;
|
|
6
6
|
interface PublicKey {
|