@arca-network/sdk 1.18.0 → 1.19.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 +64 -1
- package/dist/arca.d.ts.map +1 -1
- package/dist/arca.js +142 -4
- package/dist/arca.js.map +1 -1
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +17 -1
- package/dist/client.js.map +1 -1
- package/dist/cosign.d.ts +2 -1
- package/dist/cosign.d.ts.map +1 -1
- package/dist/cosign.js +55 -173
- package/dist/cosign.js.map +1 -1
- package/dist/deposit-auth.d.ts +110 -0
- package/dist/deposit-auth.d.ts.map +1 -0
- package/dist/deposit-auth.js +165 -0
- package/dist/deposit-auth.js.map +1 -0
- package/dist/eip712.d.ts +44 -0
- package/dist/eip712.d.ts.map +1 -0
- package/dist/eip712.js +158 -0
- package/dist/eip712.js.map +1 -0
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +19 -1
- package/dist/index.js.map +1 -1
- package/dist/streams.d.ts +37 -0
- package/dist/streams.d.ts.map +1 -1
- package/dist/streams.js +88 -0
- package/dist/streams.js.map +1 -1
- package/dist/types.d.ts +51 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/dist/websocket.d.ts +16 -0
- package/dist/websocket.d.ts.map +1 -1
- package/dist/websocket.js +45 -0
- package/dist/websocket.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { type Uint } from './eip712.js';
|
|
2
|
+
/** Exposed for cross-checking against the on-chain constants. */
|
|
3
|
+
export declare const BIND_DESTINATION_TYPEHASH_HEX: string;
|
|
4
|
+
export declare const BIND_BOUNDARY_TYPEHASH_HEX: string;
|
|
5
|
+
export declare const PERMIT_TYPEHASH_HEX: string;
|
|
6
|
+
/** An EIP-712 domain, in the shape `eth_signTypedData_v4` expects. */
|
|
7
|
+
export interface Eip712Domain {
|
|
8
|
+
name: string;
|
|
9
|
+
version: string;
|
|
10
|
+
chainId: string;
|
|
11
|
+
verifyingContract: string;
|
|
12
|
+
}
|
|
13
|
+
/** One member of an EIP-712 struct type. */
|
|
14
|
+
export interface Eip712Field {
|
|
15
|
+
name: string;
|
|
16
|
+
type: string;
|
|
17
|
+
}
|
|
18
|
+
/** An `eth_signTypedData_v4` payload, ready to hand to a wallet. */
|
|
19
|
+
export interface Eip712TypedData {
|
|
20
|
+
domain: Eip712Domain;
|
|
21
|
+
primaryType: string;
|
|
22
|
+
types: Record<string, Eip712Field[]>;
|
|
23
|
+
message: Record<string, string>;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* The half of `GET /custody/deposits/authorization-params` describing one
|
|
27
|
+
* signature. Pass the response's `bind` or `permit` straight through.
|
|
28
|
+
*/
|
|
29
|
+
export interface DepositAuthorizationPayload {
|
|
30
|
+
domain: Eip712Domain;
|
|
31
|
+
domainSeparator: string;
|
|
32
|
+
primaryType: string;
|
|
33
|
+
types: Record<string, Eip712Field[]>;
|
|
34
|
+
/** The token's current EIP-2612 counter. Permit only. */
|
|
35
|
+
nonce?: string;
|
|
36
|
+
}
|
|
37
|
+
/** The response from `GET /custody/deposits/authorization-params`. */
|
|
38
|
+
export interface DepositAuthorizationParams {
|
|
39
|
+
chain: string;
|
|
40
|
+
bridged: boolean;
|
|
41
|
+
router: string;
|
|
42
|
+
token: string;
|
|
43
|
+
chainId: string;
|
|
44
|
+
boundaryId: string;
|
|
45
|
+
boundaryKey: string;
|
|
46
|
+
mintRecipient?: string;
|
|
47
|
+
permitSpender: string;
|
|
48
|
+
bind: DepositAuthorizationPayload;
|
|
49
|
+
permit: DepositAuthorizationPayload;
|
|
50
|
+
}
|
|
51
|
+
/** What the user is binding: their address, and when the binding expires. */
|
|
52
|
+
export interface BindingTerms {
|
|
53
|
+
/** The address being registered — the one that will hold the deposits. */
|
|
54
|
+
account: string;
|
|
55
|
+
/** Unix-seconds expiry. */
|
|
56
|
+
deadline: Uint;
|
|
57
|
+
}
|
|
58
|
+
/** What the user is permitting the router to move. */
|
|
59
|
+
export interface PermitTerms {
|
|
60
|
+
/** The address being registered. */
|
|
61
|
+
owner: string;
|
|
62
|
+
/**
|
|
63
|
+
* The allowance ceiling, in RAW token units (6dp USDC micro-units), not a
|
|
64
|
+
* decimal string. This is the most the router may ever move, so it is the
|
|
65
|
+
* user's call — a tight ceiling means re-signing when it is exhausted.
|
|
66
|
+
*/
|
|
67
|
+
value: Uint;
|
|
68
|
+
/** Unix-seconds expiry. */
|
|
69
|
+
deadline: Uint;
|
|
70
|
+
/**
|
|
71
|
+
* The token's current nonce for the owner. Omit to take it from the params'
|
|
72
|
+
* `permit.nonce`, which is present when the params were requested with an
|
|
73
|
+
* `address`.
|
|
74
|
+
*/
|
|
75
|
+
nonce?: Uint;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* The bytes32 a boundary id hashes to on-chain — the contracts' `CustodyKey`.
|
|
79
|
+
*
|
|
80
|
+
* Prefer the `boundaryKey` the params endpoint already returns. This exists
|
|
81
|
+
* for checking that value rather than replacing it.
|
|
82
|
+
*/
|
|
83
|
+
export declare function custodyKey(boundaryId: string): string;
|
|
84
|
+
/**
|
|
85
|
+
* The `eth_signTypedData_v4` payload for the binding, bridged or same-chain.
|
|
86
|
+
* Which one is decided by `params.bridged`, so a caller never picks wrong.
|
|
87
|
+
*/
|
|
88
|
+
export declare function bindingTypedData(params: DepositAuthorizationParams, terms: BindingTerms): Eip712TypedData;
|
|
89
|
+
/** The `eth_signTypedData_v4` payload for the EIP-2612 permit. */
|
|
90
|
+
export declare function permitTypedData(params: DepositAuthorizationParams, terms: PermitTerms): Eip712TypedData;
|
|
91
|
+
/** The digest the router verifies the binding against. */
|
|
92
|
+
export declare function bindingDigest(params: DepositAuthorizationParams, terms: BindingTerms): string;
|
|
93
|
+
/** The digest the token verifies the permit against. */
|
|
94
|
+
export declare function permitDigest(params: DepositAuthorizationParams, terms: PermitTerms): string;
|
|
95
|
+
/**
|
|
96
|
+
* Sign the binding with the registering address's private key. Returns a
|
|
97
|
+
* 65-byte `0x`-prefixed `r ‖ s ‖ v` signature, which is what
|
|
98
|
+
* `POST /custody/deposits/watch` takes as `bindSignature`.
|
|
99
|
+
*/
|
|
100
|
+
export declare function signBinding(privateKey: string | Uint8Array, params: DepositAuthorizationParams, terms: BindingTerms): string;
|
|
101
|
+
/**
|
|
102
|
+
* Sign the permit with the owner's private key. Returns the `permitSignature`
|
|
103
|
+
* for `POST /custody/deposits/watch`.
|
|
104
|
+
*/
|
|
105
|
+
export declare function signPermit(privateKey: string | Uint8Array, params: DepositAuthorizationParams, terms: PermitTerms): string;
|
|
106
|
+
/** Recover the signer of a binding signature — useful for checking a wallet's output. */
|
|
107
|
+
export declare function recoverBindingSigner(signature: string, params: DepositAuthorizationParams, terms: BindingTerms): string;
|
|
108
|
+
/** Recover the signer of a permit signature. */
|
|
109
|
+
export declare function recoverPermitSigner(signature: string, params: DepositAuthorizationParams, terms: PermitTerms): string;
|
|
110
|
+
//# sourceMappingURL=deposit-auth.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deposit-auth.d.ts","sourceRoot":"","sources":["../src/deposit-auth.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,IAAI,EAYV,MAAM,aAAa,CAAC;AAgDrB,iEAAiE;AACjE,eAAO,MAAM,6BAA6B,QAAmC,CAAC;AAC9E,eAAO,MAAM,0BAA0B,QAAgC,CAAC;AACxE,eAAO,MAAM,mBAAmB,QAAyB,CAAC;AAI1D,sEAAsE;AACtE,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,iBAAiB,EAAE,MAAM,CAAC;CAC3B;AAED,4CAA4C;AAC5C,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,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,IAAI,CAAC;CACd;AAID;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAErD;AAID;;;GAGG;AACH,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,0BAA0B,EAClC,KAAK,EAAE,YAAY,GAClB,eAAe,CAmBjB;AAED,kEAAkE;AAClE,wBAAgB,eAAe,CAC7B,MAAM,EAAE,0BAA0B,EAClC,KAAK,EAAE,WAAW,GACjB,eAAe,CAajB;AAID,0DAA0D;AAC1D,wBAAgB,aAAa,CAAC,MAAM,EAAE,0BAA0B,EAAE,KAAK,EAAE,YAAY,GAAG,MAAM,CA8B7F;AAED,wDAAwD;AACxD,wBAAgB,YAAY,CAAC,MAAM,EAAE,0BAA0B,EAAE,KAAK,EAAE,WAAW,GAAG,MAAM,CAsB3F;AAID;;;;GAIG;AACH,wBAAgB,WAAW,CACzB,UAAU,EAAE,MAAM,GAAG,UAAU,EAC/B,MAAM,EAAE,0BAA0B,EAClC,KAAK,EAAE,YAAY,GAClB,MAAM,CAER;AAED;;;GAGG;AACH,wBAAgB,UAAU,CACxB,UAAU,EAAE,MAAM,GAAG,UAAU,EAC/B,MAAM,EAAE,0BAA0B,EAClC,KAAK,EAAE,WAAW,GACjB,MAAM,CAER;AAED,yFAAyF;AACzF,wBAAgB,oBAAoB,CAClC,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,0BAA0B,EAClC,KAAK,EAAE,YAAY,GAClB,MAAM,CAER;AAED,gDAAgD;AAChD,wBAAgB,mBAAmB,CACjC,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,0BAA0B,EAClC,KAAK,EAAE,WAAW,GACjB,MAAM,CAER"}
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PERMIT_TYPEHASH_HEX = exports.BIND_BOUNDARY_TYPEHASH_HEX = exports.BIND_DESTINATION_TYPEHASH_HEX = void 0;
|
|
4
|
+
exports.custodyKey = custodyKey;
|
|
5
|
+
exports.bindingTypedData = bindingTypedData;
|
|
6
|
+
exports.permitTypedData = permitTypedData;
|
|
7
|
+
exports.bindingDigest = bindingDigest;
|
|
8
|
+
exports.permitDigest = permitDigest;
|
|
9
|
+
exports.signBinding = signBinding;
|
|
10
|
+
exports.signPermit = signPermit;
|
|
11
|
+
exports.recoverBindingSigner = recoverBindingSigner;
|
|
12
|
+
exports.recoverPermitSigner = recoverPermitSigner;
|
|
13
|
+
const eip712_js_1 = require("./eip712.js");
|
|
14
|
+
/**
|
|
15
|
+
* The two signatures that make deposits automatic.
|
|
16
|
+
*
|
|
17
|
+
* A user who keeps their own wallet (a Privy embedded EOA, a hardware wallet,
|
|
18
|
+
* anything with a key) can have deposits swept into their arca without ever
|
|
19
|
+
* sending a transaction or holding native gas. They sign two things, once:
|
|
20
|
+
*
|
|
21
|
+
* 1. A **binding** naming where their deposits go. `BindDestination` for the
|
|
22
|
+
* bridged lane (the money crosses from another chain), `BindBoundary` for
|
|
23
|
+
* the same-chain lane. The router records it, and every later sweep reads
|
|
24
|
+
* the destination from that record rather than taking one as an argument —
|
|
25
|
+
* which is why the operator cannot redirect the money afterwards.
|
|
26
|
+
* 2. An **EIP-2612 permit** giving the router an allowance to move deposits
|
|
27
|
+
* with. This is a ceiling on how much of their money the router may ever
|
|
28
|
+
* move, so it is the user's decision, not the platform's.
|
|
29
|
+
*
|
|
30
|
+
* Neither is broadcast. The platform's operator submits them bundled with the
|
|
31
|
+
* first sweep and pays the gas, so an address that never receives anything
|
|
32
|
+
* never costs a transaction.
|
|
33
|
+
*
|
|
34
|
+
* Everything these builders need comes from
|
|
35
|
+
* `GET /api/v1/custody/deposits/authorization-params`. Do not derive the
|
|
36
|
+
* values yourself: the boundary moves when a path is placed in an isolation
|
|
37
|
+
* zone, the mint recipient is whichever receiver the realm's corridor
|
|
38
|
+
* deployed, and the permit nonce is a counter inside the token. A signature
|
|
39
|
+
* over a value you guessed is not rejected at signing time — it is a
|
|
40
|
+
* well-formed signature the verifier will never recompute, and it fails as a
|
|
41
|
+
* bare "invalid signature" after the money has already arrived.
|
|
42
|
+
*
|
|
43
|
+
* Two output shapes, because there are two kinds of signer:
|
|
44
|
+
* - `*TypedData(...)` returns an `eth_signTypedData_v4` payload, for a wallet
|
|
45
|
+
* that signs on the user's behalf (Privy, WalletConnect, a browser wallet).
|
|
46
|
+
* - `sign*(privateKey, ...)` signs directly, for a backend that holds the key.
|
|
47
|
+
*/
|
|
48
|
+
// --- Typehashes (must match the contracts) ---
|
|
49
|
+
const BIND_DESTINATION_TYPE = 'BindDestination(address account,bytes32 boundary,bytes32 mintRecipient,uint256 deadline)';
|
|
50
|
+
const BIND_BOUNDARY_TYPE = 'BindBoundary(address account,bytes32 boundary,uint256 deadline)';
|
|
51
|
+
const PERMIT_TYPE = 'Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)';
|
|
52
|
+
const BIND_DESTINATION_TYPEHASH = (0, eip712_js_1.keccak256Hex)(BIND_DESTINATION_TYPE);
|
|
53
|
+
const BIND_BOUNDARY_TYPEHASH = (0, eip712_js_1.keccak256Hex)(BIND_BOUNDARY_TYPE);
|
|
54
|
+
const PERMIT_TYPEHASH = (0, eip712_js_1.keccak256Hex)(PERMIT_TYPE);
|
|
55
|
+
/** Exposed for cross-checking against the on-chain constants. */
|
|
56
|
+
exports.BIND_DESTINATION_TYPEHASH_HEX = '0x' + BIND_DESTINATION_TYPEHASH;
|
|
57
|
+
exports.BIND_BOUNDARY_TYPEHASH_HEX = '0x' + BIND_BOUNDARY_TYPEHASH;
|
|
58
|
+
exports.PERMIT_TYPEHASH_HEX = '0x' + PERMIT_TYPEHASH;
|
|
59
|
+
// --- Boundary key ---
|
|
60
|
+
/**
|
|
61
|
+
* The bytes32 a boundary id hashes to on-chain — the contracts' `CustodyKey`.
|
|
62
|
+
*
|
|
63
|
+
* Prefer the `boundaryKey` the params endpoint already returns. This exists
|
|
64
|
+
* for checking that value rather than replacing it.
|
|
65
|
+
*/
|
|
66
|
+
function custodyKey(boundaryId) {
|
|
67
|
+
return '0x' + (0, eip712_js_1.keccak256Hex)(boundaryId);
|
|
68
|
+
}
|
|
69
|
+
// --- Typed data (for a wallet that signs on the user's behalf) ---
|
|
70
|
+
/**
|
|
71
|
+
* The `eth_signTypedData_v4` payload for the binding, bridged or same-chain.
|
|
72
|
+
* Which one is decided by `params.bridged`, so a caller never picks wrong.
|
|
73
|
+
*/
|
|
74
|
+
function bindingTypedData(params, terms) {
|
|
75
|
+
const message = {
|
|
76
|
+
account: terms.account,
|
|
77
|
+
boundary: params.boundaryKey,
|
|
78
|
+
};
|
|
79
|
+
if (params.bridged) {
|
|
80
|
+
if (!params.mintRecipient) {
|
|
81
|
+
throw new Error('deposit-auth: bridged params are missing mintRecipient');
|
|
82
|
+
}
|
|
83
|
+
message.mintRecipient = params.mintRecipient;
|
|
84
|
+
}
|
|
85
|
+
message.deadline = BigInt(terms.deadline).toString();
|
|
86
|
+
return {
|
|
87
|
+
domain: params.bind.domain,
|
|
88
|
+
primaryType: params.bind.primaryType,
|
|
89
|
+
types: params.bind.types,
|
|
90
|
+
message,
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
/** The `eth_signTypedData_v4` payload for the EIP-2612 permit. */
|
|
94
|
+
function permitTypedData(params, terms) {
|
|
95
|
+
return {
|
|
96
|
+
domain: params.permit.domain,
|
|
97
|
+
primaryType: params.permit.primaryType,
|
|
98
|
+
types: params.permit.types,
|
|
99
|
+
message: {
|
|
100
|
+
owner: terms.owner,
|
|
101
|
+
spender: params.permitSpender,
|
|
102
|
+
value: BigInt(terms.value).toString(),
|
|
103
|
+
nonce: resolvePermitNonce(params, terms).toString(),
|
|
104
|
+
deadline: BigInt(terms.deadline).toString(),
|
|
105
|
+
},
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
// --- Digests (what actually gets signed) ---
|
|
109
|
+
/** The digest the router verifies the binding against. */
|
|
110
|
+
function bindingDigest(params, terms) {
|
|
111
|
+
const separator = params.bind.domainSeparator || routerDomainSeparator(params);
|
|
112
|
+
if (params.bridged) {
|
|
113
|
+
if (!params.mintRecipient) {
|
|
114
|
+
throw new Error('deposit-auth: bridged params are missing mintRecipient');
|
|
115
|
+
}
|
|
116
|
+
return (0, eip712_js_1.eip712Digest)(separator, (0, eip712_js_1.keccak256)((0, eip712_js_1.concat)((0, eip712_js_1.hexToBytes)(BIND_DESTINATION_TYPEHASH), (0, eip712_js_1.encodeAddress)(terms.account), (0, eip712_js_1.encodeBytes32)(params.boundaryKey), (0, eip712_js_1.encodeBytes32)(params.mintRecipient), (0, eip712_js_1.encodeUint)(terms.deadline))));
|
|
117
|
+
}
|
|
118
|
+
return (0, eip712_js_1.eip712Digest)(separator, (0, eip712_js_1.keccak256)((0, eip712_js_1.concat)((0, eip712_js_1.hexToBytes)(BIND_BOUNDARY_TYPEHASH), (0, eip712_js_1.encodeAddress)(terms.account), (0, eip712_js_1.encodeBytes32)(params.boundaryKey), (0, eip712_js_1.encodeUint)(terms.deadline))));
|
|
119
|
+
}
|
|
120
|
+
/** The digest the token verifies the permit against. */
|
|
121
|
+
function permitDigest(params, terms) {
|
|
122
|
+
const separator = params.permit.domainSeparator ||
|
|
123
|
+
(0, eip712_js_1.eip712DomainSeparator)(params.permit.domain.name, params.permit.domain.version, params.permit.domain.chainId, params.permit.domain.verifyingContract);
|
|
124
|
+
return (0, eip712_js_1.eip712Digest)(separator, (0, eip712_js_1.keccak256)((0, eip712_js_1.concat)((0, eip712_js_1.hexToBytes)(PERMIT_TYPEHASH), (0, eip712_js_1.encodeAddress)(terms.owner), (0, eip712_js_1.encodeAddress)(params.permitSpender), (0, eip712_js_1.encodeUint)(terms.value), (0, eip712_js_1.encodeUint)(resolvePermitNonce(params, terms)), (0, eip712_js_1.encodeUint)(terms.deadline))));
|
|
125
|
+
}
|
|
126
|
+
// --- Signing (for a backend that holds the key) ---
|
|
127
|
+
/**
|
|
128
|
+
* Sign the binding with the registering address's private key. Returns a
|
|
129
|
+
* 65-byte `0x`-prefixed `r ‖ s ‖ v` signature, which is what
|
|
130
|
+
* `POST /custody/deposits/watch` takes as `bindSignature`.
|
|
131
|
+
*/
|
|
132
|
+
function signBinding(privateKey, params, terms) {
|
|
133
|
+
return '0x' + (0, eip712_js_1.signDigest)(privateKey, (0, eip712_js_1.hexToBytes)(bindingDigest(params, terms)));
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Sign the permit with the owner's private key. Returns the `permitSignature`
|
|
137
|
+
* for `POST /custody/deposits/watch`.
|
|
138
|
+
*/
|
|
139
|
+
function signPermit(privateKey, params, terms) {
|
|
140
|
+
return '0x' + (0, eip712_js_1.signDigest)(privateKey, (0, eip712_js_1.hexToBytes)(permitDigest(params, terms)));
|
|
141
|
+
}
|
|
142
|
+
/** Recover the signer of a binding signature — useful for checking a wallet's output. */
|
|
143
|
+
function recoverBindingSigner(signature, params, terms) {
|
|
144
|
+
return (0, eip712_js_1.recoverAddress)(signature, (0, eip712_js_1.hexToBytes)(bindingDigest(params, terms)));
|
|
145
|
+
}
|
|
146
|
+
/** Recover the signer of a permit signature. */
|
|
147
|
+
function recoverPermitSigner(signature, params, terms) {
|
|
148
|
+
return (0, eip712_js_1.recoverAddress)(signature, (0, eip712_js_1.hexToBytes)(permitDigest(params, terms)));
|
|
149
|
+
}
|
|
150
|
+
// --- Internals ---
|
|
151
|
+
function resolvePermitNonce(params, terms) {
|
|
152
|
+
if (terms.nonce !== undefined)
|
|
153
|
+
return BigInt(terms.nonce);
|
|
154
|
+
if (params.permit.nonce !== undefined && params.permit.nonce !== '') {
|
|
155
|
+
return BigInt(params.permit.nonce);
|
|
156
|
+
}
|
|
157
|
+
// Defaulting to 0 would be wrong for any wallet that has ever permitted
|
|
158
|
+
// anything, and wrong in the silent way: the signature is well-formed and
|
|
159
|
+
// the token simply never accepts it.
|
|
160
|
+
throw new Error('deposit-auth: permit nonce is unknown — request authorization-params with the address, or pass terms.nonce');
|
|
161
|
+
}
|
|
162
|
+
function routerDomainSeparator(params) {
|
|
163
|
+
return (0, eip712_js_1.eip712DomainSeparator)(params.bind.domain.name, params.bind.domain.version, params.bind.domain.chainId, params.bind.domain.verifyingContract);
|
|
164
|
+
}
|
|
165
|
+
//# sourceMappingURL=deposit-auth.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deposit-auth.js","sourceRoot":"","sources":["../src/deposit-auth.ts"],"names":[],"mappings":";;;AA0JA,gCAEC;AAQD,4CAsBC;AAGD,0CAgBC;AAKD,sCA8BC;AAGD,oCAsBC;AASD,kCAMC;AAMD,gCAMC;AAGD,oDAMC;AAGD,kDAMC;AAtTD,2CAaqB;AAErB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAEH,gDAAgD;AAEhD,MAAM,qBAAqB,GACzB,0FAA0F,CAAC;AAC7F,MAAM,kBAAkB,GAAG,iEAAiE,CAAC;AAC7F,MAAM,WAAW,GAAG,oFAAoF,CAAC;AAEzG,MAAM,yBAAyB,GAAG,IAAA,wBAAY,EAAC,qBAAqB,CAAC,CAAC;AACtE,MAAM,sBAAsB,GAAG,IAAA,wBAAY,EAAC,kBAAkB,CAAC,CAAC;AAChE,MAAM,eAAe,GAAG,IAAA,wBAAY,EAAC,WAAW,CAAC,CAAC;AAElD,iEAAiE;AACpD,QAAA,6BAA6B,GAAG,IAAI,GAAG,yBAAyB,CAAC;AACjE,QAAA,0BAA0B,GAAG,IAAI,GAAG,sBAAsB,CAAC;AAC3D,QAAA,mBAAmB,GAAG,IAAI,GAAG,eAAe,CAAC;AAkF1D,uBAAuB;AAEvB;;;;;GAKG;AACH,SAAgB,UAAU,CAAC,UAAkB;IAC3C,OAAO,IAAI,GAAG,IAAA,wBAAY,EAAC,UAAU,CAAC,CAAC;AACzC,CAAC;AAED,oEAAoE;AAEpE;;;GAGG;AACH,SAAgB,gBAAgB,CAC9B,MAAkC,EAClC,KAAmB;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AAY,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC;AAC5E,CAAC;AAED,oBAAoB;AAEpB,SAAS,kBAAkB,CAAC,MAAkC,EAAE,KAAkB;IAChF,IAAI,KAAK,CAAC,KAAK,KAAK,SAAS;QAAE,OAAO,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAC1D,IAAI,MAAM,CAAC,MAAM,CAAC,KAAK,KAAK,SAAS,IAAI,MAAM,CAAC,MAAM,CAAC,KAAK,KAAK,EAAE,EAAE,CAAC;QACpE,OAAO,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACrC,CAAC;IACD,wEAAwE;IACxE,0EAA0E;IAC1E,qCAAqC;IACrC,MAAM,IAAI,KAAK,CACb,4GAA4G,CAC7G,CAAC;AACJ,CAAC;AAED,SAAS,qBAAqB,CAAC,MAAkC;IAC/D,OAAO,IAAA,iCAAqB,EAC1B,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,EACvB,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,EAC1B,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,EAC1B,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,iBAAiB,CACrC,CAAC;AACJ,CAAC"}
|
package/dist/eip712.d.ts
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* EIP-712 primitives shared by every signing surface in the SDK.
|
|
3
|
+
*
|
|
4
|
+
* Extracted from `cosign.ts` when the deposit-authorization helpers needed the
|
|
5
|
+
* same word encoding and the same secp256k1 layout. Two copies of this would be
|
|
6
|
+
* two chances to disagree about a padding rule or a `v` byte, and a signature
|
|
7
|
+
* that disagrees by one byte is indistinguishable from the wrong key.
|
|
8
|
+
*
|
|
9
|
+
* Built on the same `@noble` primitives the SDK already uses for recovery-key
|
|
10
|
+
* generation — no viem/ethers dependency.
|
|
11
|
+
*/
|
|
12
|
+
export type Uint = number | bigint | string;
|
|
13
|
+
export declare function keccak256(data: Uint8Array): Uint8Array;
|
|
14
|
+
/** keccak256 of a UTF-8 string, as un-prefixed hex. Used for typehashes. */
|
|
15
|
+
export declare function keccak256Hex(s: string): string;
|
|
16
|
+
export declare function utf8(s: string): Uint8Array;
|
|
17
|
+
/** Left-pad a value to a 32-byte big-endian word (uintN / enum discriminator). */
|
|
18
|
+
export declare function encodeUint(value: Uint): Uint8Array;
|
|
19
|
+
/** Left-pad a 20-byte address to a 32-byte word. */
|
|
20
|
+
export declare function encodeAddress(addr: string): Uint8Array;
|
|
21
|
+
/** A bytes32 value, used as-is (must already be 32 bytes). */
|
|
22
|
+
export declare function encodeBytes32(hex: string): Uint8Array;
|
|
23
|
+
export declare function concat(...arrays: Uint8Array[]): Uint8Array;
|
|
24
|
+
export declare function hexToBytes(hex: string): Uint8Array;
|
|
25
|
+
export declare function bytesToHex(bytes: Uint8Array): string;
|
|
26
|
+
/**
|
|
27
|
+
* The EIP-712 domain separator: keccak256 over the domain typehash and the
|
|
28
|
+
* four standard fields. Every domain in this SDK uses exactly these fields, so
|
|
29
|
+
* there is no `salt` / `extensions` handling here.
|
|
30
|
+
*/
|
|
31
|
+
export declare function eip712DomainSeparator(name: string, version: string, chainId: Uint, verifyingContract: string): string;
|
|
32
|
+
/** keccak256(0x1901 ‖ domainSeparator ‖ structHash) — the value that is signed. */
|
|
33
|
+
export declare function eip712Digest(domainSeparatorHex: string, structHash: Uint8Array): string;
|
|
34
|
+
/**
|
|
35
|
+
* Sign a 32-byte digest, returning un-prefixed `r ‖ s ‖ v` hex (v ∈ {27,28}) —
|
|
36
|
+
* the layout `ecrecover` / OpenZeppelin `ECDSA.recover` expect. Canonical
|
|
37
|
+
* (low-s), satisfying EIP-2.
|
|
38
|
+
*/
|
|
39
|
+
export declare function signDigest(privateKey: string | Uint8Array, digest: Uint8Array): string;
|
|
40
|
+
/** Recover the EIP-55 checksummed signer address from a 65-byte signature. */
|
|
41
|
+
export declare function recoverAddress(signature: string, digest: Uint8Array): string;
|
|
42
|
+
/** EIP-55 checksum (mirrors recovery.ts). */
|
|
43
|
+
export declare function checksumAddress(addressHex: string): string;
|
|
44
|
+
//# sourceMappingURL=eip712.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"eip712.d.ts","sourceRoot":"","sources":["../src/eip712.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;GAUG;AAEH,MAAM,MAAM,IAAI,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC;AAE5C,wBAAgB,SAAS,CAAC,IAAI,EAAE,UAAU,GAAG,UAAU,CAEtD;AAED,4EAA4E;AAC5E,wBAAgB,YAAY,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAE9C;AAED,wBAAgB,IAAI,CAAC,CAAC,EAAE,MAAM,GAAG,UAAU,CAE1C;AAED,kFAAkF;AAClF,wBAAgB,UAAU,CAAC,KAAK,EAAE,IAAI,GAAG,UAAU,CAYlD;AAED,oDAAoD;AACpD,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,CAMtD;AAED,8DAA8D;AAC9D,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,UAAU,CAIrD;AAED,wBAAgB,MAAM,CAAC,GAAG,MAAM,EAAE,UAAU,EAAE,GAAG,UAAU,CAU1D;AAED,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,UAAU,CAQlD;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CAIpD;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,IAAI,EACb,iBAAiB,EAAE,MAAM,GACxB,MAAM,CAkBR;AAED,mFAAmF;AACnF,wBAAgB,YAAY,CAAC,kBAAkB,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU,GAAG,MAAM,CAKvF;AASD;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,UAAU,EAAE,MAAM,GAAG,UAAU,EAAE,MAAM,EAAE,UAAU,GAAG,MAAM,CAatF;AAED,8EAA8E;AAC9E,wBAAgB,cAAc,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,GAAG,MAAM,CAY5E;AAED,6CAA6C;AAC7C,wBAAgB,eAAe,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAO1D"}
|
package/dist/eip712.js
ADDED
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.keccak256 = keccak256;
|
|
4
|
+
exports.keccak256Hex = keccak256Hex;
|
|
5
|
+
exports.utf8 = utf8;
|
|
6
|
+
exports.encodeUint = encodeUint;
|
|
7
|
+
exports.encodeAddress = encodeAddress;
|
|
8
|
+
exports.encodeBytes32 = encodeBytes32;
|
|
9
|
+
exports.concat = concat;
|
|
10
|
+
exports.hexToBytes = hexToBytes;
|
|
11
|
+
exports.bytesToHex = bytesToHex;
|
|
12
|
+
exports.eip712DomainSeparator = eip712DomainSeparator;
|
|
13
|
+
exports.eip712Digest = eip712Digest;
|
|
14
|
+
exports.signDigest = signDigest;
|
|
15
|
+
exports.recoverAddress = recoverAddress;
|
|
16
|
+
exports.checksumAddress = checksumAddress;
|
|
17
|
+
const sha3_js_1 = require("@noble/hashes/sha3.js");
|
|
18
|
+
const secp256k1_js_1 = require("@noble/curves/secp256k1.js");
|
|
19
|
+
function keccak256(data) {
|
|
20
|
+
return (0, sha3_js_1.keccak_256)(data);
|
|
21
|
+
}
|
|
22
|
+
/** keccak256 of a UTF-8 string, as un-prefixed hex. Used for typehashes. */
|
|
23
|
+
function keccak256Hex(s) {
|
|
24
|
+
return bytesToHex((0, sha3_js_1.keccak_256)(utf8(s)));
|
|
25
|
+
}
|
|
26
|
+
function utf8(s) {
|
|
27
|
+
return new TextEncoder().encode(s);
|
|
28
|
+
}
|
|
29
|
+
/** Left-pad a value to a 32-byte big-endian word (uintN / enum discriminator). */
|
|
30
|
+
function encodeUint(value) {
|
|
31
|
+
let v;
|
|
32
|
+
if (typeof value === 'bigint')
|
|
33
|
+
v = value;
|
|
34
|
+
else if (typeof value === 'number')
|
|
35
|
+
v = BigInt(value);
|
|
36
|
+
else
|
|
37
|
+
v = BigInt(value); // decimal or 0x string
|
|
38
|
+
if (v < 0n)
|
|
39
|
+
throw new Error('eip712: negative uint');
|
|
40
|
+
const out = new Uint8Array(32);
|
|
41
|
+
for (let i = 31; i >= 0 && v > 0n; i--) {
|
|
42
|
+
out[i] = Number(v & 0xffn);
|
|
43
|
+
v >>= 8n;
|
|
44
|
+
}
|
|
45
|
+
return out;
|
|
46
|
+
}
|
|
47
|
+
/** Left-pad a 20-byte address to a 32-byte word. */
|
|
48
|
+
function encodeAddress(addr) {
|
|
49
|
+
const bytes = hexToBytes(addr);
|
|
50
|
+
if (bytes.length !== 20)
|
|
51
|
+
throw new Error(`eip712: address must be 20 bytes, got ${bytes.length}`);
|
|
52
|
+
const out = new Uint8Array(32);
|
|
53
|
+
out.set(bytes, 12);
|
|
54
|
+
return out;
|
|
55
|
+
}
|
|
56
|
+
/** A bytes32 value, used as-is (must already be 32 bytes). */
|
|
57
|
+
function encodeBytes32(hex) {
|
|
58
|
+
const bytes = hexToBytes(hex);
|
|
59
|
+
if (bytes.length !== 32)
|
|
60
|
+
throw new Error(`eip712: bytes32 must be 32 bytes, got ${bytes.length}`);
|
|
61
|
+
return bytes;
|
|
62
|
+
}
|
|
63
|
+
function concat(...arrays) {
|
|
64
|
+
let total = 0;
|
|
65
|
+
for (const a of arrays)
|
|
66
|
+
total += a.length;
|
|
67
|
+
const out = new Uint8Array(total);
|
|
68
|
+
let off = 0;
|
|
69
|
+
for (const a of arrays) {
|
|
70
|
+
out.set(a, off);
|
|
71
|
+
off += a.length;
|
|
72
|
+
}
|
|
73
|
+
return out;
|
|
74
|
+
}
|
|
75
|
+
function hexToBytes(hex) {
|
|
76
|
+
let h = hex.startsWith('0x') || hex.startsWith('0X') ? hex.slice(2) : hex;
|
|
77
|
+
if (h.length % 2 !== 0)
|
|
78
|
+
h = '0' + h;
|
|
79
|
+
const out = new Uint8Array(h.length / 2);
|
|
80
|
+
for (let i = 0; i < out.length; i++) {
|
|
81
|
+
out[i] = parseInt(h.slice(i * 2, i * 2 + 2), 16);
|
|
82
|
+
}
|
|
83
|
+
return out;
|
|
84
|
+
}
|
|
85
|
+
function bytesToHex(bytes) {
|
|
86
|
+
let hex = '';
|
|
87
|
+
for (let i = 0; i < bytes.length; i++)
|
|
88
|
+
hex += bytes[i].toString(16).padStart(2, '0');
|
|
89
|
+
return hex;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* The EIP-712 domain separator: keccak256 over the domain typehash and the
|
|
93
|
+
* four standard fields. Every domain in this SDK uses exactly these fields, so
|
|
94
|
+
* there is no `salt` / `extensions` handling here.
|
|
95
|
+
*/
|
|
96
|
+
function eip712DomainSeparator(name, version, chainId, verifyingContract) {
|
|
97
|
+
const typeHash = keccak256Hex('EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)');
|
|
98
|
+
return ('0x' +
|
|
99
|
+
bytesToHex(keccak256(concat(hexToBytes(typeHash), keccak256(utf8(name)), keccak256(utf8(version)), encodeUint(chainId), encodeAddress(verifyingContract)))));
|
|
100
|
+
}
|
|
101
|
+
/** keccak256(0x1901 ‖ domainSeparator ‖ structHash) — the value that is signed. */
|
|
102
|
+
function eip712Digest(domainSeparatorHex, structHash) {
|
|
103
|
+
const digest = keccak256(concat(new Uint8Array([0x19, 0x01]), hexToBytes(domainSeparatorHex), structHash));
|
|
104
|
+
return '0x' + bytesToHex(digest);
|
|
105
|
+
}
|
|
106
|
+
// --- secp256k1 signing / recovery ---
|
|
107
|
+
function normalizePrivKey(privateKey) {
|
|
108
|
+
if (privateKey instanceof Uint8Array)
|
|
109
|
+
return privateKey;
|
|
110
|
+
return hexToBytes(privateKey);
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Sign a 32-byte digest, returning un-prefixed `r ‖ s ‖ v` hex (v ∈ {27,28}) —
|
|
114
|
+
* the layout `ecrecover` / OpenZeppelin `ECDSA.recover` expect. Canonical
|
|
115
|
+
* (low-s), satisfying EIP-2.
|
|
116
|
+
*/
|
|
117
|
+
function signDigest(privateKey, digest) {
|
|
118
|
+
const priv = normalizePrivKey(privateKey);
|
|
119
|
+
// @noble/curves v2: `format: 'recovered'` returns 65 bytes laid out as
|
|
120
|
+
// [recoveryId(1) ‖ r(32) ‖ s(32)]; signatures are canonical (low-s) by
|
|
121
|
+
// default, satisfying EIP-2. We re-pack to the ecrecover layout r‖s‖v.
|
|
122
|
+
const recovered = secp256k1_js_1.secp256k1.sign(digest, priv, { prehash: false, format: 'recovered' });
|
|
123
|
+
if (recovered.length !== 65)
|
|
124
|
+
throw new Error(`eip712: unexpected recovered sig length ${recovered.length}`);
|
|
125
|
+
const recId = recovered[0];
|
|
126
|
+
if (recId !== 0 && recId !== 1)
|
|
127
|
+
throw new Error('eip712: unexpected recovery id');
|
|
128
|
+
const r = recovered.slice(1, 33);
|
|
129
|
+
const s = recovered.slice(33, 65);
|
|
130
|
+
const v = new Uint8Array([recId + 27]);
|
|
131
|
+
return bytesToHex(concat(r, s, v));
|
|
132
|
+
}
|
|
133
|
+
/** Recover the EIP-55 checksummed signer address from a 65-byte signature. */
|
|
134
|
+
function recoverAddress(signature, digest) {
|
|
135
|
+
const bytes = hexToBytes(signature);
|
|
136
|
+
if (bytes.length !== 65)
|
|
137
|
+
throw new Error(`eip712: signature must be 65 bytes, got ${bytes.length}`);
|
|
138
|
+
const recId = bytes[64] - 27;
|
|
139
|
+
if (recId !== 0 && recId !== 1)
|
|
140
|
+
throw new Error('eip712: bad v byte');
|
|
141
|
+
// Re-assemble the @noble 'recovered' layout: [recoveryId ‖ r ‖ s].
|
|
142
|
+
const recovered = concat(new Uint8Array([recId]), bytes.slice(0, 32), bytes.slice(32, 64));
|
|
143
|
+
const sig = secp256k1_js_1.secp256k1.Signature.fromBytes(recovered, 'recovered');
|
|
144
|
+
const point = sig.recoverPublicKey(digest);
|
|
145
|
+
const pub = point.toBytes(false).subarray(1); // uncompressed, drop 0x04 prefix
|
|
146
|
+
const hash = keccak256(pub);
|
|
147
|
+
return checksumAddress(bytesToHex(hash.slice(-20)));
|
|
148
|
+
}
|
|
149
|
+
/** EIP-55 checksum (mirrors recovery.ts). */
|
|
150
|
+
function checksumAddress(addressHex) {
|
|
151
|
+
const hash = bytesToHex(keccak256(utf8(addressHex)));
|
|
152
|
+
let result = '0x';
|
|
153
|
+
for (let i = 0; i < 40; i++) {
|
|
154
|
+
result += parseInt(hash[i], 16) >= 8 ? addressHex[i].toUpperCase() : addressHex[i];
|
|
155
|
+
}
|
|
156
|
+
return result;
|
|
157
|
+
}
|
|
158
|
+
//# sourceMappingURL=eip712.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"eip712.js","sourceRoot":"","sources":["../src/eip712.ts"],"names":[],"mappings":";;AAiBA,8BAEC;AAGD,oCAEC;AAED,oBAEC;AAGD,gCAYC;AAGD,sCAMC;AAGD,sCAIC;AAED,wBAUC;AAED,gCAQC;AAED,gCAIC;AAOD,sDAuBC;AAGD,oCAKC;AAcD,gCAaC;AAGD,wCAYC;AAGD,0CAOC;AAjLD,mDAAmD;AACnD,6DAAuD;AAgBvD,SAAgB,SAAS,CAAC,IAAgB;IACxC,OAAO,IAAA,oBAAU,EAAC,IAAI,CAAC,CAAC;AAC1B,CAAC;AAED,4EAA4E;AAC5E,SAAgB,YAAY,CAAC,CAAS;IACpC,OAAO,UAAU,CAAC,IAAA,oBAAU,EAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACzC,CAAC;AAED,SAAgB,IAAI,CAAC,CAAS;IAC5B,OAAO,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,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/dist/index.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ export type { WatchStreamState, OperationUpdate, BalanceSnapshot, BalanceUpdate,
|
|
|
10
10
|
export type { MarketPriceStream } from './arca';
|
|
11
11
|
export type { PnlHistoryAnchor, PnlHistoryOptions, HistoryScopeOptions, WatchPricesOptions } from './arca';
|
|
12
12
|
export type { WaitOptions, OrderHandleDeps } from './operation-handle';
|
|
13
|
-
export type { TokenProvider, AuthErrorListener, ArcaConfig, ArcaApiKeyConfig, ArcaTokenConfig, ArcaObject, ArcaObjectType, ArcaObjectStatus, IsolationInfo, ArcaObjectListResponse, ArcaObjectBrowseResponse, BrowsePathEntry, BrowsePathKind, ArcaObjectDetailResponse, ArcaObjectVersionsResponse, IsolationZone, ArcaBalance, ArcaBalanceListResponse, EnsureArcaObjectResponse, DeleteArcaObjectResponse, Operation, OperationType, OperationState, OperationListResponse, OperationDetailResponse, OperationEvidence, OperationEvidenceJournal, OperationEvidenceIntegrity, OperationEvidenceExportResponse, JournalEntryEvidence, JournalLegEvidence, JournalProofEvidence, ChainTransactionEvidence, IntegrityAnnotation, ProofUniquenessEvidence, CryptographicSequenceState, OperationContext, FillContext, FeeBreakdown, TransferContext, DepositContext, WithdrawalContext, OrderPlacedContext, CancelContext, DeleteContext, ArcaEvent, EventListResponse, EventDetailResponse, StateDelta, DeltaType, StateDeltaListResponse, FundAccountResponse, TransferResponse, NonceResponse, ExplorerSummary, BatchSummariesResponse, CanonicalPosition, SnapshotBalancesResponse, AssetBreakdown, BalanceValue, PositionValue, ReservedValue, ObjectValuation, PathAggregation, RealmProjection, ProjectedValuation, ProjectionValuationsPage, GetProjectionValuationsOptions, PnlResponse, PnlHistoryResponse, PnlPoint, ExternalFlowEntry, EquityHistoryResponse, EquityPoint, AggregationSourceDto, CreateWatchResponse, WatchAggregationOptions, Watermark, ConsistentReadScope, ConsistentReadValue, ConsistentReadResult, ReconciliationState, ReconciliationStateListResponse, BuilderProfile, AuthResponse, RefreshResponse, ApiKeyStatus, ApiKey, ApiKeyPermissions, CreateApiKeyOptions, ApiKeyCreatedResponse, ApiKeyListResponse, BrowseObjectsOptions, CreateIsolationZoneOptions, Realm, RealmSettings, RealmType, RealmAsset, RealmLifecycle, RealmBacking, CreateRealmAxes, EnsureDenominatedArcaOptions, EnsureArcaOptions, EnsureInfoOptions, UpdateLabelsOptions, EnsureDeletedOptions, TransferOptions, FundAccountOptions, DefundAccountOptions, DefundAccountResponse, ListObjectsOptions, ListEventsOptions, ListOperationsOptions, GetOperationOptions, ExportOperationEvidenceOptions, EventConnectionStatus, EventCallback, EventEnvelope, RealmEvent, TypedRealmEvent, OperationCreatedEvent, OperationUpdatedEvent, EventCreatedEvent, ObjectCreatedEvent, ObjectUpdatedEvent, ObjectDeletedEvent, BalanceUpdatedEvent, ExchangeUpdatedEvent, FillPreviewedEvent, FillRecordedEvent, ExchangeFundingEvent, FundingPayment, AggregationUpdatedEvent, ObjectValuationEvent, FrameEvent, FrameAccount, MidsUpdatedEvent, CandleClosedEvent, CandleUpdatedEvent, OIUpdatedEvent, RealmCreatedEvent, PolicyEffect, PolicyStatement, TokenScope, MintTokenRequest, MintTokenResponse, ActionCatalogEntry, AliasCatalogEntry, PermissionCatalogResponse, ReservedBalance, ReservedBalanceStatus, ArcaPositionCurrent, RealmListResponse, CreatePerpsExchangeOptions, PredictedEffect, PlaceOrderOptions, ClosePositionOptions, SetPositionTriggerOptions, SetPositionTpslOptions, SetPositionTpslResult, OpenBracketOptions, OpenBracketResult, ClearPositionTpslOptions, CancelOrderOptions, ModifyOrderOptions, OrderOperationResponse, PlaceTwapOptions, TwapOperationResponse, Twap, TwapStatus, TwapLimits, OrderLimits, MinOrderSizeOptions, MinOrderSize, ValidateOrderSizeOptions, OrderSizeValidation, UpdateLeverageOptions, UpdateLeverageResponse, UpdateIsolatedMarginOptions, UpdateIsolatedMarginResponse, SetMarginModeOptions, SetMarginModeResponse, LeverageSetting, SimAccount, SimMarginSummary, OrderSide, PositionSide, OrderStatus, LeverageType, MarginMode, SimPosition, SimPositionId, PositionListResponse, OrderListResponse, SimOrder, SimFill, SimOrderWithFills, ExchangeIntent, ExchangeState, Fill, FillDirection, FillResultingPosition, FillListResponse, ListFillsOptions, ListRealmFillsOptions, WatchRealmFillsOptions, OpenPositionCosts, MarketTradeSummary, TradeSummaryTotals, TradeSummaryResponse, TradeSummaryOptions, ActiveAssetData, OrderBreakdownAmountType, OrderBreakdownOptions, OrderBreakdown, AssetFeeEntry, SimFeeRates, SimFeeTierEntry, Market, SimMetaResponse, SimMidsResponse, MarketTicker, MarketTickersResponse, SimBookLevel, SimBookResponse, CandleInterval, Candle, CandlesResponse, CandleEvent, OIBar, OIHistoryResponse, FundingObservation, FundingHistoryResponse, OIEvent, MarketTrade, TradeEvent, TradeExecutedEvent, LoadRangeResult, CandleChartUpdate, SparklinesResponse, InvariantViolation, InvariantCheckResult, InvariantCheckResponse, AuthAuditEventType, AuthAuditEntry, AuthAuditListResponse, AuthAuditFilters, CredentialScopeResponse, OrgRole, MemberType, InvitationStatus, Organization, OrgMember, OrgMemberListResponse, Invitation, InvitationListResponse, InvitationPreview, InviteMemberRequest, MyOrgMembership, CreateOrgResponse, UpdateMemberRequest, AgentEvent, AgentTextEvent, AgentToolUseEvent, AgentPlanEvent, AgentPlanStep, AgentConversationLogEvent, AgentDoneEvent, AgentStepUpdatedEvent, AgentExecutionDoneEvent, WatchSnapshot, WatchSnapshotBalanceEntry, CustodyBoundaryStatus, CustodyExchangeArcaStatus, CustodyRealmHaltType, CustodyPendingExit, CustodyBoundary, CustodyExchangeArca, CustodyRealmHalt, CustodyImplRef, CustodyImplementations, CustodyStatus, CustodyBoundaryListResponse, CustodyExchangeArcaListResponse, RegisterRecoveryKeyOptions, RegisterRecoveryKeyResponse, PreparedCustodyTransaction, GeneratedRecoveryKey, ActiveTerms, } from './types';
|
|
13
|
+
export type { TokenProvider, AuthErrorListener, ArcaConfig, ArcaApiKeyConfig, ArcaTokenConfig, ArcaObject, ArcaObjectType, ArcaObjectStatus, IsolationInfo, ArcaObjectListResponse, ArcaObjectBrowseResponse, BrowsePathEntry, BrowsePathKind, ArcaObjectDetailResponse, ArcaObjectVersionsResponse, IsolationZone, ArcaBalance, ArcaBalanceListResponse, EnsureArcaObjectResponse, DeleteArcaObjectResponse, Operation, OperationType, OperationState, OperationListResponse, OperationDetailResponse, OperationEvidence, OperationEvidenceJournal, OperationEvidenceIntegrity, OperationEvidenceExportResponse, JournalEntryEvidence, JournalLegEvidence, JournalProofEvidence, ChainTransactionEvidence, IntegrityAnnotation, ProofUniquenessEvidence, CryptographicSequenceState, OperationContext, FillContext, FeeBreakdown, TransferContext, DepositContext, WithdrawalContext, OrderPlacedContext, CancelContext, DeleteContext, ArcaEvent, EventListResponse, EventDetailResponse, StateDelta, DeltaType, StateDeltaListResponse, FundAccountResponse, TransferResponse, NonceResponse, ExplorerSummary, BatchSummariesResponse, CanonicalPosition, SnapshotBalancesResponse, AssetBreakdown, BalanceValue, PositionValue, ReservedValue, ObjectValuation, PathAggregation, RealmProjection, ProjectedValuation, ProjectionValuationsPage, GetProjectionValuationsOptions, PnlResponse, PnlHistoryResponse, PnlPoint, ExternalFlowEntry, EquityHistoryResponse, EquityPoint, AggregationSourceDto, CreateWatchResponse, WatchAggregationOptions, Watermark, ConsistentReadScope, ConsistentReadValue, ConsistentReadResult, ReconciliationState, ReconciliationStateListResponse, BuilderProfile, AuthResponse, RefreshResponse, ApiKeyStatus, ApiKey, ApiKeyPermissions, CreateApiKeyOptions, ApiKeyCreatedResponse, ApiKeyListResponse, BrowseObjectsOptions, CreateIsolationZoneOptions, ListIsolationZonesOptions, IsolationZoneListResponse, ArchiveIsolationZoneOptions, Realm, RealmSettings, RealmType, RealmAsset, RealmLifecycle, RealmBacking, CreateRealmAxes, EnsureDenominatedArcaOptions, EnsureArcaOptions, EnsureInfoOptions, UpdateLabelsOptions, FolderLabelsResponse, UpdateFolderLabelsRequest, PatchFolderLabelsRequest, EnsureDeletedOptions, TransferOptions, FundAccountOptions, DefundAccountOptions, DefundAccountResponse, ListObjectsOptions, ListEventsOptions, ListOperationsOptions, GetOperationOptions, ExportOperationEvidenceOptions, EventConnectionStatus, EventCallback, EventEnvelope, RealmEvent, TypedRealmEvent, OperationCreatedEvent, OperationUpdatedEvent, EventCreatedEvent, ObjectCreatedEvent, ObjectUpdatedEvent, ObjectDeletedEvent, BalanceUpdatedEvent, ExchangeUpdatedEvent, FillPreviewedEvent, FillRecordedEvent, ExchangeFundingEvent, FundingPayment, AggregationUpdatedEvent, ObjectValuationEvent, FrameEvent, FrameAccount, MidsUpdatedEvent, CandleClosedEvent, CandleUpdatedEvent, OIUpdatedEvent, RealmCreatedEvent, PolicyEffect, PolicyStatement, TokenScope, MintTokenRequest, MintTokenResponse, ActionCatalogEntry, AliasCatalogEntry, PermissionCatalogResponse, ReservedBalance, ReservedBalanceStatus, ArcaPositionCurrent, RealmListResponse, CreatePerpsExchangeOptions, PredictedEffect, PlaceOrderOptions, ClosePositionOptions, SetPositionTriggerOptions, SetPositionTpslOptions, SetPositionTpslResult, OpenBracketOptions, OpenBracketResult, ClearPositionTpslOptions, CancelOrderOptions, ModifyOrderOptions, OrderOperationResponse, PlaceTwapOptions, TwapOperationResponse, Twap, TwapStatus, TwapLimits, OrderLimits, MinOrderSizeOptions, MinOrderSize, ValidateOrderSizeOptions, OrderSizeValidation, UpdateLeverageOptions, UpdateLeverageResponse, UpdateIsolatedMarginOptions, UpdateIsolatedMarginResponse, SetMarginModeOptions, SetMarginModeResponse, LeverageSetting, SimAccount, SimMarginSummary, OrderSide, PositionSide, OrderStatus, LeverageType, MarginMode, SimPosition, SimPositionId, PositionListResponse, OrderListResponse, SimOrder, SimFill, SimOrderWithFills, ExchangeIntent, ExchangeState, Fill, FillDirection, FillResultingPosition, FillListResponse, ListFillsOptions, ListRealmFillsOptions, WatchRealmFillsOptions, OpenPositionCosts, MarketTradeSummary, TradeSummaryTotals, TradeSummaryResponse, TradeSummaryOptions, ActiveAssetData, OrderBreakdownAmountType, OrderBreakdownOptions, OrderBreakdown, AssetFeeEntry, SimFeeRates, SimFeeTierEntry, Market, SimMetaResponse, SimMidsResponse, MarketTicker, MarketTickersResponse, SimBookLevel, SimBookResponse, CandleInterval, Candle, CandlesResponse, CandleEvent, OIBar, OIHistoryResponse, FundingObservation, FundingHistoryResponse, OIEvent, MarketTrade, TradeEvent, TradeExecutedEvent, LoadRangeResult, CandleChartUpdate, SparklinesResponse, InvariantViolation, InvariantCheckResult, InvariantCheckResponse, AuthAuditEventType, AuthAuditEntry, AuthAuditListResponse, AuthAuditFilters, CredentialScopeResponse, OrgRole, MemberType, InvitationStatus, Organization, OrgMember, OrgMemberListResponse, Invitation, InvitationListResponse, InvitationPreview, InviteMemberRequest, MyOrgMembership, CreateOrgResponse, UpdateMemberRequest, AgentEvent, AgentTextEvent, AgentToolUseEvent, AgentPlanEvent, AgentPlanStep, AgentConversationLogEvent, AgentDoneEvent, AgentStepUpdatedEvent, AgentExecutionDoneEvent, WatchSnapshot, WatchSnapshotBalanceEntry, CustodyBoundaryStatus, CustodyExchangeArcaStatus, CustodyRealmHaltType, CustodyPendingExit, CustodyBoundary, CustodyExchangeArca, CustodyRealmHalt, CustodyImplRef, CustodyImplementations, CustodyStatus, CustodyBoundaryListResponse, CustodyExchangeArcaListResponse, RegisterRecoveryKeyOptions, RegisterRecoveryKeyResponse, PreparedCustodyTransaction, GeneratedRecoveryKey, ActiveTerms, } from './types';
|
|
14
14
|
export { EventType, Channel, toTypedEvent } from './types';
|
|
15
15
|
export type { CacheConfig } from './cache';
|
|
16
16
|
export { pickResolution, pickResolutionFromIso, bucketMs, retentionMs, alignDown, alignUp, boundaries, promotionTarget, ALL_RESOLUTIONS, DEFAULT_POINTS, MIN_POINTS, } from './ladder';
|
|
@@ -19,6 +19,8 @@ export { generateRecoveryKeyPair, encodeRecoveryCloseOrder, RECOVERY_CLOSE_PX_BA
|
|
|
19
19
|
export type { RecoveryCloseOrderInput, RecoveryCloseOrder } from './recovery';
|
|
20
20
|
export { CosignAction, CosignActionV4, domainSeparator as cosignDomainSeparator, operatorActionDigest, signOperatorAction, recoverOperatorActionSigner, withdrawParamsHash, withdrawParamsHashV5, crossTransferParamsHash, allocateToVenueParamsHash, reassignAccountBoundaryParamsHash, accountAddAgentParamsHash, accountMigrateParentParamsHash, rotateSovereignKeyParamsHash, accountApproveBuilderFeeParamsHash, raiseLienParamsHash, signWithdraw, signCrossTransfer, signAllocateToVenue, signReassignAccountBoundary, signAccountAddAgent, signAccountMigrateParent, signRotateSovereignKey, signAccountApproveBuilderFee, signRaiseLien, OPERATOR_ACTION_TYPEHASH_HEX, addressDeviceSigner, verifierDeviceSigner, p256DeviceKey, p256DeviceSigner, encodeP256Signature, deviceSignerHash, encodeRegistryCosignBlob, CosignerManageAction, cosignRegistryDomainSeparator, cosignerManageDigest, signCosignerManage, recoverCosignerManageSigner, } from './cosign';
|
|
21
21
|
export type { OperatorAction, CosignContext, CosignDeviceItem, CosignerManage } from './cosign';
|
|
22
|
+
export { custodyKey, bindingTypedData, permitTypedData, bindingDigest, permitDigest, signBinding, signPermit, recoverBindingSigner, recoverPermitSigner, BIND_DESTINATION_TYPEHASH_HEX, BIND_BOUNDARY_TYPEHASH_HEX, PERMIT_TYPEHASH_HEX, } from './deposit-auth';
|
|
23
|
+
export type { DepositAuthorizationParams, DepositAuthorizationPayload, BindingTerms, PermitTerms, Eip712Domain, Eip712Field, Eip712TypedData, } from './deposit-auth';
|
|
22
24
|
export { default as cosignVectors } from './fixtures/cosign-vectors.json';
|
|
23
25
|
export { revalueObject, revalueAggregation, revalueExchangeState, revalueProjectedValuation } from './revalue';
|
|
24
26
|
export { ArcaError, ValidationError, UnauthorizedError, ForbiddenError, NotFoundError, ConflictError, InternalError, ExchangeError, ExchangeProvisioningError, OperationFailedError, OperationStalledError, StepUpRequiredError, StepUpCancelledError, } from './errors';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d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E,cAAc,EAAE,MAAM,UAAU,CAAC;AAMhG,OAAO,EACL,UAAU,EACV,gBAAgB,EAChB,eAAe,EACf,aAAa,EACb,YAAY,EACZ,WAAW,EACX,UAAU,EACV,oBAAoB,EACpB,mBAAmB,EACnB,6BAA6B,EAC7B,0BAA0B,EAC1B,mBAAmB,GACpB,MAAM,gBAAgB,CAAC;AACxB,YAAY,EACV,0BAA0B,EAC1B,2BAA2B,EAC3B,YAAY,EACZ,WAAW,EACX,YAAY,EACZ,WAAW,EACX,eAAe,GAChB,MAAM,gBAAgB,CAAC;AAKxB,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAG1E,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,yBAAyB,EAAE,MAAM,WAAW,CAAC;AAG/G,OAAO,EACL,SAAS,EACT,eAAe,EACf,iBAAiB,EACjB,cAAc,EACd,aAAa,EACb,aAAa,EACb,aAAa,EACb,aAAa,EACb,yBAAyB,EACzB,oBAAoB,EACpB,qBAAqB,EACrB,mBAAmB,EACnB,oBAAoB,GACrB,MAAM,UAAU,CAAC;AAClB,YAAY,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -4,7 +4,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.recoverOperatorActionSigner = exports.signOperatorAction = exports.operatorActionDigest = exports.cosignDomainSeparator = exports.CosignActionV4 = exports.CosignAction = exports.RECOVERY_CLOSE_PX_BAND_BPS = exports.encodeRecoveryCloseOrder = exports.generateRecoveryKeyPair = exports.MIN_POINTS = exports.DEFAULT_POINTS = exports.ALL_RESOLUTIONS = exports.promotionTarget = exports.boundaries = exports.alignUp = exports.alignDown = exports.retentionMs = exports.bucketMs = exports.pickResolutionFromIso = exports.pickResolution = exports.toTypedEvent = exports.Channel = exports.EventType = exports.WatchStreamReadyTimeoutError = exports.FundingWatchStream = exports.RealmFillWatchStream = exports.FillWatchStream = exports.TwapWatchStream = exports.TradeWatchStream = exports.ExchangeWatchStream = exports.CoverageTracker = exports.CandleChartStream = exports.OIWatchStream = exports.CandleWatchStream = exports.PriceWatchStream = exports.MaxOrderSizeWatchStream = exports.PnlChartStream = exports.EquityChartStream = exports.ProjectionWatchStream = exports.AggregationWatchStream = exports.ObjectsWatchStream = exports.ObjectWatchStream = exports.BalanceWatchStream = exports.OperationWatchStream = exports.OrderHandle = exports.OperationHandle = exports.WebSocketManager = exports.ArcaAdmin = exports.computeChartRange = exports.Arca = void 0;
|
|
7
|
-
exports.
|
|
7
|
+
exports.ArcaError = exports.revalueProjectedValuation = exports.revalueExchangeState = exports.revalueAggregation = exports.revalueObject = exports.cosignVectors = exports.PERMIT_TYPEHASH_HEX = exports.BIND_BOUNDARY_TYPEHASH_HEX = exports.BIND_DESTINATION_TYPEHASH_HEX = exports.recoverPermitSigner = exports.recoverBindingSigner = exports.signPermit = exports.signBinding = exports.permitDigest = exports.bindingDigest = exports.permitTypedData = exports.bindingTypedData = exports.custodyKey = exports.recoverCosignerManageSigner = exports.signCosignerManage = exports.cosignerManageDigest = exports.cosignRegistryDomainSeparator = exports.CosignerManageAction = exports.encodeRegistryCosignBlob = exports.deviceSignerHash = exports.encodeP256Signature = exports.p256DeviceSigner = exports.p256DeviceKey = exports.verifierDeviceSigner = exports.addressDeviceSigner = exports.OPERATOR_ACTION_TYPEHASH_HEX = exports.signRaiseLien = exports.signAccountApproveBuilderFee = exports.signRotateSovereignKey = exports.signAccountMigrateParent = exports.signAccountAddAgent = exports.signReassignAccountBoundary = exports.signAllocateToVenue = exports.signCrossTransfer = exports.signWithdraw = exports.raiseLienParamsHash = exports.accountApproveBuilderFeeParamsHash = exports.rotateSovereignKeyParamsHash = exports.accountMigrateParentParamsHash = exports.accountAddAgentParamsHash = exports.reassignAccountBoundaryParamsHash = exports.allocateToVenueParamsHash = exports.crossTransferParamsHash = exports.withdrawParamsHashV5 = exports.withdrawParamsHash = void 0;
|
|
8
|
+
exports.StepUpCancelledError = exports.StepUpRequiredError = exports.OperationStalledError = exports.OperationFailedError = exports.ExchangeProvisioningError = exports.ExchangeError = exports.InternalError = exports.ConflictError = exports.NotFoundError = exports.ForbiddenError = exports.UnauthorizedError = exports.ValidationError = void 0;
|
|
8
9
|
// Main SDK entry point
|
|
9
10
|
var arca_1 = require("./arca");
|
|
10
11
|
Object.defineProperty(exports, "Arca", { enumerable: true, get: function () { return arca_1.Arca; } });
|
|
@@ -106,6 +107,23 @@ Object.defineProperty(exports, "cosignRegistryDomainSeparator", { enumerable: tr
|
|
|
106
107
|
Object.defineProperty(exports, "cosignerManageDigest", { enumerable: true, get: function () { return cosign_1.cosignerManageDigest; } });
|
|
107
108
|
Object.defineProperty(exports, "signCosignerManage", { enumerable: true, get: function () { return cosign_1.signCosignerManage; } });
|
|
108
109
|
Object.defineProperty(exports, "recoverCosignerManageSigner", { enumerable: true, get: function () { return cosign_1.recoverCosignerManageSigner; } });
|
|
110
|
+
// Standing deposit authorizations: the two signatures that let a user's own
|
|
111
|
+
// wallet have deposits swept without ever sending a transaction or holding
|
|
112
|
+
// native gas. Everything these take comes from
|
|
113
|
+
// GET /api/v1/custody/deposits/authorization-params.
|
|
114
|
+
var deposit_auth_1 = require("./deposit-auth");
|
|
115
|
+
Object.defineProperty(exports, "custodyKey", { enumerable: true, get: function () { return deposit_auth_1.custodyKey; } });
|
|
116
|
+
Object.defineProperty(exports, "bindingTypedData", { enumerable: true, get: function () { return deposit_auth_1.bindingTypedData; } });
|
|
117
|
+
Object.defineProperty(exports, "permitTypedData", { enumerable: true, get: function () { return deposit_auth_1.permitTypedData; } });
|
|
118
|
+
Object.defineProperty(exports, "bindingDigest", { enumerable: true, get: function () { return deposit_auth_1.bindingDigest; } });
|
|
119
|
+
Object.defineProperty(exports, "permitDigest", { enumerable: true, get: function () { return deposit_auth_1.permitDigest; } });
|
|
120
|
+
Object.defineProperty(exports, "signBinding", { enumerable: true, get: function () { return deposit_auth_1.signBinding; } });
|
|
121
|
+
Object.defineProperty(exports, "signPermit", { enumerable: true, get: function () { return deposit_auth_1.signPermit; } });
|
|
122
|
+
Object.defineProperty(exports, "recoverBindingSigner", { enumerable: true, get: function () { return deposit_auth_1.recoverBindingSigner; } });
|
|
123
|
+
Object.defineProperty(exports, "recoverPermitSigner", { enumerable: true, get: function () { return deposit_auth_1.recoverPermitSigner; } });
|
|
124
|
+
Object.defineProperty(exports, "BIND_DESTINATION_TYPEHASH_HEX", { enumerable: true, get: function () { return deposit_auth_1.BIND_DESTINATION_TYPEHASH_HEX; } });
|
|
125
|
+
Object.defineProperty(exports, "BIND_BOUNDARY_TYPEHASH_HEX", { enumerable: true, get: function () { return deposit_auth_1.BIND_BOUNDARY_TYPEHASH_HEX; } });
|
|
126
|
+
Object.defineProperty(exports, "PERMIT_TYPEHASH_HEX", { enumerable: true, get: function () { return deposit_auth_1.PERMIT_TYPEHASH_HEX; } });
|
|
109
127
|
// Cross-SDK golden vectors for the co-signed OperatorAction wire contract.
|
|
110
128
|
// Shipped so downstream ports (Gobi iOS, the Solidity kernel test) can pin the
|
|
111
129
|
// exact same digests/signatures. Regenerate with scripts/gen-cosign-vectors.ts.
|