@rhinestone/sdk 2.9.0 → 2.10.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/dist/src/api/account.d.ts +2 -2
- package/dist/src/api/account.d.ts.map +1 -1
- package/dist/src/api/account.js +11 -2
- package/dist/src/api/compose.d.ts.map +1 -1
- package/dist/src/api/compose.js +3 -4
- package/dist/src/api/sdk.d.ts +1 -0
- package/dist/src/api/sdk.d.ts.map +1 -1
- package/dist/src/api/sdk.js +2 -0
- package/dist/src/clients/orchestrator/client.js +1 -1
- package/dist/src/clients/orchestrator/mappers.d.ts.map +1 -1
- package/dist/src/clients/orchestrator/mappers.js +6 -0
- package/dist/src/clients/orchestrator/public.d.ts +147 -1
- package/dist/src/clients/orchestrator/public.d.ts.map +1 -1
- package/dist/src/clients/orchestrator/types.d.ts +5 -1
- package/dist/src/clients/orchestrator/types.d.ts.map +1 -1
- package/dist/src/clients/orchestrator/wire.gen.d.ts +416 -44
- package/dist/src/clients/orchestrator/wire.gen.d.ts.map +1 -1
- package/dist/src/config/account.d.ts +19 -1
- package/dist/src/config/account.d.ts.map +1 -1
- package/dist/src/config/input.d.ts +2 -0
- package/dist/src/config/input.d.ts.map +1 -1
- package/dist/src/config/legacy.d.ts +2 -0
- package/dist/src/config/legacy.d.ts.map +1 -1
- package/dist/src/config/legacy.js +2 -0
- package/dist/src/config/resolve.d.ts.map +1 -1
- package/dist/src/config/resolve.js +4 -0
- package/dist/src/config/resolved.d.ts +2 -0
- package/dist/src/config/resolved.d.ts.map +1 -1
- package/dist/src/errors/index.d.ts +2 -1
- package/dist/src/errors/index.d.ts.map +1 -1
- package/dist/src/errors/index.js +4 -1
- package/dist/src/hypercore/errors.d.ts +37 -0
- package/dist/src/hypercore/errors.d.ts.map +1 -0
- package/dist/src/hypercore/errors.js +54 -0
- package/dist/src/hypercore/index.d.ts +4 -0
- package/dist/src/hypercore/index.d.ts.map +1 -0
- package/dist/src/hypercore/index.js +2 -0
- package/dist/src/hypercore/market.d.ts +110 -0
- package/dist/src/hypercore/market.d.ts.map +1 -0
- package/dist/src/hypercore/market.js +120 -0
- package/dist/src/hypercore/orders.d.ts +26 -0
- package/dist/src/hypercore/orders.d.ts.map +1 -0
- package/dist/src/hypercore/orders.js +148 -0
- package/dist/src/hypercore/resolve.d.ts +10 -0
- package/dist/src/hypercore/resolve.d.ts.map +1 -0
- package/dist/src/hypercore/resolve.js +30 -0
- package/dist/src/hypercore/types.d.ts +80 -0
- package/dist/src/hypercore/types.d.ts.map +1 -0
- package/dist/src/hypercore/types.js +8 -0
- package/dist/src/index.d.ts +2 -2
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/signing/typed-data.d.ts +6 -0
- package/dist/src/signing/typed-data.d.ts.map +1 -1
- package/dist/src/signing/typed-data.js +13 -0
- package/dist/src/transactions/intents/origin-chain.d.ts +35 -0
- package/dist/src/transactions/intents/origin-chain.d.ts.map +1 -0
- package/dist/src/transactions/intents/origin-chain.js +89 -0
- package/dist/src/transactions/intents/prepare.d.ts.map +1 -1
- package/dist/src/transactions/intents/prepare.js +2 -1
- package/dist/src/transactions/intents/session-signing.d.ts.map +1 -1
- package/dist/src/transactions/intents/session-signing.js +8 -0
- package/dist/src/transactions/intents/sign-transaction.d.ts.map +1 -1
- package/dist/src/transactions/intents/sign-transaction.js +9 -1
- package/package.json +5 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prepare.d.ts","sourceRoot":"","sources":["../../../../transactions/intents/prepare.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAA;AAQ5D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAA;AAI3D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAA;
|
|
1
|
+
{"version":3,"file":"prepare.d.ts","sourceRoot":"","sources":["../../../../transactions/intents/prepare.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAA;AAQ5D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAA;AAI3D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAA;AAQ1E,OAAO,KAAK,EACV,WAAW,EACX,qBAAqB,EACrB,cAAc,EACf,MAAM,SAAS,CAAA;AAEhB,wBAAsB,aAAa,CAAC,mBAAmB,EACrD,OAAO,EAAE,qBAAqB,CAAC,mBAAmB,CAAC,EACnD,KAAK,EAAE,WAAW,CAAC,mBAAmB,CAAC,GACtC,OAAO,CAAC,cAAc,CAAC,mBAAmB,CAAC,CAAC,CA2D9C;AA8FD,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,cAAc,EACvB,KAAK,EAAE,cAAc,CAAC,OAAO,CAAC,EAC9B,QAAQ,CAAC,EAAE,cAAc,CAAC,kBAAkB,CAAC,EAC7C,WAAW,CAAC,EAAE,iBAAiB,EAC/B,cAAc,CAAC,EAAE,OAAO,gCAAgC,EAAE,2BAA2B,EACrF,iBAAiB,CAAC,EAAE,SAAS,MAAM,EAAE,GACpC,kBAAkB,CA2IpB"}
|
|
@@ -6,6 +6,7 @@ import { ecdsaSignerId } from '../../modules/validators/signer-id.js';
|
|
|
6
6
|
import { signingTopology } from '../../signing/plan.js';
|
|
7
7
|
import { projectIntentAccount } from './account.js';
|
|
8
8
|
import { normalizeIntentQuote } from './normalize.js';
|
|
9
|
+
import { originChainId } from './origin-chain.js';
|
|
9
10
|
import { selectIntentQuote } from './quotes.js';
|
|
10
11
|
import { buildIntentRequest } from './request.js';
|
|
11
12
|
import { prepareIntentSessions } from './sessions.js';
|
|
@@ -146,7 +147,7 @@ export function buildIntentSigningInput(runtime, quote, sessions, destination, o
|
|
|
146
147
|
};
|
|
147
148
|
const origins = quote.signData.origin.map((typedData, index) => ({
|
|
148
149
|
id: hashTypedData(typedData),
|
|
149
|
-
chain: toEvmChainReference(
|
|
150
|
+
chain: toEvmChainReference(originChainId(typedData)),
|
|
150
151
|
role: 'origin',
|
|
151
152
|
typedData,
|
|
152
153
|
usage: 'intent-origin',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session-signing.d.ts","sourceRoot":"","sources":["../../../../transactions/intents/session-signing.ts"],"names":[],"mappings":"AA+BA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AAE3D,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,kCAAkC,CAAA;AAOtF,OAAO,KAAK,EAEV,oBAAoB,EAGrB,MAAM,qBAAqB,CAAA;
|
|
1
|
+
{"version":3,"file":"session-signing.d.ts","sourceRoot":"","sources":["../../../../transactions/intents/session-signing.ts"],"names":[],"mappings":"AA+BA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AAE3D,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,kCAAkC,CAAA;AAOtF,OAAO,KAAK,EAEV,oBAAoB,EAGrB,MAAM,qBAAqB,CAAA;AAE5B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAE7C,wBAAgB,gCAAgC,CAAC,mBAAmB,EAClE,QAAQ,EAAE,cAAc,CAAC,mBAAmB,CAAC,EAC7C,QAAQ,EAAE,oBAAoB,GAC7B,oBAAoB,CA+BtB;AAED,wBAAgB,2BAA2B,CAAC,mBAAmB,EAC7D,QAAQ,EAAE,cAAc,CAAC,mBAAmB,CAAC,EAC7C,OAAO,EAAE,cAAc,GACtB,8BAA8B,CAoGhC"}
|
|
@@ -11,6 +11,7 @@ import { webauthnStatelessCodecContext } from '../../modules/validators/webauthn
|
|
|
11
11
|
import { getAccountSignatureEnvelope } from '../../signing/context.js';
|
|
12
12
|
import { createValidatorSigningTasks, signingTopology, } from '../../signing/plan.js';
|
|
13
13
|
import { createSignerInvocationPort } from '../../signing/signers/registry.js';
|
|
14
|
+
import { signatureSpansMultipleChains } from './origin-chain.js';
|
|
14
15
|
export function createIntentSessionSignerInvoker(prepared, fallback) {
|
|
15
16
|
const signers = {};
|
|
16
17
|
for (const resolved of Object.values(prepared.resolvedSessions ?? {})) {
|
|
@@ -40,6 +41,13 @@ export function buildSessionIntentPlanInput(prepared, context) {
|
|
|
40
41
|
const payloads = {};
|
|
41
42
|
const stages = [];
|
|
42
43
|
for (const [index, origin] of prepared.signing.origins.entries()) {
|
|
44
|
+
// A smart session is enabled per chain and its signature carries that
|
|
45
|
+
// session's identity, so one signature cannot stand for legs on other
|
|
46
|
+
// chains. Refuse while preparing rather than sign a bundle whose later legs
|
|
47
|
+
// cannot execute.
|
|
48
|
+
if (signatureSpansMultipleChains(origin.typedData)) {
|
|
49
|
+
throw new Error('Cannot sign a chain-agnostic intent payload with a smart session: a session is enabled per chain, so the signature would validate only on the leg it was resolved against');
|
|
50
|
+
}
|
|
43
51
|
const session = requireSession(prepared, origin.chain.id);
|
|
44
52
|
stages.push(buildSessionStage({
|
|
45
53
|
id: `origin-${index}`,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sign-transaction.d.ts","sourceRoot":"","sources":["../../../../transactions/intents/sign-transaction.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,MAAM,CAAA;AAoB/B,OAAO,EAGL,KAAK,yBAAyB,EAC/B,MAAM,wCAAwC,CAAA;
|
|
1
|
+
{"version":3,"file":"sign-transaction.d.ts","sourceRoot":"","sources":["../../../../transactions/intents/sign-transaction.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,MAAM,CAAA;AAoB/B,OAAO,EAGL,KAAK,yBAAyB,EAC/B,MAAM,wCAAwC,CAAA;AA4B/C,OAAO,KAAK,EACV,qBAAqB,EACrB,cAAc,EACd,YAAY,EACb,MAAM,SAAS,CAAA;AAEhB,wBAAsB,UAAU,CAAC,mBAAmB,EAClD,OAAO,EAAE,qBAAqB,CAAC,mBAAmB,CAAC,EACnD,QAAQ,EAAE,cAAc,CAAC,mBAAmB,CAAC,GAC5C,OAAO,CAAC,YAAY,CAAC,mBAAmB,CAAC,CAAC,CAsC5C;AAED,wBAAsB,iBAAiB,CAAC,mBAAmB,EACzD,OAAO,EAAE,qBAAqB,CAAC,mBAAmB,CAAC,EACnD,QAAQ,EAAE,cAAc,CAAC,mBAAmB,CAAC,EAC7C,SAAS,EAAE;IACT,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;IACzB,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG,GAAG,CAAA;CACpC,GACA,OAAO,CAAC,yBAAyB,CAAC,CA2EpC;AAED,wBAAsB,cAAc,CAAC,mBAAmB,EACtD,OAAO,EAAE,qBAAqB,CAAC,mBAAmB,CAAC,EACnD,QAAQ,EAAE,cAAc,CAAC,mBAAmB,CAAC,EAC7C,UAAU,EAAE,SAAS,yBAAyB,EAAE,GAC/C,OAAO,CAAC,YAAY,CAAC,mBAAmB,CAAC,CAAC,CAsD5C"}
|
|
@@ -8,6 +8,7 @@ import { assembleIndependentIntentArtifact, } from '../../signing/intent-plans/i
|
|
|
8
8
|
import { createIntentSigningPlan, executeIntentSigning, projectIndependentSigning, } from '../../signing/intent-plans/plan.js';
|
|
9
9
|
import { createValidatorSigningTasks } from '../../signing/plan.js';
|
|
10
10
|
import { resolveAccountTypedDataSigning, } from '../../signing/typed-data.js';
|
|
11
|
+
import { signatureSpansMultipleChains } from './origin-chain.js';
|
|
11
12
|
import { buildSessionIntentPlanInput, createIntentSessionSignerInvoker, } from './session-signing.js';
|
|
12
13
|
export async function signIntent(context, prepared) {
|
|
13
14
|
const runtime = await context.account.forChain(prepared.accountChain);
|
|
@@ -252,7 +253,13 @@ function independentOriginResult(owner, result) {
|
|
|
252
253
|
function buildIntentPlanInput(prepared, context) {
|
|
253
254
|
const payloads = {};
|
|
254
255
|
const stages = [];
|
|
255
|
-
|
|
256
|
+
// A chain-agnostic origin is deliberately excluded: every leaf here is hashed
|
|
257
|
+
// with its own chain id, so it would be bound to the leg the payload happens
|
|
258
|
+
// to name. Routing it down the plain branch instead reaches the one refusal
|
|
259
|
+
// in `resolveAccountTypedDataSigning`.
|
|
260
|
+
const quorumMerkle = context.validator.kind === 'quorum' &&
|
|
261
|
+
prepared.signing.origins.length > 1 &&
|
|
262
|
+
!prepared.signing.origins.some(({ typedData }) => signatureSpansMultipleChains(typedData))
|
|
256
263
|
? buildQuorumMerkleTree(prepared.signing.origins.map((origin) => ({
|
|
257
264
|
account: context.account.address,
|
|
258
265
|
digest: resolveAccountValidatorSignableHash({
|
|
@@ -293,6 +300,7 @@ function buildIntentPlanInput(prepared, context) {
|
|
|
293
300
|
chain: origin.chain,
|
|
294
301
|
context,
|
|
295
302
|
validationHash: origin.id,
|
|
303
|
+
spansMultipleChains: signatureSpansMultipleChains(origin.typedData),
|
|
296
304
|
});
|
|
297
305
|
payloads[origin.id] = route.material;
|
|
298
306
|
stages.push(signingStage({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rhinestone/sdk",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.10.0",
|
|
4
4
|
"description": "End-to-end chain abstraction and modularity toolkit",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Rhinestone",
|
|
@@ -51,6 +51,10 @@
|
|
|
51
51
|
"types": "./dist/src/actions/smart-sessions.d.ts",
|
|
52
52
|
"import": "./dist/src/actions/smart-sessions.js"
|
|
53
53
|
},
|
|
54
|
+
"./hypercore": {
|
|
55
|
+
"types": "./dist/src/hypercore/index.d.ts",
|
|
56
|
+
"import": "./dist/src/hypercore/index.js"
|
|
57
|
+
},
|
|
54
58
|
"./errors": {
|
|
55
59
|
"types": "./dist/src/errors/index.d.ts",
|
|
56
60
|
"import": "./dist/src/errors/index.js"
|