@arca-network/sdk 1.5.2 → 1.7.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/arca.d.ts +60 -3
- package/dist/arca.d.ts.map +1 -1
- package/dist/arca.js +106 -2
- package/dist/arca.js.map +1 -1
- package/dist/client.d.ts +29 -9
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +18 -6
- package/dist/client.js.map +1 -1
- package/dist/cosign.d.ts +208 -0
- package/dist/cosign.d.ts.map +1 -0
- package/dist/cosign.js +488 -0
- package/dist/cosign.js.map +1 -0
- package/dist/errors.d.ts +28 -2
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +43 -4
- package/dist/errors.js.map +1 -1
- package/dist/index.d.ts +6 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +45 -1
- package/dist/index.js.map +1 -1
- package/dist/streams.d.ts +32 -2
- package/dist/streams.d.ts.map +1 -1
- package/dist/streams.js +119 -3
- package/dist/streams.js.map +1 -1
- package/dist/types.d.ts +131 -6
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +3 -0
- package/dist/types.js.map +1 -1
- package/dist/websocket.d.ts +24 -1
- package/dist/websocket.d.ts.map +1 -1
- package/dist/websocket.js +127 -1
- package/dist/websocket.js.map +1 -1
- package/package.json +1 -1
package/dist/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":";;;AACA,
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":";;;AACA,qCAQkB;AAqDlB,MAAM,kBAAkB,GAAG,IAAI,GAAG,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC;AACpD,MAAM,WAAW,GAAG,CAAC,CAAC;AACtB,6EAA6E;AAC7E,6EAA6E;AAC7E,6EAA6E;AAC7E,gEAAgE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I,CAAC,KAAK,CAAC,OAAO,EAClB,IAAI,CAAC,KAAK,CAAC,OAAO,EAClB,IAAI,CAAC,KAAK,CAAC,OAAO,CACnB,CAAC;YACJ,CAAC;YACD,MAAM,IAAI,kBAAS,CAAC,SAAS,EAAE,8BAA8B,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC;QAC7E,CAAC;QAED,OAAO,IAAI,CAAC,IAAI,CAAC;IACnB,CAAC;CACF;AAhPD,gCAgPC;AAED,SAAS,eAAe,CAAC,GAAY;IACnC,OAAO,GAAG,YAAY,0BAAiB,IAAI,GAAG,YAAY,uBAAc,CAAC;AAC3E,CAAC;AAED,MAAM,kBAAmB,SAAQ,KAAK;IACpC,MAAM,CAAS;IACf,YAAY,MAAc;QACxB,KAAK,CAAC,kBAAkB,MAAM,EAAE,CAAC,CAAC;QAClC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;CACF"}
|
package/dist/cosign.d.ts
ADDED
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Client-side EIP-712 co-signing for the Arca v2 custody kernel
|
|
3
|
+
* (`OperatorAction`).
|
|
4
|
+
*
|
|
5
|
+
* On a co-sign-enabled boundary the kernel will not move value on an
|
|
6
|
+
* operator-initiated action unless the action carries a fresh user
|
|
7
|
+
* signature over an `OperatorAction` typed-data digest. The user's device
|
|
8
|
+
* (which holds the boundary's secp256k1 co-sign key, typically unlocked via
|
|
9
|
+
* a passkey) produces that signature; the operator submits it on-chain. The
|
|
10
|
+
* operator controls the timing of the action but cannot move value without
|
|
11
|
+
* this signature.
|
|
12
|
+
*
|
|
13
|
+
* This module builds the exact digest the kernel verifies in
|
|
14
|
+
* `ArcaCustodyKernel._verifyCosign` / `hashOperatorAction`:
|
|
15
|
+
* domain = EIP712Domain(name="ArcaCustodyKernel", version="1",
|
|
16
|
+
* chainId, verifyingContract=kernel)
|
|
17
|
+
* struct = OperatorAction(uint8 actionType, bytes32 boundary,
|
|
18
|
+
* bytes32 paramsHash, uint256 nonce,
|
|
19
|
+
* uint256 deadline)
|
|
20
|
+
* digest = keccak256(0x1901 ‖ domainSeparator ‖ structHash)
|
|
21
|
+
*
|
|
22
|
+
* It is built on the same `@noble` primitives the SDK already uses for
|
|
23
|
+
* recovery-key generation — no viem/ethers dependency.
|
|
24
|
+
*
|
|
25
|
+
* NOTE on the signer: a secp256k1 EOA signature (this module) is verified
|
|
26
|
+
* on-chain via `ecrecover`. The kernel also accepts ERC-1271 signatures, so
|
|
27
|
+
* a smart-contract / passkey-fronted signer is supported on-chain — but
|
|
28
|
+
* producing those is the signer contract's concern, not this module's.
|
|
29
|
+
*/
|
|
30
|
+
/**
|
|
31
|
+
* Mirrors `IArcaCustodyKernel.CosignAction`. The integer values are folded
|
|
32
|
+
* into the EIP-712 digest and MUST stay in lockstep with that enum; once the
|
|
33
|
+
* contracts are deployed this is a frozen wire contract.
|
|
34
|
+
*
|
|
35
|
+
* `MoveOut` (0) is the kernel's single generic value-out primitive. The
|
|
36
|
+
* coordinator composes it as both a plain withdraw (`context = 0`) and a
|
|
37
|
+
* venue route (`context = moduleAccountId`), so one discriminator covers what
|
|
38
|
+
* were previously the separate `Withdraw` and `RouteToModule` actions.
|
|
39
|
+
*/
|
|
40
|
+
export declare enum CosignAction {
|
|
41
|
+
MoveOut = 0,
|
|
42
|
+
CrossTransfer = 1,
|
|
43
|
+
VaultAddAgent = 2,
|
|
44
|
+
VaultDrain = 3,
|
|
45
|
+
VaultBridge = 4,
|
|
46
|
+
SetCoordinator = 5,
|
|
47
|
+
MigrateOut = 6,
|
|
48
|
+
VaultMigrateParent = 7
|
|
49
|
+
}
|
|
50
|
+
/** Exposed for cross-checking against the on-chain constant. */
|
|
51
|
+
export declare const OPERATOR_ACTION_TYPEHASH_HEX: string;
|
|
52
|
+
export type Uint = number | bigint | string;
|
|
53
|
+
export interface OperatorAction {
|
|
54
|
+
/** EVM chain id of the kernel. */
|
|
55
|
+
chainId: Uint;
|
|
56
|
+
/** The kernel proxy address (EIP-712 verifying contract). */
|
|
57
|
+
kernelAddress: string;
|
|
58
|
+
action: CosignAction;
|
|
59
|
+
/** Boundary id, a 32-byte hex string. */
|
|
60
|
+
boundary: string;
|
|
61
|
+
/** keccak256 over the action's ABI-encoded parameters (32-byte hex). */
|
|
62
|
+
paramsHash: string;
|
|
63
|
+
/** The boundary's current co-sign nonce (read from `getBoundary`). */
|
|
64
|
+
nonce: Uint;
|
|
65
|
+
/** Unix-seconds expiry. */
|
|
66
|
+
deadline: Uint;
|
|
67
|
+
}
|
|
68
|
+
/** EIP-712 domain separator for a kernel on a given chain. */
|
|
69
|
+
export declare function domainSeparator(chainId: Uint, kernelAddress: string): string;
|
|
70
|
+
/**
|
|
71
|
+
* The EIP-712 digest a co-sign key must sign. Equal to the kernel's
|
|
72
|
+
* `hashOperatorAction(actionType, boundary, paramsHash, nonce, deadline)`.
|
|
73
|
+
*/
|
|
74
|
+
export declare function operatorActionDigest(a: OperatorAction): string;
|
|
75
|
+
/**
|
|
76
|
+
* Sign an `OperatorAction` with the boundary's secp256k1 co-sign private
|
|
77
|
+
* key. Returns a 65-byte `0x`-prefixed signature `r ‖ s ‖ v` (v ∈ {27,28}),
|
|
78
|
+
* the layout `ecrecover` / OpenZeppelin `ECDSA.recover` expect. The
|
|
79
|
+
* signature is canonical (low-s), satisfying EIP-2.
|
|
80
|
+
*/
|
|
81
|
+
export declare function signOperatorAction(privateKey: string | Uint8Array, a: OperatorAction): string;
|
|
82
|
+
/** Recover the signer address from a signature over an `OperatorAction`. */
|
|
83
|
+
export declare function recoverOperatorActionSigner(signature: string, a: OperatorAction): string;
|
|
84
|
+
/** A 32-byte zero word — the `context` for a plain withdraw. */
|
|
85
|
+
export declare const ZERO_BYTES32: string;
|
|
86
|
+
/**
|
|
87
|
+
* kernel.moveOut: keccak256(abi.encode(to, amount, ref, context)). This is the
|
|
88
|
+
* single commitment for every co-signed value-out. `to` is the recipient (a
|
|
89
|
+
* plain withdraw) or the venue module (a route); `context` is `ZERO_BYTES32`
|
|
90
|
+
* for a withdraw, or the venue sub-account id for a route — so the operator
|
|
91
|
+
* cannot redirect a consented venue deposit to a different sub-account.
|
|
92
|
+
*/
|
|
93
|
+
export declare function moveOutParamsHash(to: string, amount: Uint, ref: string, context: string): string;
|
|
94
|
+
/**
|
|
95
|
+
* Convenience wrapper for a plain withdraw — a `moveOut` with `context = 0`.
|
|
96
|
+
* Produces the kernel's `keccak256(abi.encode(recipient, amount, ref, 0))`.
|
|
97
|
+
*/
|
|
98
|
+
export declare function withdrawParamsHash(amount: Uint, recipient: string, ref: string): string;
|
|
99
|
+
/** kernel.crossTransfer: keccak256(abi.encode(fromB, toB, amount)). */
|
|
100
|
+
export declare function crossTransferParamsHash(fromB: string, toB: string, amount: Uint): string;
|
|
101
|
+
/**
|
|
102
|
+
* Convenience wrapper for a venue route — a `moveOut` whose `to` is the module
|
|
103
|
+
* and whose `context` is the venue sub-account id. Produces the kernel's
|
|
104
|
+
* `keccak256(abi.encode(module, amount, ref, subjectId))`.
|
|
105
|
+
*/
|
|
106
|
+
export declare function routeToModuleParamsHash(module: string, subjectId: string, amount: Uint, ref: string): string;
|
|
107
|
+
/**
|
|
108
|
+
* HL module.vaultAddAgent: keccak256(abi.encode(arcaId, agent, name)). The
|
|
109
|
+
* leading `arcaId` binds the co-signature to ONE arca — a boundary can hold
|
|
110
|
+
* several arcas, and the kernel digest only binds `boundary`, so without this
|
|
111
|
+
* an operator could replay the signature against a different arca in the same
|
|
112
|
+
* boundary. `name` is a dynamic string, so this uses full head/tail ABI
|
|
113
|
+
* encoding: two head words (arcaId, agent) then the offset to the string.
|
|
114
|
+
*/
|
|
115
|
+
export declare function vaultAddAgentParamsHash(arcaId: string, agent: string, name: string): string;
|
|
116
|
+
/** HL module.vaultDrainPerpToSpot: keccak256(abi.encode(arcaId, coreAmt)). */
|
|
117
|
+
export declare function vaultDrainParamsHash(arcaId: string, coreAmt: Uint): string;
|
|
118
|
+
/** HL module.vaultBridgeAndForwardUSDC: keccak256(abi.encode(arcaId, coreAmt, ref)). */
|
|
119
|
+
export declare function vaultBridgeParamsHash(arcaId: string, coreAmt: Uint, ref: string): string;
|
|
120
|
+
/** HL module.migrateVaultParent: keccak256(abi.encode(arcaId, newModule)). */
|
|
121
|
+
export declare function vaultMigrateParentParamsHash(arcaId: string, newModule: string): string;
|
|
122
|
+
export interface CosignContext {
|
|
123
|
+
chainId: Uint;
|
|
124
|
+
kernelAddress: string;
|
|
125
|
+
boundary: string;
|
|
126
|
+
nonce: Uint;
|
|
127
|
+
deadline: Uint;
|
|
128
|
+
}
|
|
129
|
+
export declare function signWithdraw(privateKey: string | Uint8Array, ctx: CosignContext, amount: Uint, recipient: string, ref: string): string;
|
|
130
|
+
export declare function signCrossTransfer(privateKey: string | Uint8Array, ctx: CosignContext, toBoundary: string, amount: Uint): string;
|
|
131
|
+
export declare function signRouteToModule(privateKey: string | Uint8Array, ctx: CosignContext, module: string, subjectId: string, amount: Uint, ref: string): string;
|
|
132
|
+
export declare function signVaultAddAgent(privateKey: string | Uint8Array, ctx: CosignContext, arcaId: string, agent: string, name: string): string;
|
|
133
|
+
export declare function signVaultDrain(privateKey: string | Uint8Array, ctx: CosignContext, arcaId: string, coreAmt: Uint): string;
|
|
134
|
+
export declare function signVaultBridge(privateKey: string | Uint8Array, ctx: CosignContext, arcaId: string, coreAmt: Uint, ref: string): string;
|
|
135
|
+
export declare function signVaultMigrateParent(privateKey: string | Uint8Array, ctx: CosignContext, arcaId: string, newModule: string): string;
|
|
136
|
+
/** ERC-7913 device signer types enrolled in a `CosignRegistry`. */
|
|
137
|
+
export interface CosignDeviceItem {
|
|
138
|
+
/** The enrolled ERC-7913 device blob (20-byte address, or `verifier || key`). */
|
|
139
|
+
signer: string;
|
|
140
|
+
/** That device's signature over the kernel `OperatorAction` digest. */
|
|
141
|
+
sig: string;
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* A 20-byte secp256k1 EOA device, as an ERC-7913 signer. Its `sig` is the
|
|
145
|
+
* 65-byte `signOperatorAction(...)` output (verified on-chain via `ecrecover`).
|
|
146
|
+
*/
|
|
147
|
+
export declare function addressDeviceSigner(address: string): string;
|
|
148
|
+
/**
|
|
149
|
+
* A verifier-backed device, as the ERC-7913 blob `verifier (20 bytes) || key`.
|
|
150
|
+
* `verifier` is a singleton `IERC7913SignatureVerifier` (e.g. the deployed
|
|
151
|
+
* `P256Verifier` / `WebAuthnVerifier`); `key` is its opaque public key.
|
|
152
|
+
*/
|
|
153
|
+
export declare function verifierDeviceSigner(verifier: string, key: string): string;
|
|
154
|
+
/** A P256 / WebAuthn public key `abi.encode(uint256 x, uint256 y)`. */
|
|
155
|
+
export declare function p256DeviceKey(x: Uint, y: Uint): string;
|
|
156
|
+
/** A raw-P256 or WebAuthn device signer `verifier || abi.encode(x, y)`. */
|
|
157
|
+
export declare function p256DeviceSigner(verifier: string, x: Uint, y: Uint): string;
|
|
158
|
+
/**
|
|
159
|
+
* A raw-P256 device signature `abi.encode(uint256 r, uint256 s)` (what
|
|
160
|
+
* `P256Verifier` expects). For a WebAuthn passkey the device produces an
|
|
161
|
+
* assertion instead — `abi.encode(authenticatorData, clientDataJSON,
|
|
162
|
+
* challengeLocation, responseTypeLocation, r, s)`, what `WebAuthnVerifier`
|
|
163
|
+
* expects — assembled by the client's passkey code over `digest` as the
|
|
164
|
+
* challenge; this SDK does not perform the WebAuthn ceremony.
|
|
165
|
+
*/
|
|
166
|
+
export declare function encodeP256Signature(r: Uint, s: Uint): string;
|
|
167
|
+
/** `keccak256(signer)` — the registry's per-boundary set membership key. */
|
|
168
|
+
export declare function deviceSignerHash(signer: string): string;
|
|
169
|
+
/**
|
|
170
|
+
* Build the registry co-sign blob `abi.encode(bytes[] signers, bytes[] sigs)`,
|
|
171
|
+
* ordered by strictly increasing `keccak256(signer)` (the canonical order the
|
|
172
|
+
* registry requires). Throws on a duplicate device. Pass this as the kernel's
|
|
173
|
+
* `cosignSig` when `cosignKey` points at a `CosignRegistry`.
|
|
174
|
+
*/
|
|
175
|
+
export declare function encodeRegistryCosignBlob(items: CosignDeviceItem[]): string;
|
|
176
|
+
/** Relayed management action ids — part of the signed `CosignerManage` digest. */
|
|
177
|
+
export declare enum CosignerManageAction {
|
|
178
|
+
Add = 0,
|
|
179
|
+
Remove = 1
|
|
180
|
+
}
|
|
181
|
+
export interface CosignerManage {
|
|
182
|
+
/** EVM chain id of the registry. */
|
|
183
|
+
chainId: Uint;
|
|
184
|
+
/** The `CosignRegistry` address (EIP-712 verifying contract). */
|
|
185
|
+
registryAddress: string;
|
|
186
|
+
action: CosignerManageAction;
|
|
187
|
+
/** Boundary id (32-byte hex). */
|
|
188
|
+
boundary: string;
|
|
189
|
+
/** `keccak256` of the device blob being added/removed (`deviceSignerHash`). */
|
|
190
|
+
signerHash: string;
|
|
191
|
+
/** The boundary's current relay nonce (`registry.relayNonce(boundary)`). */
|
|
192
|
+
nonce: Uint;
|
|
193
|
+
/** Unix-seconds expiry. */
|
|
194
|
+
deadline: Uint;
|
|
195
|
+
}
|
|
196
|
+
/** EIP-712 domain separator for a `CosignRegistry` on a given chain. */
|
|
197
|
+
export declare function cosignRegistryDomainSeparator(chainId: Uint, registryAddress: string): string;
|
|
198
|
+
/**
|
|
199
|
+
* The EIP-712 digest a boundary's recovery key signs to relay an enroll/remove
|
|
200
|
+
* to the registry (`addCosignerWithSig` / `removeCosignerWithSig`). Equal to
|
|
201
|
+
* the registry's `manageDigest(action, boundary, signerHash, deadline)`.
|
|
202
|
+
*/
|
|
203
|
+
export declare function cosignerManageDigest(m: CosignerManage): string;
|
|
204
|
+
/** Sign a `CosignerManage` relay authorization with the recovery key. */
|
|
205
|
+
export declare function signCosignerManage(privateKey: string | Uint8Array, m: CosignerManage): string;
|
|
206
|
+
/** Recover the signer of a `CosignerManage` relay signature. */
|
|
207
|
+
export declare function recoverCosignerManageSigner(signature: string, m: CosignerManage): string;
|
|
208
|
+
//# sourceMappingURL=cosign.d.ts.map
|
|
@@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