@rhinestone/sdk 1.0.0-alpha.25 → 1.0.0-alpha.27

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.
Files changed (68) hide show
  1. package/dist/src/accounts/error.d.ts +12 -5
  2. package/dist/src/accounts/error.d.ts.map +1 -1
  3. package/dist/src/accounts/error.js +19 -10
  4. package/dist/src/accounts/index.d.ts +11 -4
  5. package/dist/src/accounts/index.d.ts.map +1 -1
  6. package/dist/src/accounts/index.js +119 -40
  7. package/dist/src/accounts/index.test.js +2 -2
  8. package/dist/src/accounts/kernel.d.ts +1 -1
  9. package/dist/src/accounts/kernel.d.ts.map +1 -1
  10. package/dist/src/accounts/kernel.js +29 -1
  11. package/dist/src/accounts/kernel.test.js +37 -4
  12. package/dist/src/accounts/nexus.d.ts +4 -3
  13. package/dist/src/accounts/nexus.d.ts.map +1 -1
  14. package/dist/src/accounts/nexus.js +82 -14
  15. package/dist/src/accounts/nexus.test.js +35 -2
  16. package/dist/src/accounts/safe.d.ts.map +1 -1
  17. package/dist/src/accounts/safe.js +79 -55
  18. package/dist/src/accounts/safe.test.js +35 -2
  19. package/dist/src/accounts/signing/common.d.ts +1 -1
  20. package/dist/src/accounts/signing/common.d.ts.map +1 -1
  21. package/dist/src/accounts/signing/common.js +14 -13
  22. package/dist/src/accounts/signing/message.js +3 -3
  23. package/dist/src/accounts/signing/passkeys.d.ts +8 -1
  24. package/dist/src/accounts/signing/passkeys.d.ts.map +1 -1
  25. package/dist/src/accounts/signing/passkeys.js +35 -0
  26. package/dist/src/accounts/signing/passkeys.test.js +15 -0
  27. package/dist/src/accounts/walletClient.d.ts.map +1 -1
  28. package/dist/src/accounts/walletClient.js +2 -1
  29. package/dist/src/actions/index.d.ts +30 -2
  30. package/dist/src/actions/index.d.ts.map +1 -1
  31. package/dist/src/actions/index.js +37 -6
  32. package/dist/src/actions/index.test.js +11 -11
  33. package/dist/src/execution/error.d.ts +8 -1
  34. package/dist/src/execution/error.d.ts.map +1 -1
  35. package/dist/src/execution/error.js +10 -1
  36. package/dist/src/execution/index.d.ts +12 -3
  37. package/dist/src/execution/index.d.ts.map +1 -1
  38. package/dist/src/execution/index.js +25 -17
  39. package/dist/src/execution/utils.d.ts +1 -1
  40. package/dist/src/execution/utils.d.ts.map +1 -1
  41. package/dist/src/execution/utils.js +24 -6
  42. package/dist/src/index.d.ts +6 -5
  43. package/dist/src/index.d.ts.map +1 -1
  44. package/dist/src/index.js +19 -3
  45. package/dist/src/modules/common.d.ts +10 -4
  46. package/dist/src/modules/common.d.ts.map +1 -1
  47. package/dist/src/modules/common.js +22 -1
  48. package/dist/src/modules/index.d.ts +2 -1
  49. package/dist/src/modules/index.d.ts.map +1 -1
  50. package/dist/src/modules/index.js +16 -13
  51. package/dist/src/modules/index.test.js +8 -7
  52. package/dist/src/modules/validators/core.d.ts +4 -3
  53. package/dist/src/modules/validators/core.d.ts.map +1 -1
  54. package/dist/src/modules/validators/core.js +24 -14
  55. package/dist/src/modules/validators/core.test.js +4 -4
  56. package/dist/src/orchestrator/client.js +6 -6
  57. package/dist/src/orchestrator/registry.d.ts.map +1 -1
  58. package/dist/src/orchestrator/registry.js +11 -10
  59. package/dist/src/orchestrator/registry.test.js +4 -4
  60. package/dist/src/types.d.ts +30 -20
  61. package/dist/src/types.d.ts.map +1 -1
  62. package/package.json +1 -1
  63. package/dist/src/accounts/custom.d.ts +0 -18
  64. package/dist/src/accounts/custom.d.ts.map +0 -1
  65. package/dist/src/accounts/custom.js +0 -121
  66. package/dist/src/accounts/custom.test.d.ts +0 -2
  67. package/dist/src/accounts/custom.test.d.ts.map +0 -1
  68. package/dist/src/accounts/custom.test.js +0 -64
@@ -16,13 +16,7 @@ function convertOwnerSetToSignerSet(owners) {
16
16
  type: 'owner',
17
17
  kind: 'ecdsa',
18
18
  accounts: owners.accounts,
19
- };
20
- }
21
- case 'ecdsa-v0': {
22
- return {
23
- type: 'owner',
24
- kind: 'ecdsa-v0',
25
- accounts: owners.accounts,
19
+ module: owners.module,
26
20
  };
27
21
  }
28
22
  case 'passkey': {
@@ -30,6 +24,7 @@ function convertOwnerSetToSignerSet(owners) {
30
24
  type: 'owner',
31
25
  kind: 'passkey',
32
26
  accounts: owners.accounts,
27
+ module: owners.module,
33
28
  };
34
29
  }
