@rhinestone/sdk 1.5.0 → 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.
Files changed (114) hide show
  1. package/dist/src/accounts/error.d.ts +1 -1
  2. package/dist/src/accounts/error.js +1 -19
  3. package/dist/src/accounts/index.d.ts +5 -5
  4. package/dist/src/accounts/index.js +121 -157
  5. package/dist/src/accounts/json-rpc/index.d.ts +1 -1
  6. package/dist/src/accounts/json-rpc/index.js +8 -10
  7. package/dist/src/accounts/json-rpc/providers.d.ts +1 -1
  8. package/dist/src/accounts/json-rpc/providers.js +4 -7
  9. package/dist/src/accounts/kernel.d.ts +3 -3
  10. package/dist/src/accounts/kernel.js +66 -75
  11. package/dist/src/accounts/nexus.d.ts +3 -3
  12. package/dist/src/accounts/nexus.js +62 -73
  13. package/dist/src/accounts/passport.d.ts +3 -3
  14. package/dist/src/accounts/passport.js +9 -13
  15. package/dist/src/accounts/safe.d.ts +3 -3
  16. package/dist/src/accounts/safe.js +54 -63
  17. package/dist/src/accounts/signing/common.d.ts +2 -2
  18. package/dist/src/accounts/signing/common.js +30 -36
  19. package/dist/src/accounts/signing/message.d.ts +2 -2
  20. package/dist/src/accounts/signing/message.js +10 -12
  21. package/dist/src/accounts/signing/passkeys.js +11 -17
  22. package/dist/src/accounts/signing/typedData.d.ts +1 -1
  23. package/dist/src/accounts/signing/typedData.js +6 -8
  24. package/dist/src/accounts/startale.d.ts +3 -3
  25. package/dist/src/accounts/startale.js +37 -47
  26. package/dist/src/accounts/utils.d.ts +2 -2
  27. package/dist/src/accounts/utils.js +22 -28
  28. package/dist/src/accounts/walletClient.js +4 -8
  29. package/dist/src/actions/compact.d.ts +1 -1
  30. package/dist/src/actions/compact.js +22 -35
  31. package/dist/src/actions/deployment.d.ts +1 -1
  32. package/dist/src/actions/deployment.js +11 -13
  33. package/dist/src/actions/ecdsa.d.ts +1 -1
  34. package/dist/src/actions/ecdsa.js +14 -20
  35. package/dist/src/actions/index.d.ts +2 -2
  36. package/dist/src/actions/index.js +6 -10
  37. package/dist/src/actions/mfa.d.ts +1 -1
  38. package/dist/src/actions/mfa.js +18 -24
  39. package/dist/src/actions/passkeys.d.ts +2 -2
  40. package/dist/src/actions/passkeys.js +14 -20
  41. package/dist/src/actions/recovery.d.ts +1 -1
  42. package/dist/src/actions/recovery.js +25 -29
  43. package/dist/src/actions/smart-sessions.d.ts +1 -1
  44. package/dist/src/actions/smart-sessions.js +8 -12
  45. package/dist/src/auth/provider.d.ts +1 -1
  46. package/dist/src/auth/provider.js +1 -4
  47. package/dist/src/errors/index.d.ts +3 -3
  48. package/dist/src/errors/index.js +10 -54
  49. package/dist/src/execution/compact.d.ts +3 -3
  50. package/dist/src/execution/compact.js +10 -18
  51. package/dist/src/execution/error.js +1 -11
  52. package/dist/src/execution/index.d.ts +8 -8
  53. package/dist/src/execution/index.js +50 -65
  54. package/dist/src/execution/permit2.d.ts +5 -5
  55. package/dist/src/execution/permit2.js +8 -13
  56. package/dist/src/execution/singleChainOps.d.ts +2 -2
  57. package/dist/src/execution/singleChainOps.js +1 -3
  58. package/dist/src/execution/types.d.ts +1 -1
  59. package/dist/src/execution/types.js +1 -2
  60. package/dist/src/execution/utils.d.ts +4 -4
  61. package/dist/src/execution/utils.js +133 -156
  62. package/dist/src/index.d.ts +9 -9
  63. package/dist/src/index.js +55 -66
  64. package/dist/src/jwt-server/digest.js +3 -6
  65. package/dist/src/jwt-server/express.d.ts +1 -1
  66. package/dist/src/jwt-server/express.d.ts.map +1 -1
  67. package/dist/src/jwt-server/express.js +6 -7
  68. package/dist/src/jwt-server/handlers.d.ts +1 -1
  69. package/dist/src/jwt-server/handlers.js +7 -11
  70. package/dist/src/jwt-server/index.d.ts +7 -7
  71. package/dist/src/jwt-server/index.js +6 -17
  72. package/dist/src/jwt-server/jcs.js +1 -4
  73. package/dist/src/jwt-server/signer.d.ts +1 -1
  74. package/dist/src/jwt-server/signer.js +10 -13
  75. package/dist/src/jwt-server/sponsorship.js +2 -7
  76. package/dist/src/jwt-server/web.d.ts +1 -1
  77. package/dist/src/jwt-server/web.js +5 -9
  78. package/dist/src/modules/abi/smart-session-emissary.js +1 -3
  79. package/dist/src/modules/abi/smart-sessions.js +1 -4
  80. package/dist/src/modules/chain-abstraction.js +1 -5
  81. package/dist/src/modules/common.d.ts +1 -1
  82. package/dist/src/modules/common.js +1 -13
  83. package/dist/src/modules/index.d.ts +5 -5
  84. package/dist/src/modules/index.js +35 -50
  85. package/dist/src/modules/legacy.d.ts +2 -2
  86. package/dist/src/modules/legacy.js +11 -14
  87. package/dist/src/modules/read.d.ts +1 -1
  88. package/dist/src/modules/read.js +11 -15
  89. package/dist/src/modules/validators/core.d.ts +2 -2
  90. package/dist/src/modules/validators/core.js +26 -44
  91. package/dist/src/modules/validators/index.d.ts +2 -2
  92. package/dist/src/modules/validators/index.js +3 -19
  93. package/dist/src/modules/validators/policies/claim/permit2.d.ts +1 -1
  94. package/dist/src/modules/validators/policies/claim/permit2.js +39 -44
  95. package/dist/src/modules/validators/policies/claim/types.js +11 -14
  96. package/dist/src/modules/validators/smart-sessions.d.ts +3 -3
  97. package/dist/src/modules/validators/smart-sessions.js +65 -94
  98. package/dist/src/orchestrator/client.d.ts +2 -2
  99. package/dist/src/orchestrator/client.js +46 -50
  100. package/dist/src/orchestrator/consts.d.ts +1 -1
  101. package/dist/src/orchestrator/consts.d.ts.map +1 -1
  102. package/dist/src/orchestrator/consts.js +2 -8
  103. package/dist/src/orchestrator/error.js +1 -33
  104. package/dist/src/orchestrator/index.d.ts +7 -7
  105. package/dist/src/orchestrator/index.js +7 -56
  106. package/dist/src/orchestrator/registry.d.ts +2 -2
  107. package/dist/src/orchestrator/registry.js +19 -33
  108. package/dist/src/orchestrator/types.js +1 -17
  109. package/dist/src/orchestrator/utils.js +1 -3
  110. package/dist/src/types.d.ts +3 -3
  111. package/dist/src/types.js +1 -2
  112. package/dist/src/utils/index.d.ts +2 -2
  113. package/dist/src/utils/index.js +9 -15
  114. package/package.json +15 -98