35
30
  case 'multi-factor': {
@@ -38,12 +33,12 @@ function convertOwnerSetToSignerSet(owners) {
38
33
  kind: 'multi-factor',
39
34
  validators: owners.validators.map((validator, index) => {
40
35
  switch (validator.type) {
41
- case 'ecdsa':
42
- case 'ecdsa-v0': {
36
+ case 'ecdsa': {
43
37
  return {
44
38
  type: validator.type,
45
39
  id: index,
46
40
  accounts: validator.accounts,
41
+ module: validator.module,
47
42
  };
48
43
  }
49
44
  case 'passkey': {
@@ -51,6 +46,7 @@ function convertOwnerSetToSignerSet(owners) {
51
46
  type: 'passkey',
52
47
  id: index,
53
48
  accounts: validator.accounts,
49
+ module: validator.module,
54
50
  };
55
51
  }
56
52
  }
@@ -101,14 +97,16 @@ async function signWithSession(signers, chain, address, params, signMain) {
101
97
  return signMain(sessionSigners, chain, address, params);
102
98
  }
103
99
  async function signWithGuardians(signers, params, signingFunctions) {
104
- const signatures = await Promise.all(signers.guardians.map((account) => signingFunctions.signEcdsa(account, params)));
100
+ const signatures = await Promise.all(signers.guardians.map((account) => signingFunctions.signEcdsa(account, params, false)));
105
101
  return (0, viem_1.concat)(signatures);
106
102
  }
107
103
  async function signWithOwners(signers, chain, address, params, signingFunctions, signMain) {
108
104
  switch (signers.kind) {
109
- case 'ecdsa':
110
- case 'ecdsa-v0': {
111
- const signatures = await Promise.all(signers.accounts.map((account) => signingFunctions.signEcdsa(account, params)));
105
+ case 'ecdsa': {
106
+ // Ownable validator uses `v` value to determine which validation mode to use
107
+ const updateV = !signers.module ||
108
+ signers.module?.toLowerCase() === core_1.OWNABLE_VALIDATOR_ADDRESS;
109
+ const signatures = await Promise.all(signers.accounts.map((account) => signingFunctions.signEcdsa(account, params, updateV)));
112
110
  return (0, viem_1.concat)(signatures);
113
111
  }
114
112
  case 'passkey': {
@@ -130,6 +128,9 @@ async function signWithOwners(signers, chain, address, params, signingFunctions,
130
128
  s,
131
129
  };
132
130
  });
131
+ if (signers.module?.toLowerCase() === core_1.WEBAUTHN_V0_VALIDATOR_ADDRESS) {
132
+ return (0, passkeys_1.packSignatureV0)(webAuthns[0], usePrecompile);
133
+ }
133
134
  return (0, passkeys_1.packSignature)(credIds, usePrecompile, webAuthns);
134
135
  }
135
136
  case 'multi-factor': {
@@ -6,7 +6,7 @@ const error_1 = require("../error");
6
6
  const common_1 = require("./common");
7
7
  async function sign(signers, chain, address, hash) {
8
8
  const signingFunctions = {
9
- signEcdsa: (account, hash) => signEcdsa(account, hash),
9
+ signEcdsa: (account, hash, updateV) => signEcdsa(account, hash, updateV),
10
10
  signPasskey: (account, hash) => signPasskey(account, hash),
11
11
  };
12
12
  switch (signers.type) {
@@ -21,7 +21,7 @@ async function sign(signers, chain, address, hash) {
21
21
  }
22
22
  }
23
23
  }
24
- async function signEcdsa(account, hash) {
24
+ async function signEcdsa(account, hash, updateV) {
25
25
  if (!account.signMessage) {
26
26
  throw new error_1.SigningNotSupportedForAccountError();
27
27
  }
@@ -34,7 +34,7 @@ async function signEcdsa(account, hash) {
34
34
  if (!v) {
35
35
  throw new Error('Invalid signature');
36
36
  }
37
- const newV = v + 4n;
37
+ const newV = updateV ? v + 4n : v;
38
38
  const newSignature = (0, viem_1.concat)([r, s, (0, viem_1.toHex)(newV)]);
39
39
  return newSignature;
40
40
  }
@@ -24,6 +24,13 @@ declare function packSignature(credIds: Hex[], usePrecompile: boolean, webAuthns
24
24
  r: bigint;
25
25
  s: bigint;
26
26
  }[]): Hex;
27
- export { parsePublicKey, parseSignature, generateCredentialId, packSignature };
27
+ declare function packSignatureV0(webauthn: {
28
+ authenticatorData: Hex;
29
+ clientDataJSON: string;
30
+ typeIndex: number | bigint;
31
+ r: bigint;
32
+ s: bigint;
33
+ }, usePrecompiled: boolean): `0x${string}`;
34
+ export { parsePublicKey, parseSignature, generateCredentialId, packSignature, packSignatureV0, };
28
35
  export type { WebAuthnSignature };
29
36
  //# sourceMappingURL=passkeys.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"passkeys.d.ts","sourceRoot":"","sources":["../../../../accounts/signing/passkeys.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,OAAO,EAGZ,KAAK,GAAG,EAGT,MAAM,MAAM,CAAA;AAEb,UAAU,iBAAiB;IACzB,iBAAiB,EAAE,GAAG,CAAA;IACtB,cAAc,EAAE,MAAM,CAAA;IACtB,cAAc,EAAE,MAAM,CAAA;IACtB,SAAS,EAAE,MAAM,CAAA;IACjB,CAAC,EAAE,MAAM,CAAA;IACT,CAAC,EAAE,MAAM,CAAA;CACV;AAED,iBAAS,cAAc,CAAC,SAAS,EAAE,GAAG,GAAG,UAAU,GAAG;IACpD,CAAC,EAAE,MAAM,CAAA;IACT,CAAC,EAAE,MAAM,CAAA;CACV,CAUA;AAED,iBAAS,cAAc,CAAC,SAAS,EAAE,GAAG,GAAG,UAAU,GAAG;IACpD,CAAC,EAAE,MAAM,CAAA;IACT,CAAC,EAAE,MAAM,CAAA;CACV,CASA;AAED,iBAAS,oBAAoB,CAC3B,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,OAAO,iBAkBjB;AAED,iBAAS,aAAa,CACpB,OAAO,EAAE,GAAG,EAAE,EACd,aAAa,EAAE,OAAO,EACtB,SAAS,EAAE;IACT,iBAAiB,EAAE,GAAG,CAAA;IACtB,cAAc,EAAE,MAAM,CAAA;IACtB,cAAc,EAAE,MAAM,CAAA;IACtB,SAAS,EAAE,MAAM,CAAA;IACjB,CAAC,EAAE,MAAM,CAAA;IACT,CAAC,EAAE,MAAM,CAAA;CACV,EAAE,GACF,GAAG,CAqDL;AAED,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,oBAAoB,EAAE,aAAa,EAAE,CAAA;AA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ACT,CAAC,EAAE,MAAM,CAAA;CACV,EACD,cAAc,EAAE,OAAO,iBAqCxB;AAED,OAAO,EACL,cAAc,EACd,cAAc,EACd,oBAAoB,EACpB,aAAa,EACb,eAAe,GAChB,CAAA;AACD,YAAY,EAAE,iBAAiB,EAAE,CAAA"}
@@ -4,6 +4,7 @@ exports.parsePublicKey = parsePublicKey;
4
4
  exports.parseSignature = parseSignature;
5
5
  exports.generateCredentialId = generateCredentialId;
6
6
  exports.packSignature = packSignature;
7
+ exports.packSignatureV0 = packSignatureV0;
7
8
  const viem_1 = require("viem");
8
9
  function parsePublicKey(publicKey) {
9
10
  const bytes = typeof publicKey === 'string' ? (0, viem_1.hexToBytes)(publicKey) : publicKey;
@@ -88,3 +89,37 @@ function packSignature(credIds, usePrecompile, webAuthns) {
88
89
  },
89
90
  ], [credIds, usePrecompile, webAuthns]);
90
91
  }
92
+ function packSignatureV0(webauthn, usePrecompiled) {
93
+ return (0, viem_1.encodeAbiParameters)([
94
+ { type: 'bytes', name: 'authenticatorData' },
95
+ {
96
+ type: 'string',
97
+ name: 'clientDataJSON',
98
+ },
99
+ {
100
+ type: 'uint256',
101
+ name: 'responseTypeLocation',
102
+ },
103
+ {
104
+ type: 'uint256',
105
+ name: 'r',
106
+ },
107
+ {
108
+ type: 'uint256',
109
+ name: 's',
110
+ },
111
+ {
112
+ type: 'bool',
113
+ name: 'usePrecompiled',
114
+ },
115
+ ], [
116
+ webauthn.authenticatorData,
117
+ webauthn.clientDataJSON,
118
+ typeof webauthn.typeIndex === 'bigint'
119
+ ? webauthn.typeIndex
120
+ : BigInt(webauthn.typeIndex),
121
+ webauthn.r,
122
+ webauthn.s,
123
+ usePrecompiled,
124
+ ]);
125
+ }
@@ -70,4 +70,19 @@ const passkeys_1 = require("./passkeys");
70
70
  (0, vitest_1.expect)(packed).toEqual('0x0000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000000026be9646e4d64132d1a1789a467d0501e948d23afce6792d963f401434d7bef339437809df26444a849d303b1174543f0851df5fae657da19f3bb0d92356426ea00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000022000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000120000000000000000000000000000000000000000000000000000000000000001700000000000000000000000000000000000000000000000000000000000000017474c214167b8a4704cf06f75287a738e7ddbcca9cc0383db6dac6a7d090f4ee024ff8e2a2e8c54aa8cf5f36e3b6125016c3d58d896e3a85c5cd2cd0027a2625000000000000000000000000000000000000000000000000000000000000002549960de5880e8c687434170f6476605b8fe4aeb9a28632c7995cf3ba831d97631d0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000867b2274797065223a22776562617574686e2e676574222c226368616c6c656e6765223a22313971416351415643657563467438745153697a424264627857364a6b65785f336e41656a64527556656b222c226f726967696e223a22687474703a2f2f6c6f63616c686f73743a35313733222c2263726f73734f726967696e223a66616c73657d000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000012000000000000000000000000000000000000000000000000000000000000000170000000000000000000000000000000000000000000000000000000000000001f60f80fe3fd029d1b380d631f0b659bfbc8f8f60921a88e1e123c159aa540f920ed337464d1bb813dc5f9c3e81998185370da49cc525e9f42cdf805f1030aff8000000000000000000000000000000000000000000000000000000000000002549960de5880e8c687434170f6476605b8fe4aeb9a28632c7995cf3ba831d97631d0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000867b2274797065223a22776562617574686e2e676574222c226368616c6c656e6765223a2234703254695a70546f6f4c43464659544332486d4d50564d69566a5a476768434a30647a377a5544456541222c226f726967696e223a22687474703a2f2f6c6f63616c686f73743a35313733222c2263726f73734f726967696e223a66616c73657d0000000000000000000000000000000000000000000000000000');
71
71
  });
72
72
  });
73
+ (0, vitest_1.describe)('Pack Signature V0', () => {
74
+ (0, vitest_1.test)('single', () => {
75
+ const usePrecompile = false;
76
+ const webAuthns = {
77
+ authenticatorData: '0x49960de5880e8c687434170f6476605b8fe4aeb9a28632c7995cf3ba831d97631d00000000',
78
+ clientDataJSON: '{"type":"webauthn.get","challenge":"4p2TiZpTooLCFFYTC2HmMPVMiVjZGghCJ0dz7zUDEeA","origin":"http://localhost:5173","crossOrigin":false}',
79
+ challengeIndex: 23n,
80
+ typeIndex: 1n,
81
+ r: 111296353735534357766084082487308191701889898756402773464442570100570127077266n,
82
+ s: 6705566102199758127831148650668918567109283965479844611524279039128750829560n,
83
+ };
84
+ const packed = (0, passkeys_1.packSignatureV0)(webAuthns, usePrecompile);
85
+ (0, vitest_1.expect)(packed).toEqual('0x00000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000001200000000000000000000000000000000000000000000000000000000000000001f60f80fe3fd029d1b380d631f0b659bfbc8f8f60921a88e1e123c159aa540f920ed337464d1bb813dc5f9c3e81998185370da49cc525e9f42cdf805f1030aff80000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002549960de5880e8c687434170f6476605b8fe4aeb9a28632c7995cf3ba831d97631d0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000867b2274797065223a22776562617574686e2e676574222c226368616c6c656e6765223a2234703254695a70546f6f4c43464659544332486d4d50564d69566a5a476768434a30647a377a5544456541222c226f726967696e223a22687474703a2f2f6c6f63616c686f73743a35313733222c2263726f73734f726967696e223a66616c73657d0000000000000000000000000000000000000000000000000000');
86
+ });
87
+ });
73
88
  });
@@ -1 +1 @@
1
- {"version":3,"file":"walletClient.d.ts","sourceRoot":"","sources":["../../../accounts/walletClient.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,OAAO,EAMP,YAAY,EACb,MAAM,MAAM,CAAA;AAEb;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,YAAY,EAAE,YAAY,GAAG,OAAO,CA4CzE"}
1
+ {"version":3,"file":"walletClient.d.ts","sourceRoot":"","sources":["../../../accounts/walletClient.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,OAAO,EAMP,YAAY,EACb,MAAM,MAAM,CAAA;AAGb;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,YAAY,EAAE,YAAY,GAAG,OAAO,CA0CzE"}
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.walletClientToAccount = walletClientToAccount;
4
+ const error_1 = require("./error");
4
5
  /**
5
6
  * Adapts a Viem/Wagmi WalletClient into an Account-like signer that the SDK can consume.
6
7
  * Ensures address is set and routes sign methods through the provided client.
@@ -8,7 +9,7 @@ exports.walletClientToAccount = walletClientToAccount;
8
9
  function walletClientToAccount(walletClient) {
9
10
  const address = walletClient.account?.address;
10
11
  if (!address) {
11
- throw new Error('WalletClient is missing a default account. Ensure the wallet is connected and the client has an account.');
12
+ throw new error_1.WalletClientNoConnectedAccountError();
12
13
  }
13
14
  const account = {
14
15
  address,
@@ -1,8 +1,36 @@
1
1
  import { type Address, type Chain, type Hex } from 'viem';
2
2
  import type { RhinestoneAccount } from '..';
3
+ import { type ModuleType } from '../modules/common';
3
4
  import { type WebauthnCredential } from '../modules/validators/core';
4
5
  import type { Call, OwnableValidatorConfig, OwnerSet, ProviderConfig, Recovery, WebauthnValidatorConfig } from '../types';
5
6
  import { encodeSmartSessionSignature } from './smart-session';
7
+ interface ModuleInput {
8
+ type: ModuleType;
9
+ address: Address;
10
+ initData?: Hex;
11
+ deInitData?: Hex;
12
+ additionalContext?: Hex;
13
+ }
14
+ /**
15
+ * Install a custom module
16
+ * @param rhinestoneAccount Account to install the module on
17
+ * @param module Module to install
18
+ * @returns Calls to install the module
19
+ */
20
+ declare function installModule({ rhinestoneAccount, module, }: {
21
+ rhinestoneAccount: RhinestoneAccount;
22
+ module: ModuleInput;
23
+ }): Call[];
24
+ /**
25
+ * Uninstall a custom module
26
+ * @param rhinestoneAccount Account to uninstall the module on
27
+ * @param module Module to uninstall
28
+ * @returns Calls to uninstall the module
29
+ */
30
+ declare function uninstallModule({ rhinestoneAccount, module, }: {
31
+ rhinestoneAccount: RhinestoneAccount;
32
+ module: ModuleInput;
33
+ }): Call[];
6
34
  /**
7
35
  * Set up social recovery
8
36
  * @param rhinestoneAccount Account to set up social recovery on
@@ -109,7 +137,7 @@ declare function changePasskeyThreshold(newThreshold: number): Call;
109
137
  * @param provider Provider to use for the recovery
110
138
  * @returns Calls to recover ownership
111
139
  */
112
- declare function recoverEcdsaOwnership(address: Address, newOwners: OwnableValidatorConfig, chain: Chain, provider?: ProviderConfig, validatorAddress?: Address): Promise<Call[]>;
140
+ declare function recoverEcdsaOwnership(address: Address, newOwners: OwnableValidatorConfig, chain: Chain, provider?: ProviderConfig): Promise<Call[]>;
113
141
  /**
114
142
  * Recover an account's ownership (Passkey)
115
143
  * @param address Account address
@@ -163,5 +191,5 @@ declare function setSubValidator(id: Hex | number, validator: OwnableValidatorCo
163
191
  * @returns Call to remove the sub-validator
164
192
  */
165
193
  declare function removeSubValidator(id: Hex | number, validator: OwnableValidatorConfig | WebauthnValidatorConfig): Call;
166
- export { enableEcdsa, enablePasskeys, disableEcdsa, disablePasskeys, addOwner, removeOwner, changeThreshold, addPasskeyOwner, removePasskeyOwner, changePasskeyThreshold, recover, recoverEcdsaOwnership, recoverPasskeyOwnership, setUpRecovery, encodeSmartSessionSignature, enableMultiFactor, disableMultiFactor, changeMultiFactorThreshold, setSubValidator, removeSubValidator, };
194
+ export { installModule, uninstallModule, enableEcdsa, enablePasskeys, disableEcdsa, disablePasskeys, addOwner, removeOwner, changeThreshold, addPasskeyOwner, removePasskeyOwner, changePasskeyThreshold, recover, recoverEcdsaOwnership, recoverPasskeyOwnership, setUpRecovery, encodeSmartSessionSignature, enableMultiFactor, disableMultiFactor, changeMultiFactorThreshold, setSubValidator, removeSubValidator, };
167
195
  //# sourceMappingURL=index.d.ts.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AA"}
@@ -1,6 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.encodeSmartSessionSignature = void 0;
4
+ exports.installModule = installModule;
5
+ exports.uninstallModule = uninstallModule;
4
6
  exports.enableEcdsa = enableEcdsa;
5
7
  exports.enablePasskeys = enablePasskeys;
6
8
  exports.disableEcdsa = disableEcdsa;
@@ -23,9 +25,32 @@ exports.removeSubValidator = removeSubValidator;
23
25
  const viem_1 = require("viem");
24
26
  const accounts_1 = require("../accounts");
25
27
  const utils_1 = require("../accounts/utils");
28
+ const common_1 = require("../modules/common");
26
29
  const core_1 = require("../modules/validators/core");
27
30
  const smart_session_1 = require("./smart-session");
28
31
  Object.defineProperty(exports, "encodeSmartSessionSignature", { enumerable: true, get: function () { return smart_session_1.encodeSmartSessionSignature; } });
32
+ /**
33
+ * Install a custom module
34
+ * @param rhinestoneAccount Account to install the module on
35
+ * @param module Module to install
36
+ * @returns Calls to install the module
37
+ */
38
+ function installModule({ rhinestoneAccount, module, }) {
39
+ const moduleData = getModule(module);
40
+ const calls = (0, accounts_1.getModuleInstallationCalls)(rhinestoneAccount.config, moduleData);
41
+ return calls;
42
+ }
43
+ /**
44
+ * Uninstall a custom module
45
+ * @param rhinestoneAccount Account to uninstall the module on
46
+ * @param module Module to uninstall
47
+ * @returns Calls to uninstall the module
48
+ */
49
+ function uninstallModule({ rhinestoneAccount, module, }) {
50
+ const moduleData = getModule(module);
51
+ const calls = (0, accounts_1.getModuleUninstallationCalls)(rhinestoneAccount.config, moduleData);
52
+ return calls;
53
+ }
29
54
  /**
30
55
  * Set up social recovery
31
56
  * @param rhinestoneAccount Account to set up social recovery on
@@ -52,9 +77,6 @@ async function recover(address, newOwners, chain, provider) {
52
77
  case 'ecdsa': {
53
78
  return recoverEcdsaOwnership(address, newOwners, chain, provider);
54
79
  }
55
- case 'ecdsa-v0': {
56
- return recoverEcdsaOwnership(address, newOwners, chain, provider, core_1.OWNABLE_V0_VALIDATOR_ADDRESS);
57
- }
58
80
  case 'passkey': {
59
81
  throw new Error('Passkey ownership recovery is not yet supported');
60
82
  }
@@ -286,7 +308,7 @@ function changePasskeyThreshold(newThreshold) {
286
308
  * @param provider Provider to use for the recovery
287
309
  * @returns Calls to recover ownership
288
310
  */
289
- async function recoverEcdsaOwnership(address, newOwners, chain, provider, validatorAddress) {
311
+ async function recoverEcdsaOwnership(address, newOwners, chain, provider) {
290
312
  const publicClient = (0, viem_1.createPublicClient)({
291
313
  chain,
292
314
  transport: (0, utils_1.createTransport)(chain, provider),
@@ -295,7 +317,7 @@ async function recoverEcdsaOwnership(address, newOwners, chain, provider, valida
295
317
  const results = await publicClient.multicall({
296
318
  contracts: [
297
319
  {
298
- address: validatorAddress ?? core_1.OWNABLE_VALIDATOR_ADDRESS,
320
+ address: core_1.OWNABLE_VALIDATOR_ADDRESS,
299
321
  abi: [
300
322
  {
301
323
  inputs: [
@@ -317,7 +339,7 @@ async function recoverEcdsaOwnership(address, newOwners, chain, provider, valida
317
339
  args: [address],
318
340
  },
319
341
  {
320
- address: validatorAddress ?? core_1.OWNABLE_VALIDATOR_ADDRESS,
342
+ address: core_1.OWNABLE_VALIDATOR_ADDRESS,
321
343
  abi: [
322
344
  {
323
345
  inputs: [
@@ -561,3 +583,12 @@ function removeSubValidator(id, validator) {
561
583
  }),
562
584
  };
563
585
  }
586
+ function getModule(module) {
587
+ return {
588
+ type: (0, common_1.toModuleTypeId)(module.type),
589
+ address: module.address,
590
+ initData: module.initData ?? '0x',
591
+ deInitData: module.deInitData ?? '0x',
592
+ additionalContext: module.additionalContext ?? '0x',
593
+ };
594
+ }
@@ -10,7 +10,7 @@ const MOCK_OWNER_A = '0xd1aefebdceefc094f1805b241fa5e6db63a9181a';
10
10
  const MOCK_OWNER_B = '0xeddfcb50d18f6d3d51c4f7cbca5ed6bdebc59817';
11
11
  const MOCK_OWNER_C = '0xb31e76f19defe76edc4b7eceeb4b0a2d6ddaca39';
12
12
  const MOCK_ACCOUNT_ADDRESS = '0x1234567890123456789012345678901234567890';
13
- const accountAddress = '0x36c03e7d593f7b2c6b06fc18b5f4e9a4a29c99b0';
13
+ const accountAddress = '0x36C03e7D593F7B2C6b06fC18B5f4E9a4A29C99b0';
14
14
  // Mock viem
15
15
  vitest_1.vi.mock('viem', async (importOriginal) => {
16
16
  const actual = await importOriginal();
@@ -132,7 +132,7 @@ vitest_1.vi.mock('viem', async (importOriginal) => {
132
132
  (0, vitest_1.describe)('Add Owner', () => {
133
133
  (0, vitest_1.test)('', () => {
134
134
  (0, vitest_1.expect)((0, _1.addOwner)(MOCK_OWNER_A)).toEqual({
135
- to: '0x000000000013fdB5234E4E3162a810F54d9f7E98',
135
+ to: '0x000000000013fdb5234e4e3162a810f54d9f7e98',
136
136
  value: 0n,
137
137
  data: '0x7065cb48000000000000000000000000d1aefebdceefc094f1805b241fa5e6db63a9181a',
138
138
  });
@@ -141,7 +141,7 @@ vitest_1.vi.mock('viem', async (importOriginal) => {
141
141
  (0, vitest_1.describe)('Remove Owner', () => {
142
142
  (0, vitest_1.test)('', () => {
143
143
  (0, vitest_1.expect)((0, _1.removeOwner)(MOCK_OWNER_A, MOCK_OWNER_B)).toEqual({
144
- to: '0x000000000013fdB5234E4E3162a810F54d9f7E98',
144
+ to: '0x000000000013fdb5234e4e3162a810f54d9f7e98',
145
145
  value: 0n,
146
146
  data: '0xfbe5ce0a000000000000000000000000d1aefebdceefc094f1805b241fa5e6db63a9181a000000000000000000000000eddfcb50d18f6d3d51c4f7cbca5ed6bdebc59817',
147
147
  });
@@ -150,7 +150,7 @@ vitest_1.vi.mock('viem', async (importOriginal) => {
150
150
  (0, vitest_1.describe)('Set Threshold', () => {
151
151
  (0, vitest_1.test)('', () => {
152
152
  (0, vitest_1.expect)((0, _1.changeThreshold)(1)).toEqual({
153
- to: '0x000000000013fdB5234E4E3162a810F54d9f7E98',
153
+ to: '0x000000000013fdb5234e4e3162a810f54d9f7e98',
154
154
  value: 0n,
155
155
  data: '0x960bfe040000000000000000000000000000000000000000000000000000000000000001',
156
156
  });
@@ -216,12 +216,12 @@ vitest_1.vi.mock('viem', async (importOriginal) => {
216
216
  (0, vitest_1.expect)(mockPublicClient.multicall).toHaveBeenCalledTimes(1);
217
217
  (0, vitest_1.expect)(result).toEqual([
218
218
  {
219
- to: '0x000000000013fdB5234E4E3162a810F54d9f7E98',
219
+ to: '0x000000000013fdb5234e4e3162a810f54d9f7e98',
220
220
  value: 0n,
221
221
  data: '0x7065cb480000000000000000000000006092086a3dc0020cd604a68fcf5d430007d51bb7',
222
222
  },
223
223
  {
224
- to: '0x000000000013fdB5234E4E3162a810F54d9f7E98',
224
+ to: '0x000000000013fdb5234e4e3162a810f54d9f7e98',
225
225
  value: 0n,
226
226
  data: '0xfbe5ce0a0000000000000000000000006092086a3dc0020cd604a68fcf5d430007d51bb7000000000000000000000000f6c02c78ded62973b43bfa523b247da099486936',
227
227
  },
@@ -249,12 +249,12 @@ vitest_1.vi.mock('viem', async (importOriginal) => {
249
249
  (0, vitest_1.expect)(mockPublicClient.multicall).toHaveBeenCalledTimes(1);
250
250
  (0, vitest_1.expect)(result).toEqual([
251
251
  {
252
- to: '0x000000000013fdB5234E4E3162a810F54d9f7E98',
252
+ to: '0x000000000013fdb5234e4e3162a810f54d9f7e98',
253
253
  value: 0n,
254
254
  data: '0x7065cb48000000000000000000000000c5587d912c862252599b61926adaef316ba06da0',
255
255
  },
256
256
  {
257
- to: '0x000000000013fdB5234E4E3162a810F54d9f7E98',
257
+ to: '0x000000000013fdb5234e4e3162a810f54d9f7e98',
258
258
  value: 0n,
259
259
  data: '0xfbe5ce0a000000000000000000000000c5587d912c862252599b61926adaef316ba06da0000000000000000000000000f6c02c78ded62973b43bfa523b247da099486936',
260
260
  },
@@ -282,17 +282,17 @@ vitest_1.vi.mock('viem', async (importOriginal) => {
282
282
  (0, vitest_1.expect)(mockPublicClient.multicall).toHaveBeenCalledTimes(1);
283
283
  (0, vitest_1.expect)(result).toEqual([
284
284
  {
285
- to: '0x000000000013fdB5234E4E3162a810F54d9f7E98',
285
+ to: '0x000000000013fdb5234e4e3162a810f54d9f7e98',
286
286
  value: 0n,
287
287
  data: '0x7065cb48000000000000000000000000c5587d912c862252599b61926adaef316ba06da0',
288
288
  },
289
289
  {
290
- to: '0x000000000013fdB5234E4E3162a810F54d9f7E98',
290
+ to: '0x000000000013fdb5234e4e3162a810f54d9f7e98',
291
291
  value: 0n,
292
292
  data: '0xfbe5ce0a000000000000000000000000c5587d912c862252599b61926adaef316ba06da0000000000000000000000000f6c02c78ded62973b43bfa523b247da099486936',
293
293
  },
294
294
  {
295
- to: '0x000000000013fdB5234E4E3162a810F54d9f7E98',
295
+ to: '0x000000000013fdb5234e4e3162a810f54d9f7e98',
296
296
  value: 0n,
297
297
  data: '0xfbe5ce0a0000000000000000000000006092086a3dc0020cd604a68fcf5d430007d51bb7000000000000000000000000c27b7578151c5ef713c62c65db09763d57ac3596',
298
298
  },
@@ -42,6 +42,13 @@ declare class SessionChainRequiredError extends ExecutionError {
42
42
  traceId?: string;
43
43
  });
44
44
  }
45
+ declare class SimulationNotSupportedForUserOpFlowError extends ExecutionError {
46
+ constructor(params?: {
47
+ context?: any;
48
+ errorType?: string;
49
+ traceId?: string;
50
+ });
51
+ }
45
52
  declare class IntentFailedError extends ExecutionError {
46
53
  constructor(params?: {
47
54
  context?: any;
@@ -50,5 +57,5 @@ declare class IntentFailedError extends ExecutionError {
50
57
  });
51
58
  }
52
59
  declare function isExecutionError(error: Error): error is ExecutionError;
53
- export { isExecutionError, ExecutionError, SourceChainsNotAvailableForUserOpFlowError, UserOperationRequiredForSmartSessionsError, OrderPathRequiredForIntentsError, SessionChainRequiredError, IntentFailedError, };
60
+ export { isExecutionError, ExecutionError, SourceChainsNotAvailableForUserOpFlowError, UserOperationRequiredForSmartSessionsError, OrderPathRequiredForIntentsError, SessionChainRequiredError, IntentFailedError, SimulationNotSupportedForUserOpFlowError, };
54
61
  //# sourceMappingURL=error.d.ts.map
@@ -1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G,CAAA;QACb,SAAS,CAAC,EAAE,MAAM,CAAA;QAClB,OAAO,CAAC,EAAE,MAAM,CAAA;KACjB;CAMF;AAED,cAAM,gCAAiC,SAAQ,cAAc;gBAC/C,MAAM,CAAC,EAAE;QACnB,OAAO,CAAC,EAAE,GAAG,CAAA;QACb,SAAS,CAAC,EAAE,MAAM,CAAA;QAClB,OAAO,CAAC,EAAE,MAAM,CAAA;KACjB;CAMF;AAED,cAAM,yBAA0B,SAAQ,cAAc;gBACxC,MAAM,CAAC,EAAE;QACnB,OAAO,CAAC,EAAE,GAAG,CAAA;QACb,SAAS,CAAC,EAAE,MAAM,CAAA;QAClB,OAAO,CAAC,EAAE,MAAM,CAAA;KACjB;CAOF;AAED,cAAM,wCAAyC,SAAQ,cAAc;gBACvD,MAAM,CAAC,EAAE;QACnB,OAAO,CAAC,EAAE,GAAG,CAAA;QACb,SAAS,CAAC,EAAE,MAAM,CAAA;QAClB,OAAO,CAAC,EAAE,MAAM,CAAA;KACjB;CAMF;AAED,cAAM,iBAAkB,SAAQ,cAAc;gBAChC,MAAM,CAAC,EAAE;QACnB,OAAO,CAAC,EAAE,GAAG,CAAA;QACb,SAAS,CAAC,EAAE,MAAM,CAAA;QAClB,OAAO,CAAC,EAAE,MAAM,CAAA;KACjB;CAMF;AAED,iBAAS,gBAAgB,CAAC,KAAK,EAAE,KAAK,GAAG,KAAK,IAAI,cAAc,CAE/D;AAED,OAAO,EACL,gBAAgB,EAChB,cAAc,EACd,0CAA0C,EAC1C,0CAA0C,EAC1C,gCAAgC,EAChC,yBAAyB,EACzB,iBAAiB,EACjB,wCAAwC,GACzC,CAAA"}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.IntentFailedError = exports.SessionChainRequiredError = exports.OrderPathRequiredForIntentsError = exports.UserOperationRequiredForSmartSessionsError = exports.SourceChainsNotAvailableForUserOpFlowError = exports.ExecutionError = void 0;
3
+ exports.SimulationNotSupportedForUserOpFlowError = exports.IntentFailedError = exports.SessionChainRequiredError = exports.OrderPathRequiredForIntentsError = exports.UserOperationRequiredForSmartSessionsError = exports.SourceChainsNotAvailableForUserOpFlowError = exports.ExecutionError = void 0;
4
4
  exports.isExecutionError = isExecutionError;
5
5
  class ExecutionError extends Error {
6
6
  _message;
@@ -64,6 +64,15 @@ class SessionChainRequiredError extends ExecutionError {
64
64
  }
65
65
  }
66
66
  exports.SessionChainRequiredError = SessionChainRequiredError;
67
+ class SimulationNotSupportedForUserOpFlowError extends ExecutionError {
68
+ constructor(params) {
69
+ super({
70
+ message: 'Simulation not supported for user operation flow',
71
+ ...params,
72
+ });
73
+ }
74
+ }
75
+ exports.SimulationNotSupportedForUserOpFlowError = SimulationNotSupportedForUserOpFlowError;
67
76
  class IntentFailedError extends ExecutionError {
68
77
  constructor(params) {
69
78
  super({
@@ -1,9 +1,18 @@
1
1
  import { type Address, type Chain } from 'viem';
2
2
  import type { IntentOpStatus } from '../orchestrator';
3
- import type { RhinestoneAccountConfig, Transaction } from '../types';
4
- import { ExecutionError, IntentFailedError, isExecutionError, OrderPathRequiredForIntentsError, SessionChainRequiredError, SourceChainsNotAvailableForUserOpFlowError, UserOperationRequiredForSmartSessionsError } from './error';
3
+ import type { SettlementLayer } from '../orchestrator/types';
4
+ import type { CallInput, RhinestoneAccountConfig, SignerSet, TokenRequest, Transaction } from '../types';
5
+ import { ExecutionError, IntentFailedError, isExecutionError, OrderPathRequiredForIntentsError, SessionChainRequiredError, SimulationNotSupportedForUserOpFlowError, SourceChainsNotAvailableForUserOpFlowError, UserOperationRequiredForSmartSessionsError } from './error';
5
6
  import type { IntentData, TransactionResult } from './utils';
6
7
  declare function sendTransaction(config: RhinestoneAccountConfig, transaction: Transaction): Promise<TransactionResult>;
8
+ declare function sendTransactionInternal(config: RhinestoneAccountConfig, sourceChains: Chain[], targetChain: Chain, callInputs: CallInput[], options: {
9
+ gasLimit?: bigint;
10
+ initialTokenRequests?: TokenRequest[];
11
+ signers?: SignerSet;
12
+ sponsored?: boolean;
13
+ settlementLayers?: SettlementLayer[];
14
+ asUserOp?: boolean;
15
+ }): Promise<TransactionResult>;
7
16
  declare function waitForExecution(config: RhinestoneAccountConfig, result: TransactionResult, acceptsPreconfirmations: boolean): Promise<IntentOpStatus | {
8
17
  actualGasCost: bigint;
9
18
  actualGasUsed: bigint;
@@ -19,6 +28,6 @@ declare function waitForExecution(config: RhinestoneAccountConfig, result: Trans
19
28
  }>;
20
29
  declare function getMaxSpendableAmount(config: RhinestoneAccountConfig, chain: Chain, tokenAddress: Address, gasUnits: bigint, sponsored?: boolean): Promise<bigint>;
21
30
  declare function getPortfolio(config: RhinestoneAccountConfig, onTestnets: boolean): Promise<import("../orchestrator").Portfolio>;
22
- export { sendTransaction, waitForExecution, getMaxSpendableAmount, getPortfolio, isExecutionError, IntentFailedError, ExecutionError, SourceChainsNotAvailableForUserOpFlowError, UserOperationRequiredForSmartSessionsError, OrderPathRequiredForIntentsError, SessionChainRequiredError, };
31
+ export { sendTransaction, sendTransactionInternal, waitForExecution, getMaxSpendableAmount, getPortfolio, isExecutionError, ExecutionError, IntentFailedError, OrderPathRequiredForIntentsError, SessionChainRequiredError, SimulationNotSupportedForUserOpFlowError, SourceChainsNotAvailableForUserOpFlowError, UserOperationRequiredForSmartSessionsError, };
23
32
  export type { IntentData, TransactionResult };
24
33
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../execution/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAE,KAAK,KAAK,EAAmC,MAAM,MAAM,CAAA;AAKhF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAA;AASrD,OAAO,KAAK,EAEV,uBAAuB,EAGvB,WAAW,EACZ,MAAM,UAAU,CAAA;AACjB,OAAO,EACL,cAAc,EACd,iBAAiB,EACjB,gBAAgB,EAChB,gCAAgC,EAChC,yBAAy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