@@ -1,14 +1,14 @@
1
1
  import type { Address, Chain, HashTypedDataParameters, Hex, SignableMessage, SignedAuthorizationList, TypedData, TypedDataDefinition } from 'viem';
2
2
  import type { UserOperationReceipt } from 'viem/account-abstraction';
3
- import { walletClientToAccount, wrapParaAccount } from './accounts/walletClient';
4
- import { deployAccountsForOwners } from './actions/deployment';
5
- import { type TransactionResult, type TransactionStatus, type UserOperationResult } from './execution';
6
- import { type BatchPermit2Result, checkERC20AllowanceDirect, getPermit2Address, type MultiChainPermit2Config, type MultiChainPermit2Result, signPermit2Batch, signPermit2Sequential } from './execution/permit2';
7
- import { type IntentRoute, type PreparedTransactionData, type PreparedUserOperationData, type SignedTransactionData, type SignedUserOperationData } from './execution/utils';
8
- import { MULTI_FACTOR_VALIDATOR_ADDRESS, OWNABLE_VALIDATOR_ADDRESS, SMART_SESSION_EMISSARY_ADDRESS, WEBAUTHN_VALIDATOR_ADDRESS } from './modules';
9
- import { type SessionDetails } from './modules/validators/smart-sessions';
10
- import { type ApprovalRequired, type AuxiliaryFunds, getAllSupportedChainsAndTokens, getSupportedTokens, getTokenAddress, getTokenDecimals, type IntentInput, type IntentOp, type IntentOpStatus, type Portfolio, type SettlementLayer, type SignedIntentOp, type SplitIntentsInput, type SplitIntentsResult, type TokenRequirements, type WrapRequired } from './orchestrator';
11
- import type { AccountProviderConfig, AccountType, BundlerConfig, Call, CallInput, ChainSessionConfig, MultiFactorValidatorConfig, OwnableValidatorConfig, OwnerSet, PaymasterConfig, Permit2ClaimPolicy, Policy, ProviderConfig, Recovery, RhinestoneAccountConfig, RhinestoneConfig, RhinestoneSDKConfig, Session, SignerSet, TokenRequest, TokenSymbol, Transaction, UniversalActionPolicyParamCondition, UserOperationTransaction, WebauthnValidatorConfig } from './types';
3
+ import { walletClientToAccount, wrapParaAccount } from './accounts/walletClient.js';
4
+ import { deployAccountsForOwners } from './actions/deployment.js';
5
+ import { type TransactionResult, type TransactionStatus, type UserOperationResult } from './execution/index.js';
6
+ import { type BatchPermit2Result, checkERC20AllowanceDirect, getPermit2Address, type MultiChainPermit2Config, type MultiChainPermit2Result, signPermit2Batch, signPermit2Sequential } from './execution/permit2.js';
7
+ import { type IntentRoute, type PreparedTransactionData, type PreparedUserOperationData, type SignedTransactionData, type SignedUserOperationData } from './execution/utils.js';
8
+ import { MULTI_FACTOR_VALIDATOR_ADDRESS, OWNABLE_VALIDATOR_ADDRESS, SMART_SESSION_EMISSARY_ADDRESS, WEBAUTHN_VALIDATOR_ADDRESS } from './modules/index.js';
9
+ import { type SessionDetails } from './modules/validators/smart-sessions.js';
10
+ import { type ApprovalRequired, type AuxiliaryFunds, getAllSupportedChainsAndTokens, getSupportedTokens, getTokenAddress, getTokenDecimals, type IntentInput, type IntentOp, type IntentOpStatus, type Portfolio, type SettlementLayer, type SignedIntentOp, type SplitIntentsInput, type SplitIntentsResult, type TokenRequirements, type WrapRequired } from './orchestrator/index.js';
11
+ import type { AccountProviderConfig, AccountType, BundlerConfig, Call, CallInput, ChainSessionConfig, MultiFactorValidatorConfig, OwnableValidatorConfig, OwnerSet, PaymasterConfig, Permit2ClaimPolicy, Policy, ProviderConfig, Recovery, RhinestoneAccountConfig, RhinestoneConfig, RhinestoneSDKConfig, Session, SignerSet, TokenRequest, TokenSymbol, Transaction, UniversalActionPolicyParamCondition, UserOperationTransaction, WebauthnValidatorConfig } from './types.js';
12
12
  interface RhinestoneAccount {
13
13
  config: RhinestoneAccountConfig;
14
14
  deploy: (chain: Chain, params?: {
package/dist/src/index.js CHANGED
@@ -1,32 +1,13 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.signPermit2Sequential = exports.signPermit2Batch = exports.getPermit2Address = exports.checkERC20AllowanceDirect = exports.getAllSupportedChainsAndTokens = exports.getTokenDecimals = exports.getTokenAddress = exports.getSupportedTokens = exports.SMART_SESSION_EMISSARY_ADDRESS = exports.MULTI_FACTOR_VALIDATOR_ADDRESS = exports.WEBAUTHN_VALIDATOR_ADDRESS = exports.OWNABLE_VALIDATOR_ADDRESS = exports.wrapParaAccount = exports.walletClientToAccount = exports.deployAccountsForOwners = exports.RhinestoneSDK = void 0;
4
- exports.createRhinestoneAccount = createRhinestoneAccount;
5
- const accounts_1 = require("./accounts");
6
- const walletClient_1 = require("./accounts/walletClient");
7
- Object.defineProperty(exports, "walletClientToAccount", { enumerable: true, get: function () { return walletClient_1.walletClientToAccount; } });
8
- Object.defineProperty(exports, "wrapParaAccount", { enumerable: true, get: function () { return walletClient_1.wrapParaAccount; } });
9
- const deployment_1 = require("./actions/deployment");
10
- Object.defineProperty(exports, "deployAccountsForOwners", { enumerable: true, get: function () { return deployment_1.deployAccountsForOwners; } });
11
- const provider_1 = require("./auth/provider");
12
- const execution_1 = require("./execution");
13
- const permit2_1 = require("./execution/permit2");
14
- Object.defineProperty(exports, "checkERC20AllowanceDirect", { enumerable: true, get: function () { return permit2_1.checkERC20AllowanceDirect; } });
15
- Object.defineProperty(exports, "getPermit2Address", { enumerable: true, get: function () { return permit2_1.getPermit2Address; } });
16
- Object.defineProperty(exports, "signPermit2Batch", { enumerable: true, get: function () { return permit2_1.signPermit2Batch; } });
17
- Object.defineProperty(exports, "signPermit2Sequential", { enumerable: true, get: function () { return permit2_1.signPermit2Sequential; } });
18
- const utils_1 = require("./execution/utils");
19
- const modules_1 = require("./modules");
20
- Object.defineProperty(exports, "MULTI_FACTOR_VALIDATOR_ADDRESS", { enumerable: true, get: function () { return modules_1.MULTI_FACTOR_VALIDATOR_ADDRESS; } });
21
- Object.defineProperty(exports, "OWNABLE_VALIDATOR_ADDRESS", { enumerable: true, get: function () { return modules_1.OWNABLE_VALIDATOR_ADDRESS; } });
22
- Object.defineProperty(exports, "SMART_SESSION_EMISSARY_ADDRESS", { enumerable: true, get: function () { return modules_1.SMART_SESSION_EMISSARY_ADDRESS; } });
23
- Object.defineProperty(exports, "WEBAUTHN_VALIDATOR_ADDRESS", { enumerable: true, get: function () { return modules_1.WEBAUTHN_VALIDATOR_ADDRESS; } });
24
- const smart_sessions_1 = require("./modules/validators/smart-sessions");
25
- const orchestrator_1 = require("./orchestrator");
26
- Object.defineProperty(exports, "getAllSupportedChainsAndTokens", { enumerable: true, get: function () { return orchestrator_1.getAllSupportedChainsAndTokens; } });
27
- Object.defineProperty(exports, "getSupportedTokens", { enumerable: true, get: function () { return orchestrator_1.getSupportedTokens; } });
28
- Object.defineProperty(exports, "getTokenAddress", { enumerable: true, get: function () { return orchestrator_1.getTokenAddress; } });
29
- Object.defineProperty(exports, "getTokenDecimals", { enumerable: true, get: function () { return orchestrator_1.getTokenDecimals; } });
1
+ import { checkAddress, deploy as deployInternal, FactoryArgsNotAvailableError, getAccountProvider, getAddress as getAddressInternal, getInitCode, isDeployed as isDeployedInternal, OwnersFieldRequiredError, setup as setupInternal, signEip7702InitData as signEip7702InitDataInternal, } from './accounts/index.js';
2
+ import { walletClientToAccount, wrapParaAccount } from './accounts/walletClient.js';
3
+ import { deployAccountsForOwners } from './actions/deployment.js';
4
+ import { createAuthProvider } from './auth/provider.js';
5
+ import { getIntentStatus as getIntentStatusInternal, getPortfolio as getPortfolioInternal, sendTransaction as sendTransactionInternal, sendUserOperation as sendUserOperationInternal, splitIntents as splitIntentsInternal, waitForExecution as waitForExecutionInternal, } from './execution/index.js';
6
+ import { checkERC20AllowanceDirect, checkERC20Allowance as checkERC20AllowanceInternal, getPermit2Address, signPermit2Batch, signPermit2Sequential, } from './execution/permit2.js';
7
+ import { getTransactionMessages as getTransactionMessagesInternal, prepareTransaction as prepareTransactionInternal, prepareUserOperation as prepareUserOperationInternal, signAuthorizations as signAuthorizationsInternal, signMessage as signMessageInternal, signTransaction as signTransactionInternal, signTypedData as signTypedDataInternal, signUserOperation as signUserOperationInternal, submitTransaction as submitTransactionInternal, submitUserOperation as submitUserOperationInternal, } from './execution/utils.js';
8
+ import { getExecutors as getExecutorsInternal, getOwners as getOwnersInternal, getSessionDetails as getSessionDetailsInternal, getValidators as getValidatorsInternal, MULTI_FACTOR_VALIDATOR_ADDRESS, OWNABLE_VALIDATOR_ADDRESS, SMART_SESSION_EMISSARY_ADDRESS, signEnableSession as signEnableSessionInternal, WEBAUTHN_VALIDATOR_ADDRESS, } from './modules/index.js';
9
+ import { isSessionEnabled as isSessionEnabledInternal, } from './modules/validators/smart-sessions.js';
10
+ import { getAllSupportedChainsAndTokens, getSupportedTokens, getTokenAddress, getTokenDecimals, } from './orchestrator/index.js';
30
11
  /**
31
12
  * Initialize a Rhinestone account
32
13
  * Note: accounts are deployed onchain only when the first transaction is sent.
@@ -36,10 +17,10 @@ Object.defineProperty(exports, "getTokenDecimals", { enumerable: true, get: func
36
17
  async function createRhinestoneAccount(config) {
37
18
  // Sanity check for existing (externally created) accounts
38
19
  // Ensures we decode the initdata correctly
39
- (0, accounts_1.checkAddress)(config);
20
+ checkAddress(config);
40
21
  // Validate that owners field is provided for non-EOA accounts
41
22
  if (config.account?.type !== 'eoa' && !config.owners) {
42
- throw new accounts_1.OwnersFieldRequiredError();
23
+ throw new OwnersFieldRequiredError();
43
24
  }
44
25
  /**
45
26
  * Deploys the account on a given chain
@@ -47,7 +28,7 @@ async function createRhinestoneAccount(config) {
47
28
  * @param session Session to deploy the account on (optional)
48
29
  */
49
30
  function deploy(chain, params) {
50
- return (0, accounts_1.deploy)(config, chain, params);
31
+ return deployInternal(config, chain, params);
51
32
  }
52
33
  /**
53
34
  * Checks if the account is deployed on a given chain
@@ -55,7 +36,7 @@ async function createRhinestoneAccount(config) {
55
36
  * @returns true if the account is deployed, false otherwise
56
37
  */
57
38
  function isDeployed(chain) {
58
- return (0, accounts_1.isDeployed)(config, chain);
39
+ return isDeployedInternal(config, chain);
59
40
  }
60
41
  /**
61
42
  * Sets up the existing account on a given chain
@@ -63,19 +44,19 @@ async function createRhinestoneAccount(config) {
63
44
  * @param chain Chain to set up the account on
64
45
  */
65
46
  function setup(chain) {
66
- return (0, accounts_1.setup)(config, chain);
47
+ return setupInternal(config, chain);
67
48
  }
68
49
  /**
69
50
  * Get the account initialization data. Used for deploying the account onchain.
70
51
  * @returns factory address and factory data
71
52
  */
72
53
  function getInitData() {
73
- const initData = (0, accounts_1.getInitCode)(config);
54
+ const initData = getInitCode(config);
74
55
  if (!initData) {
75
- throw new accounts_1.FactoryArgsNotAvailableError();
56
+ throw new FactoryArgsNotAvailableError();
76
57
  }
77
58
  if (!('factory' in initData)) {
78
- throw new accounts_1.FactoryArgsNotAvailableError();
59
+ throw new FactoryArgsNotAvailableError();
79
60
  }
80
61
  return {
81
62
  factory: initData.factory,
@@ -87,7 +68,7 @@ async function createRhinestoneAccount(config) {
87
68
  * @returns init data signature
88
69
  */
89
70
  function signEip7702InitData() {
90
- return (0, accounts_1.signEip7702InitData)(config);
71
+ return signEip7702InitDataInternal(config);
91
72
  }
92
73
  /**
93
74
  * Prepare a transaction data
@@ -95,7 +76,7 @@ async function createRhinestoneAccount(config) {
95
76
  * @returns prepared transaction data
96
77
  */
97
78
  function prepareTransaction(transaction) {
98
- return (0, utils_1.prepareTransaction)(config, transaction);
79
+ return prepareTransactionInternal(config, transaction);
99
80
  }
100
81
  /**
101
82
  * Get the transaction typed data message to sign
@@ -103,7 +84,7 @@ async function createRhinestoneAccount(config) {
103
84
  * @see {@link prepareTransaction} to prepare the transaction data for signing
104
85
  */
105
86
  function getTransactionMessages(preparedTransaction) {
106
- return (0, utils_1.getTransactionMessages)(config, preparedTransaction);
87
+ return getTransactionMessagesInternal(config, preparedTransaction);
107
88
  }
108
89
  /**
109
90
  * Sign a transaction
@@ -112,7 +93,7 @@ async function createRhinestoneAccount(config) {
112
93
  * @see {@link prepareTransaction} to prepare the transaction data for signing
113
94
  */
114
95
  function signTransaction(preparedTransaction) {
115
- return (0, utils_1.signTransaction)(config, preparedTransaction);
96
+ return signTransactionInternal(config, preparedTransaction);
116
97
  }
117
98
  /**
118
99
  * Sign the required EIP-7702 authorizations for a transaction
@@ -121,7 +102,7 @@ async function createRhinestoneAccount(config) {
121
102
  * @see {@link prepareTransaction} to prepare the transaction data for signing
122
103
  */
123
104
  function signAuthorizations(preparedTransaction) {
124
- return (0, utils_1.signAuthorizations)(config, preparedTransaction);
105
+ return signAuthorizationsInternal(config, preparedTransaction);
125
106
  }
126
107
  /**
127
108
  * Sign a message (EIP-191)
@@ -131,7 +112,7 @@ async function createRhinestoneAccount(config) {
131
112
  * @returns signature
132
113
  */
133
114
  function signMessage(message, chain, signers) {
134
- return (0, utils_1.signMessage)(config, message, chain, signers);
115
+ return signMessageInternal(config, message, chain, signers);
135
116
  }
136
117
  /**
137
118
  * Sign a typed data (EIP-712)
@@ -141,7 +122,7 @@ async function createRhinestoneAccount(config) {
141
122
  * @returns signature
142
123
  */
143
124
  function signTypedData(parameters, chain, signers) {
144
- return (0, utils_1.signTypedData)(config, parameters, chain, signers);
125
+ return signTypedDataInternal(config, parameters, chain, signers);
145
126
  }
146
127
  /**
147
128
  * Submit a transaction
@@ -153,7 +134,7 @@ async function createRhinestoneAccount(config) {
153
134
  * @see {@link dryRun} true when intent is not executed onchain (internal use only)
154
135
  */
155
136
  function submitTransaction(signedTransaction, authorizations, dryRun) {
156
- return (0, utils_1.submitTransaction)(config, signedTransaction, authorizations ?? [], dryRun);
137
+ return submitTransactionInternal(config, signedTransaction, authorizations ?? [], dryRun);
157
138
  }
158
139
  /**
159
140
  * Prepare a user operation data
@@ -161,7 +142,7 @@ async function createRhinestoneAccount(config) {
161
142
  * @returns prepared user operation data
162
143
  */
163
144
  function prepareUserOperation(transaction) {
164
- return (0, utils_1.prepareUserOperation)(config, transaction);
145
+ return prepareUserOperationInternal(config, transaction);
165
146
  }
166
147
  /**
167
148
  * Sign a user operation
@@ -170,7 +151,7 @@ async function createRhinestoneAccount(config) {
170
151
  * @see {@link prepareUserOperation} to prepare the user operation data for signing
171
152
  */
172
153
  function signUserOperation(preparedUserOperation) {
173
- return (0, utils_1.signUserOperation)(config, preparedUserOperation);
154
+ return signUserOperationInternal(config, preparedUserOperation);
174
155
  }
175
156
  /**
176
157
  * Submit a transaction
@@ -179,7 +160,7 @@ async function createRhinestoneAccount(config) {
179
160
  * @see {@link signUserOperation} to sign the user operation data
180
161
  */
181
162
  function submitUserOperation(signedUserOperation) {
182
- return (0, utils_1.submitUserOperation)(config, signedUserOperation);
163
+ return submitUserOperationInternal(config, signedUserOperation);
183
164
  }
184
165
  /**
185
166
  * Sign and send a transaction
@@ -187,7 +168,7 @@ async function createRhinestoneAccount(config) {
187
168
  * @returns transaction result object (an intent ID)
188
169
  */
189
170
  function sendTransaction(transaction) {
190
- return (0, execution_1.sendTransaction)(config, transaction);
171
+ return sendTransactionInternal(config, transaction);
191
172
  }
192
173
  /**
193
174
  * Sign and send a user operation
@@ -195,17 +176,17 @@ async function createRhinestoneAccount(config) {
195
176
  * @returns user operation result object (a UserOp hash)
196
177
  */
197
178
  function sendUserOperation(transaction) {
198
- return (0, execution_1.sendUserOperation)(config, transaction);
179
+ return sendUserOperationInternal(config, transaction);
199
180
  }
200
181
  function waitForExecution(result, acceptsPreconfirmations = true) {
201
- return (0, execution_1.waitForExecution)(config, result, acceptsPreconfirmations);
182
+ return waitForExecutionInternal(config, result, acceptsPreconfirmations);
202
183
  }
203
184
  /**
204
185
  * Get account address
205
186
  * @returns Address of the smart account
206
187
  */
207
188
  function getAddress() {
208
- return (0, accounts_1.getAddress)(config);
189
+ return getAddressInternal(config);
209
190
  }
210
191
  /**
211
192
  * Get account portfolio
@@ -213,7 +194,7 @@ async function createRhinestoneAccount(config) {
213
194
  * @returns Account balances
214
195
  */
215
196
  function getPortfolio(onTestnets = false) {
216
- return (0, execution_1.getPortfolio)(config, onTestnets);
197
+ return getPortfolioInternal(config, onTestnets);
217
198
  }
218
199
  /**
219
200
  * Get account owners (ECDSA)
@@ -222,7 +203,7 @@ async function createRhinestoneAccount(config) {
222
203
  */
223
204
  function getOwners(chain) {
224
205
  const account = getAddress();
225
- return (0, modules_1.getOwners)(account, chain, config.provider);
206
+ return getOwnersInternal(account, chain, config.provider);
226
207
  }
227
208
  /**
228
209
  * Get account validator modules
@@ -230,25 +211,25 @@ async function createRhinestoneAccount(config) {
230
211
  * @returns List of account validators
231
212
  */
232
213
  function getValidators(chain) {
233
- const accountType = (0, accounts_1.getAccountProvider)(config).type;
214
+ const accountType = getAccountProvider(config).type;
234
215
  const account = getAddress();
235
- return (0, modules_1.getValidators)(accountType, account, chain, config.provider);
216
+ return getValidatorsInternal(accountType, account, chain, config.provider);
236
217
  }
237
218
  function getExecutors(chain) {
238
- const accountType = (0, accounts_1.getAccountProvider)(config).type;
219
+ const accountType = getAccountProvider(config).type;
239
220
  const account = getAddress();
240
- return (0, modules_1.getExecutors)(accountType, account, chain, config.provider);
221
+ return getExecutorsInternal(accountType, account, chain, config.provider);
241
222
  }
242
223
  function experimental_getSessionDetails(sessions) {
243
224
  const account = getAddress();
244
- return (0, modules_1.getSessionDetails)(account, sessions, config.provider, config.useDevContracts);
225
+ return getSessionDetailsInternal(account, sessions, config.provider, config.useDevContracts);
245
226
  }
246
227
  function experimental_isSessionEnabled(session) {
247
228
  const account = getAddress();
248
- return (0, smart_sessions_1.isSessionEnabled)(account, config.provider, session, config.useDevContracts);
229
+ return isSessionEnabledInternal(account, config.provider, session, config.useDevContracts);
249
230
  }
250
231
  function experimental_signEnableSession(details) {
251
- return (0, modules_1.signEnableSession)(config, details);
232
+ return signEnableSessionInternal(config, details);
252
233
  }
253
234
  /**
254
235
  * Check ERC20 allowance for the account owner and token (using Permit2 as spender)
@@ -260,7 +241,7 @@ async function createRhinestoneAccount(config) {
260
241
  if (!config.provider) {
261
242
  throw new Error('Provider configuration is required');
262
243
  }
263
- return (0, permit2_1.checkERC20Allowance)(tokenAddress, chain, config);
244
+ return checkERC20AllowanceInternal(tokenAddress, chain, config);
264
245
  }
265
246
  return {
266
247
  config,
@@ -302,7 +283,7 @@ class RhinestoneSDK {
302
283
  useDevContracts;
303
284
  headers;
304
285
  constructor(options) {
305
- this.authProvider = (0, provider_1.createAuthProvider)(options);
286
+ this.authProvider = createAuthProvider(options);
306
287
  this.endpointUrl = options.endpointUrl;
307
288
  this.provider = options.provider;
308
289
  this.bundler = options.bundler;
@@ -324,10 +305,18 @@ class RhinestoneSDK {
324
305
  return createRhinestoneAccount(rhinestoneConfig);
325
306
  }
326
307
  getIntentStatus(intentId) {
327
- return (0, execution_1.getIntentStatus)(this.authProvider, this.endpointUrl, intentId, this.headers);
308
+ return getIntentStatusInternal(this.authProvider, this.endpointUrl, intentId, this.headers);
328
309
  }
329
310
  splitIntents(input) {
330
- return (0, execution_1.splitIntents)(this.authProvider, this.endpointUrl, input, this.headers);
311
+ return splitIntentsInternal(this.authProvider, this.endpointUrl, input, this.headers);
331
312
  }
332
313
  }
333
- exports.RhinestoneSDK = RhinestoneSDK;
314
+ export { RhinestoneSDK, createRhinestoneAccount, deployAccountsForOwners, walletClientToAccount, wrapParaAccount,
315
+ // Validator addresses
316
+ OWNABLE_VALIDATOR_ADDRESS, WEBAUTHN_VALIDATOR_ADDRESS, MULTI_FACTOR_VALIDATOR_ADDRESS, SMART_SESSION_EMISSARY_ADDRESS,
317
+ // Registry functions
318
+ getSupportedTokens, getTokenAddress, getTokenDecimals, getAllSupportedChainsAndTokens,
319
+ // Permit2 helpers
320
+ checkERC20AllowanceDirect, getPermit2Address,
321
+ // Multi-chain permit2 signing
322
+ signPermit2Batch, signPermit2Sequential, };
@@ -1,7 +1,4 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.computeIntentInputDigest = computeIntentInputDigest;
4
- const jcs_1 = require("./jcs");
1
+ import { jcsCanonicalise } from './jcs.js';
5
2
  /**
6
3
  * Compute a deterministic hex-encoded SHA-256 digest of an intent input object.
7
4
  *
@@ -11,8 +8,8 @@ const jcs_1 = require("./jcs");
11
8
  *
12
9
  * Uses the Web Crypto API (available in Node.js ≥ 15 and all modern browsers).
13
10
  */
14
- async function computeIntentInputDigest(intentInput) {
15
- const canonical = (0, jcs_1.jcsCanonicalise)(intentInput);
11
+ export async function computeIntentInputDigest(intentInput) {
12
+ const canonical = jcsCanonicalise(intentInput);
16
13
  const encoded = new TextEncoder().encode(canonical);
17
14
  const hashBuffer = await crypto.subtle.digest('SHA-256', encoded);
18
15
  const hashArray = new Uint8Array(hashBuffer);
@@ -1,4 +1,4 @@
1
- import { type JwtHandlerConfig } from './handlers';
1
+ import { type JwtHandlerConfig } from './handlers.js';
2
2
  interface ExpressRequest {
3
3
  body?: unknown;
4
4
  }
@@ -1 +1 @@
1
- {"version":3,"file":"express.d.ts","sourceRoot":"","sources":["../../../jwt-server/express.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,gBAAgB,EACtB,MAAM,YAAY,CAAA;AAEnB,UAAU,cAAc;IACtB,IAAI,CAAC,EAAE,OAAO,CAAA;CACf;AAED,UAAU,eAAe;IACvB,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,eAAe,CAAA;IACrC,IAAI,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,CAAA;CAC1B;AAED,KAAK,cAAc,GAAG,CAAC,GAAG,EAAE,cAAc,EAAE,GAAG,EAAE,eAAe,KAAK,IAAI,CAAA;AAEzE,UAAU,aAAa;IACrB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,cAAc,GAAG,aAAa,CAAA;IACzD,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,cAAc,GAAG,aAAa,CAAA;CAC3D;AAED,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,gBAAgB,GAAG,aAAa,CAyB3E"}
1
+ {"version":3,"file":"express.d.ts","sourceRoot":"","sources":["../../../jwt-server/express.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,KAAK,gBAAgB,EACtB,MAAM,YAAY,CAAA;AAInB,UAAU,cAAc;IACtB,IAAI,CAAC,EAAE,OAAO,CAAA;CACf;AAED,UAAU,eAAe;IACvB,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,eAAe,CAAA;IACrC,IAAI,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,CAAA;CAC1B;AAED,KAAK,cAAc,GAAG,CAAC,GAAG,EAAE,cAAc,EAAE,GAAG,EAAE,eAAe,KAAK,IAAI,CAAA;AAEzE,UAAU,aAAa;IACrB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,cAAc,GAAG,aAAa,CAAA;IACzD,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,cAAc,GAAG,aAAa,CAAA;CAC3D;AAED,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,gBAAgB,GAAG,aAAa,CAyB3E"}
@@ -1,15 +1,14 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createExpressRouter = createExpressRouter;
4
- const handlers_1 = require("./handlers");
5
- function createExpressRouter(config) {
1
+ import { createRequire } from 'node:module';
2
+ import { createCoreAccessTokenHandler, createCoreExtensionTokenHandler, } from './handlers.js';
3
+ const require = createRequire(import.meta.url);
4
+ export function createExpressRouter(config) {
6
5
  // Dynamic import avoidance: we type the router interface manually
7
6
  // so express doesn't need to be installed unless this function is called.
8
7
  // eslint-disable-next-line @typescript-eslint/no-require-imports
9
8
  const { Router } = require('express');
10
9
  const router = Router();
11
- const handleAccessToken = (0, handlers_1.createCoreAccessTokenHandler)(config);
12
- const handleExtensionToken = (0, handlers_1.createCoreExtensionTokenHandler)(config);
10
+ const handleAccessToken = createCoreAccessTokenHandler(config);
11
+ const handleExtensionToken = createCoreExtensionTokenHandler(config);
13
12
  router.get('/access-token', async (_req, res) => {
14
13
  const result = await handleAccessToken();
15
14
  res.status(result.status).json(result.body);
@@ -1,4 +1,4 @@
1
- import { type JwtSignerConfig } from './signer';
1
+ import { type JwtSignerConfig } from './signer.js';
2
2
  export type JwtHandlerConfig = JwtSignerConfig;
3
3
  interface HandlerResult {
4
4
  status: number;
@@ -1,11 +1,7 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createCoreAccessTokenHandler = createCoreAccessTokenHandler;
4
- exports.createCoreExtensionTokenHandler = createCoreExtensionTokenHandler;
5
- const signer_1 = require("./signer");
6
- const sponsorship_1 = require("./sponsorship");
7
- function createCoreAccessTokenHandler(config) {
8
- const signer = (0, signer_1.createJwtSigner)(config);
1
+ import { createJwtSigner } from './signer.js';
2
+ import { SponsorshipDeniedError } from './sponsorship.js';
3
+ export function createCoreAccessTokenHandler(config) {
4
+ const signer = createJwtSigner(config);
9
5
  return async () => {
10
6
  try {
11
7
  const token = await signer.accessToken();
@@ -17,8 +13,8 @@ function createCoreAccessTokenHandler(config) {
17
13
  }
18
14
  };
19
15
  }
20
- function createCoreExtensionTokenHandler(config) {
21
- const signer = (0, signer_1.createJwtSigner)(config);
16
+ export function createCoreExtensionTokenHandler(config) {
17
+ const signer = createJwtSigner(config);
22
18
  return async (intentInput) => {
23
19
  if (intentInput === undefined || intentInput === null) {
24
20
  return {
@@ -31,7 +27,7 @@ function createCoreExtensionTokenHandler(config) {
31
27
  return { status: 200, body: { token } };
32
28
  }
33
29
  catch (error) {
34
- if (error instanceof sponsorship_1.SponsorshipDeniedError) {
30
+ if (error instanceof SponsorshipDeniedError) {
35
31
  return { status: 403, body: { error: error.message } };
36
32
  }
37
33
  const message = error instanceof Error ? error.message : 'Internal server error';
@@ -1,8 +1,8 @@
1
- export { computeIntentInputDigest } from './digest';
2
- export { createExpressRouter } from './express';
3
- export type { JwtHandlerConfig } from './handlers';
4
- export { jcsCanonicalise } from './jcs';
5
- export { createJwtSigner, type JwtCredentials, type JwtSignerConfig, } from './signer';
6
- export { SponsorshipDeniedError, type SponsorshipFilter, shouldSponsor, } from './sponsorship';
7
- export { createAccessTokenHandler, createExtensionTokenHandler, } from './web';
1
+ export { computeIntentInputDigest } from './digest.js';
2
+ export { createExpressRouter } from './express.js';
3
+ export type { JwtHandlerConfig } from './handlers.js';
4
+ export { jcsCanonicalise } from './jcs.js';
5
+ export { createJwtSigner, type JwtCredentials, type JwtSignerConfig, } from './signer.js';
6
+ export { SponsorshipDeniedError, type SponsorshipFilter, shouldSponsor, } from './sponsorship.js';
7
+ export { createAccessTokenHandler, createExtensionTokenHandler, } from './web.js';
8
8
  //# sourceMappingURL=index.d.ts.map
@@ -1,18 +1,7 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createExtensionTokenHandler = exports.createAccessTokenHandler = exports.shouldSponsor = exports.SponsorshipDeniedError = exports.createJwtSigner = exports.jcsCanonicalise = exports.createExpressRouter = exports.computeIntentInputDigest = void 0;
4
1
  // biome-ignore lint/performance/noBarrelFile: subpath entry point for @rhinestone/sdk/jwt-server
5
- var digest_1 = require("./digest");
6
- Object.defineProperty(exports, "computeIntentInputDigest", { enumerable: true, get: function () { return digest_1.computeIntentInputDigest; } });
7
- var express_1 = require("./express");
8
- Object.defineProperty(exports, "createExpressRouter", { enumerable: true, get: function () { return express_1.createExpressRouter; } });
9
- var jcs_1 = require("./jcs");
10
- Object.defineProperty(exports, "jcsCanonicalise", { enumerable: true, get: function () { return jcs_1.jcsCanonicalise; } });
11
- var signer_1 = require("./signer");
12
- Object.defineProperty(exports, "createJwtSigner", { enumerable: true, get: function () { return signer_1.createJwtSigner; } });
13
- var sponsorship_1 = require("./sponsorship");
14
- Object.defineProperty(exports, "SponsorshipDeniedError", { enumerable: true, get: function () { return sponsorship_1.SponsorshipDeniedError; } });
15
- Object.defineProperty(exports, "shouldSponsor", { enumerable: true, get: function () { return sponsorship_1.shouldSponsor; } });
16
- var web_1 = require("./web");
17
- Object.defineProperty(exports, "createAccessTokenHandler", { enumerable: true, get: function () { return web_1.createAccessTokenHandler; } });
18
- Object.defineProperty(exports, "createExtensionTokenHandler", { enumerable: true, get: function () { return web_1.createExtensionTokenHandler; } });
2
+ export { computeIntentInputDigest } from './digest.js';
3
+ export { createExpressRouter } from './express.js';
4
+ export { jcsCanonicalise } from './jcs.js';
5
+ export { createJwtSigner, } from './signer.js';
6
+ export { SponsorshipDeniedError, shouldSponsor, } from './sponsorship.js';
7
+ export { createAccessTokenHandler, createExtensionTokenHandler, } from './web.js';
@@ -1,4 +1,3 @@
1
- "use strict";
2
1
  /**
3
2
  * RFC 8785 JSON Canonicalization Scheme (JCS).
4
3
  *
@@ -9,9 +8,7 @@
9
8
  *
10
9
  * Reference: https://www.rfc-editor.org/rfc/rfc8785
11
10
  */
12
- Object.defineProperty(exports, "__esModule", { value: true });
13
- exports.jcsCanonicalise = jcsCanonicalise;
14
- function jcsCanonicalise(value) {
11
+ export function jcsCanonicalise(value) {
15
12
  return serialize(value);
16
13
  }
17
14
  function serialize(value) {
@@ -1,4 +1,4 @@
1
- import { type SponsorshipFilter } from './sponsorship';
1
+ import { type SponsorshipFilter } from './sponsorship.js';
2
2
  export interface JwtCredentials {
3
3
  privateKey: JsonWebKey;
4
4
  integratorId: string;
@@ -1,9 +1,6 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createJwtSigner = createJwtSigner;
4
- const jose_1 = require("jose");
5
- const digest_1 = require("./digest");
6
- const sponsorship_1 = require("./sponsorship");
1
+ import { importJWK, SignJWT } from 'jose';
2
+ import { computeIntentInputDigest } from './digest.js';
3
+ import { shouldSponsor as checkSponsor, SponsorshipDeniedError, } from './sponsorship.js';
7
4
  function pickAlg(jwk) {
8
5
  if (jwk.kty === 'EC') {
9
6
  if (jwk.crv === 'P-256')
@@ -18,19 +15,19 @@ function pickAlg(jwk) {
18
15
  return 'RS256';
19
16
  throw new Error(`Unsupported JWK kty: ${jwk.kty}`);
20
17
  }
21
- function createJwtSigner(config) {
18
+ export function createJwtSigner(config) {
22
19
  const { jwt: { privateKey, integratorId, projectId, appId, keyId, audience = 'rhinestone-api', }, shouldSponsor: filters, } = config;
23
20
  const alg = pickAlg(privateKey);
24
21
  let cachedKey = null;
25
22
  async function getKey() {
26
23
  if (!cachedKey) {
27
- cachedKey = (await (0, jose_1.importJWK)(privateKey, alg));
24
+ cachedKey = (await importJWK(privateKey, alg));
28
25
  }
29
26
  return cachedKey;
30
27
  }
31
28
  async function accessToken() {
32
29
  const key = await getKey();
33
- return new jose_1.SignJWT({ typ: 'access', app_id: appId })
30
+ return new SignJWT({ typ: 'access', app_id: appId })
34
31
  .setProtectedHeader({ alg, kid: keyId })
35
32
  .setIssuer(integratorId)
36
33
  .setSubject(projectId)
@@ -41,14 +38,14 @@ function createJwtSigner(config) {
41
38
  }
42
39
  async function getIntentExtensionToken(intentInput) {
43
40
  if (filters) {
44
- const allowed = await (0, sponsorship_1.shouldSponsor)(intentInput, filters);
41
+ const allowed = await checkSponsor(intentInput, filters);
45
42
  if (!allowed) {
46
- throw new sponsorship_1.SponsorshipDeniedError();
43
+ throw new SponsorshipDeniedError();
47
44
  }
48
45
  }
49
46
  const key = await getKey();
50
- const digest = await (0, digest_1.computeIntentInputDigest)(intentInput);
51
- return new jose_1.SignJWT({
47
+ const digest = await computeIntentInputDigest(intentInput);
48
+ return new SignJWT({
52
49
  typ: 'intent_extension',
53
50
  app_id: appId,
54
51
  jti: crypto.randomUUID(),
@@ -1,14 +1,9 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SponsorshipDeniedError = void 0;
4
- exports.shouldSponsor = shouldSponsor;
5
- class SponsorshipDeniedError extends Error {
1
+ export class SponsorshipDeniedError extends Error {
6
2
  constructor() {
7
3
  super('Sponsorship denied');
8
4
  this.name = 'SponsorshipDeniedError';
9
5
  }
10
6
  }
11
- exports.SponsorshipDeniedError = SponsorshipDeniedError;
12
7
  function parseIntentInput(intentInput) {
13
8
  if (typeof intentInput !== 'object' || intentInput === null) {
14
9
  throw new Error('intentInput must be a non-null object');
@@ -41,7 +36,7 @@ function parseIntentInput(intentInput) {
41
36
  calls,
42
37
  };
43
38
  }
44
- async function shouldSponsor(intentInput, filters) {
39
+ export async function shouldSponsor(intentInput, filters) {
45
40
  const parsed = parseIntentInput(intentInput);
46
41
  if (filters.chain && !(await filters.chain(parsed.chain))) {
47
42
  return false;
@@ -1,4 +1,4 @@
1
- import { type JwtHandlerConfig } from './handlers';
1
+ import { type JwtHandlerConfig } from './handlers.js';
2
2
  export declare function createAccessTokenHandler(config: JwtHandlerConfig): (req: Request) => Promise<Response>;
3
3
  export declare function createExtensionTokenHandler(config: JwtHandlerConfig): (req: Request) => Promise<Response>;
4
4
  //# sourceMappingURL=web.d.ts.map
@@ -1,17 +1,13 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createAccessTokenHandler = createAccessTokenHandler;
4
- exports.createExtensionTokenHandler = createExtensionTokenHandler;
5
- const handlers_1 = require("./handlers");
6
- function createAccessTokenHandler(config) {
7
- const handle = (0, handlers_1.createCoreAccessTokenHandler)(config);
1
+ import { createCoreAccessTokenHandler, createCoreExtensionTokenHandler, } from './handlers.js';
2
+ export function createAccessTokenHandler(config) {
3
+ const handle = createCoreAccessTokenHandler(config);
8
4
  return async () => {
9
5
  const result = await handle();
10
6
  return Response.json(result.body, { status: result.status });
11
7
  };
12
8
  }
13
- function createExtensionTokenHandler(config) {
14
- const handle = (0, handlers_1.createCoreExtensionTokenHandler)(config);
9
+ export function createExtensionTokenHandler(config) {
10
+ const handle = createCoreExtensionTokenHandler(config);
15
11
  return async (req) => {
16
12
  let intentInput;
17
13
  try {
@@ -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
- exports.default = abi;
563
+ export default abi;