@sequence0/sdk 2.0.1 → 2.1.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/README.md +10 -10
- package/dist/chains/casper.d.ts +74 -0
- package/dist/chains/casper.d.ts.map +1 -0
- package/dist/chains/casper.js +512 -0
- package/dist/chains/casper.js.map +1 -0
- package/dist/chains/cosmos.d.ts +22 -0
- package/dist/chains/cosmos.d.ts.map +1 -1
- package/dist/chains/cosmos.js +113 -12
- package/dist/chains/cosmos.js.map +1 -1
- package/dist/chains/ethereum.d.ts.map +1 -1
- package/dist/chains/ethereum.js +14 -2
- package/dist/chains/ethereum.js.map +1 -1
- package/dist/chains/flow.d.ts +57 -0
- package/dist/chains/flow.d.ts.map +1 -0
- package/dist/chains/flow.js +435 -0
- package/dist/chains/flow.js.map +1 -0
- package/dist/chains/icp.d.ts.map +1 -1
- package/dist/chains/icp.js +483 -67
- package/dist/chains/icp.js.map +1 -1
- package/dist/chains/iota.d.ts +80 -0
- package/dist/chains/iota.d.ts.map +1 -0
- package/dist/chains/iota.js +502 -0
- package/dist/chains/iota.js.map +1 -0
- package/dist/chains/kadena.d.ts +81 -0
- package/dist/chains/kadena.d.ts.map +1 -0
- package/dist/chains/kadena.js +356 -0
- package/dist/chains/kadena.js.map +1 -0
- package/dist/chains/near.d.ts +4 -1
- package/dist/chains/near.d.ts.map +1 -1
- package/dist/chains/near.js +58 -15
- package/dist/chains/near.js.map +1 -1
- package/dist/chains/nervos.d.ts +148 -0
- package/dist/chains/nervos.d.ts.map +1 -0
- package/dist/chains/nervos.js +913 -0
- package/dist/chains/nervos.js.map +1 -0
- package/dist/chains/radix.d.ts +81 -0
- package/dist/chains/radix.d.ts.map +1 -0
- package/dist/chains/radix.js +289 -0
- package/dist/chains/radix.js.map +1 -0
- package/dist/chains/solana.d.ts +4 -0
- package/dist/chains/solana.d.ts.map +1 -1
- package/dist/chains/solana.js +47 -13
- package/dist/chains/solana.js.map +1 -1
- package/dist/chains/stacks.d.ts +113 -0
- package/dist/chains/stacks.d.ts.map +1 -0
- package/dist/chains/stacks.js +576 -0
- package/dist/chains/stacks.js.map +1 -0
- package/dist/chains/sui.d.ts +11 -0
- package/dist/chains/sui.d.ts.map +1 -1
- package/dist/chains/sui.js +49 -8
- package/dist/chains/sui.js.map +1 -1
- package/dist/core/client.js +1 -1
- package/dist/core/client.js.map +1 -1
- package/dist/core/solvency.d.ts +1 -1
- package/dist/core/solvency.js +1 -1
- package/dist/core/types.d.ts +94 -2
- package/dist/core/types.d.ts.map +1 -1
- package/dist/core/universal-account.d.ts +1 -1
- package/dist/core/universal-account.js +1 -1
- package/dist/core/witness.d.ts +1 -1
- package/dist/core/witness.js +1 -1
- package/dist/settlement/settlement.d.ts +1 -1
- package/dist/settlement/settlement.js +1 -1
- package/dist/utils/discovery.d.ts.map +1 -1
- package/dist/utils/discovery.js +19 -2
- package/dist/utils/discovery.js.map +1 -1
- package/dist/utils/http.d.ts +1 -1
- package/dist/utils/http.js +1 -1
- package/dist/wallet/wallet.d.ts.map +1 -1
- package/dist/wallet/wallet.js +45 -0
- package/dist/wallet/wallet.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -30,7 +30,7 @@ const txHash = await wallet.sendTransaction({
|
|
|
30
30
|
console.log('TX Hash:', txHash);
|
|
31
31
|
```
|
|
32
32
|
|
|
33
|
-
## What's New in
|
|
33
|
+
## What's New in v2.0.1
|
|
34
34
|
|
|
35
35
|
### Bitcoin Taproot (P2TR) Support
|
|
36
36
|
|
|
@@ -294,32 +294,32 @@ try {
|
|
|
294
294
|
}
|
|
295
295
|
```
|
|
296
296
|
|
|
297
|
-
## Any Language (
|
|
297
|
+
## Any Language (HTTP)
|
|
298
298
|
|
|
299
|
-
This SDK wraps
|
|
299
|
+
This SDK wraps an internal **HTTP + JSON** interface exposed by every agent node. The SDK handles connection and discovery automatically, but you can also integrate from **any language** -- Python, Go, Rust, Java, etc. -- by calling the agent's HTTP endpoint directly:
|
|
300
300
|
|
|
301
301
|
```bash
|
|
302
302
|
# Health check
|
|
303
|
-
curl http://
|
|
303
|
+
curl http://AGENT_HOST:8080/health
|
|
304
304
|
|
|
305
305
|
# Create a wallet (DKG)
|
|
306
|
-
curl -X POST http://
|
|
306
|
+
curl -X POST http://AGENT_HOST:8080/dkg/initiate \
|
|
307
307
|
-H 'Content-Type: application/json' \
|
|
308
308
|
-d '{"wallet_id":"my-wallet","participants":["peer1","peer2"],"threshold":2,"curve":"secp256k1"}'
|
|
309
309
|
|
|
310
310
|
# Sign a message
|
|
311
|
-
curl -X POST http://
|
|
311
|
+
curl -X POST http://AGENT_HOST:8080/sign \
|
|
312
312
|
-H 'Content-Type: application/json' \
|
|
313
313
|
-d '{"wallet_id":"my-wallet","message":"48656c6c6f"}'
|
|
314
314
|
|
|
315
315
|
# Poll for signature
|
|
316
|
-
curl http://
|
|
316
|
+
curl http://AGENT_HOST:8080/sign/REQUEST_ID
|
|
317
317
|
```
|
|
318
318
|
|
|
319
|
-
**Testnet
|
|
320
|
-
**Mainnet**: Auto-discover agents from on-chain AgentRegistry, or connect to a known agent URL.
|
|
319
|
+
**Testnet agents**: Operated by Sequence0 at `3.140.248.117` (ports 8080-8082).
|
|
320
|
+
**Mainnet**: Auto-discover agents from the on-chain AgentRegistry, or connect to a known agent URL.
|
|
321
321
|
|
|
322
|
-
Full
|
|
322
|
+
Full HTTP reference: [sequence0.network/docs](https://sequence0.network/docs#app-developer-sdk)
|
|
323
323
|
|
|
324
324
|
## Networks
|
|
325
325
|
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Casper Network Chain Adapter
|
|
3
|
+
*
|
|
4
|
+
* Builds Casper deploys for native CSPR transfers, attaches Ed25519
|
|
5
|
+
* signatures from the FROST threshold signing network, and broadcasts
|
|
6
|
+
* via the Casper JSON-RPC API.
|
|
7
|
+
*
|
|
8
|
+
* Casper uses Ed25519 for signing. The signing payload is the deploy
|
|
9
|
+
* hash, which is Blake2b-256 of the serialized deploy header.
|
|
10
|
+
*
|
|
11
|
+
* No external dependencies — uses native fetch and crypto.
|
|
12
|
+
*
|
|
13
|
+
* Address format: 01<hex> (ed25519 public key prefixed with 01)
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```typescript
|
|
17
|
+
* import { CasperAdapter } from '@sequence0/sdk';
|
|
18
|
+
*
|
|
19
|
+
* const casper = new CasperAdapter('mainnet');
|
|
20
|
+
*
|
|
21
|
+
* const unsignedTx = await casper.buildTransaction(
|
|
22
|
+
* { to: '01abc...def', amount: '2500000000', publicKey: 'abc...def' },
|
|
23
|
+
* '01abc...def'
|
|
24
|
+
* );
|
|
25
|
+
*
|
|
26
|
+
* // ... sign via FROST ed25519 ...
|
|
27
|
+
* const signedTx = await casper.attachSignature(unsignedTx, signatureHex);
|
|
28
|
+
* const deployHash = await casper.broadcast(signedTx);
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
import { ChainAdapter, CasperTransaction } from '../core/types';
|
|
32
|
+
export declare class CasperAdapter implements ChainAdapter {
|
|
33
|
+
private rpcUrl;
|
|
34
|
+
private network;
|
|
35
|
+
private chainName;
|
|
36
|
+
constructor(network?: 'mainnet' | 'testnet', rpcUrl?: string);
|
|
37
|
+
getRpcUrl(): string;
|
|
38
|
+
/**
|
|
39
|
+
* Build an unsigned Casper deploy for a native CSPR transfer.
|
|
40
|
+
*
|
|
41
|
+
* The deploy is serialized and hashed using Blake2b-256 to produce
|
|
42
|
+
* the deploy hash, which is the signing payload for Ed25519.
|
|
43
|
+
*/
|
|
44
|
+
buildTransaction(tx: CasperTransaction, fromAddress: string): Promise<string>;
|
|
45
|
+
/**
|
|
46
|
+
* Extract the deploy hash (Blake2b-256 of the serialized header)
|
|
47
|
+
* as the signing payload for Ed25519.
|
|
48
|
+
*/
|
|
49
|
+
getSigningPayload(unsignedTx: string): string;
|
|
50
|
+
/**
|
|
51
|
+
* Attach an Ed25519 signature to the Casper deploy.
|
|
52
|
+
*
|
|
53
|
+
* Adds the signature to the deploy's approvals list.
|
|
54
|
+
*/
|
|
55
|
+
attachSignature(unsignedTx: string, signature: string): Promise<string>;
|
|
56
|
+
/**
|
|
57
|
+
* Broadcast a signed Casper deploy via account_put_deploy RPC.
|
|
58
|
+
*
|
|
59
|
+
* Constructs the JSON deploy structure expected by the Casper node
|
|
60
|
+
* from the serialized payload fields.
|
|
61
|
+
*/
|
|
62
|
+
broadcast(signedTx: string): Promise<string>;
|
|
63
|
+
/**
|
|
64
|
+
* Get CSPR balance in motes for an account.
|
|
65
|
+
*
|
|
66
|
+
* Queries the account's main purse URef, then fetches the balance.
|
|
67
|
+
*/
|
|
68
|
+
getBalance(address: string): Promise<string>;
|
|
69
|
+
}
|
|
70
|
+
/** Create a mainnet Casper adapter */
|
|
71
|
+
export declare function createCasperAdapter(rpcUrl?: string): CasperAdapter;
|
|
72
|
+
/** Create a testnet Casper adapter */
|
|
73
|
+
export declare function createCasperTestnetAdapter(rpcUrl?: string): CasperAdapter;
|
|
74
|
+
//# sourceMappingURL=casper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"casper.d.ts","sourceRoot":"","sources":["../../src/chains/casper.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAGH,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAkShE,qBAAa,aAAc,YAAW,YAAY;IAC9C,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,SAAS,CAAS;gBAEd,OAAO,GAAE,SAAS,GAAG,SAAqB,EAAE,MAAM,CAAC,EAAE,MAAM;IAMvE,SAAS,IAAI,MAAM;IAInB;;;;;OAKG;IACG,gBAAgB,CAAC,EAAE,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAkFnF;;;OAGG;IACH,iBAAiB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM;IAS7C;;;;OAIG;IACG,eAAe,CAAC,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAmB7E;;;;;OAKG;IACG,SAAS,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAqFlD;;;;OAIG;IACG,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;CA0CrD;AAED,sCAAsC;AACtC,wBAAgB,mBAAmB,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,aAAa,CAElE;AAED,sCAAsC;AACtC,wBAAgB,0BAA0B,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,aAAa,CAEzE"}
|
|
@@ -0,0 +1,512 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Casper Network Chain Adapter
|
|
4
|
+
*
|
|
5
|
+
* Builds Casper deploys for native CSPR transfers, attaches Ed25519
|
|
6
|
+
* signatures from the FROST threshold signing network, and broadcasts
|
|
7
|
+
* via the Casper JSON-RPC API.
|
|
8
|
+
*
|
|
9
|
+
* Casper uses Ed25519 for signing. The signing payload is the deploy
|
|
10
|
+
* hash, which is Blake2b-256 of the serialized deploy header.
|
|
11
|
+
*
|
|
12
|
+
* No external dependencies — uses native fetch and crypto.
|
|
13
|
+
*
|
|
14
|
+
* Address format: 01<hex> (ed25519 public key prefixed with 01)
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```typescript
|
|
18
|
+
* import { CasperAdapter } from '@sequence0/sdk';
|
|
19
|
+
*
|
|
20
|
+
* const casper = new CasperAdapter('mainnet');
|
|
21
|
+
*
|
|
22
|
+
* const unsignedTx = await casper.buildTransaction(
|
|
23
|
+
* { to: '01abc...def', amount: '2500000000', publicKey: 'abc...def' },
|
|
24
|
+
* '01abc...def'
|
|
25
|
+
* );
|
|
26
|
+
*
|
|
27
|
+
* // ... sign via FROST ed25519 ...
|
|
28
|
+
* const signedTx = await casper.attachSignature(unsignedTx, signatureHex);
|
|
29
|
+
* const deployHash = await casper.broadcast(signedTx);
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
33
|
+
exports.CasperAdapter = void 0;
|
|
34
|
+
exports.createCasperAdapter = createCasperAdapter;
|
|
35
|
+
exports.createCasperTestnetAdapter = createCasperTestnetAdapter;
|
|
36
|
+
const crypto_1 = require("crypto");
|
|
37
|
+
const errors_1 = require("../utils/errors");
|
|
38
|
+
// ── Network Configuration ──
|
|
39
|
+
const DEFAULT_RPCS = {
|
|
40
|
+
'mainnet': 'https://rpc.mainnet.casperlabs.io/rpc',
|
|
41
|
+
'testnet': 'https://rpc.testnet.casperlabs.io/rpc',
|
|
42
|
+
};
|
|
43
|
+
const CHAIN_NAMES = {
|
|
44
|
+
'mainnet': 'casper',
|
|
45
|
+
'testnet': 'casper-test',
|
|
46
|
+
};
|
|
47
|
+
/** Default payment amount for a simple transfer (0.1 CSPR in motes) */
|
|
48
|
+
const DEFAULT_PAYMENT_AMOUNT = '100000000';
|
|
49
|
+
/** Default TTL: 30 minutes in milliseconds */
|
|
50
|
+
const DEFAULT_TTL_MS = 1800000;
|
|
51
|
+
// ── Casper-specific serialization helpers ──
|
|
52
|
+
/**
|
|
53
|
+
* Encode a u32 as 4 little-endian bytes.
|
|
54
|
+
*/
|
|
55
|
+
function u32ToLeBytes(value) {
|
|
56
|
+
const buf = new Uint8Array(4);
|
|
57
|
+
buf[0] = value & 0xff;
|
|
58
|
+
buf[1] = (value >> 8) & 0xff;
|
|
59
|
+
buf[2] = (value >> 16) & 0xff;
|
|
60
|
+
buf[3] = (value >> 24) & 0xff;
|
|
61
|
+
return buf;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Encode a u64 as 8 little-endian bytes.
|
|
65
|
+
*/
|
|
66
|
+
function u64ToLeBytes(value) {
|
|
67
|
+
const buf = new Uint8Array(8);
|
|
68
|
+
for (let i = 0; i < 8; i++) {
|
|
69
|
+
buf[i] = Number((value >> BigInt(i * 8)) & 0xffn);
|
|
70
|
+
}
|
|
71
|
+
return buf;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Serialize a string with a u32 length prefix (Casper's bytesrepr).
|
|
75
|
+
*/
|
|
76
|
+
function serializeString(s) {
|
|
77
|
+
const encoded = new TextEncoder().encode(s);
|
|
78
|
+
const result = new Uint8Array(4 + encoded.length);
|
|
79
|
+
result.set(u32ToLeBytes(encoded.length));
|
|
80
|
+
result.set(encoded, 4);
|
|
81
|
+
return result;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Serialize a byte array with a u32 length prefix.
|
|
85
|
+
*/
|
|
86
|
+
function serializeBytes(data) {
|
|
87
|
+
const result = new Uint8Array(4 + data.length);
|
|
88
|
+
result.set(u32ToLeBytes(data.length));
|
|
89
|
+
result.set(data, 4);
|
|
90
|
+
return result;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Blake2b-256 hash. Uses Node.js crypto (blake2b256).
|
|
94
|
+
*/
|
|
95
|
+
function blake2b256(data) {
|
|
96
|
+
return (0, crypto_1.createHash)('blake2b256').update(data).digest();
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Serialize the deploy header for hashing.
|
|
100
|
+
*
|
|
101
|
+
* Header fields (in order):
|
|
102
|
+
* - account (public key with algorithm tag)
|
|
103
|
+
* - timestamp (u64 ms since epoch)
|
|
104
|
+
* - ttl (u64 ms)
|
|
105
|
+
* - gas_price (u64)
|
|
106
|
+
* - body_hash (32 bytes)
|
|
107
|
+
* - dependencies (list of deploy hashes — empty for simple transfers)
|
|
108
|
+
* - chain_name (string)
|
|
109
|
+
*/
|
|
110
|
+
function serializeDeployHeader(header) {
|
|
111
|
+
const parts = [];
|
|
112
|
+
// Account: algorithm tag (1 byte: 0x01 for ed25519) + 32 bytes key
|
|
113
|
+
const accountKey = Buffer.from(header.account, 'hex');
|
|
114
|
+
const accountSerialized = new Uint8Array(1 + accountKey.length);
|
|
115
|
+
accountSerialized[0] = 0x01; // Ed25519 tag
|
|
116
|
+
accountSerialized.set(accountKey, 1);
|
|
117
|
+
parts.push(accountSerialized);
|
|
118
|
+
// Timestamp (u64 LE)
|
|
119
|
+
parts.push(u64ToLeBytes(header.timestamp));
|
|
120
|
+
// TTL (u64 LE)
|
|
121
|
+
parts.push(u64ToLeBytes(header.ttl));
|
|
122
|
+
// Gas price (u64 LE)
|
|
123
|
+
parts.push(u64ToLeBytes(header.gasPrice));
|
|
124
|
+
// Body hash (raw 32 bytes)
|
|
125
|
+
parts.push(header.bodyHash);
|
|
126
|
+
// Dependencies (u32 count = 0 for simple transfers)
|
|
127
|
+
parts.push(u32ToLeBytes(0));
|
|
128
|
+
// Chain name
|
|
129
|
+
parts.push(serializeString(header.chainName));
|
|
130
|
+
// Concatenate all parts
|
|
131
|
+
const totalLength = parts.reduce((sum, p) => sum + p.length, 0);
|
|
132
|
+
const result = new Uint8Array(totalLength);
|
|
133
|
+
let offset = 0;
|
|
134
|
+
for (const part of parts) {
|
|
135
|
+
result.set(part, offset);
|
|
136
|
+
offset += part.length;
|
|
137
|
+
}
|
|
138
|
+
return result;
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Serialize a U512 CLValue (Casper's big number type).
|
|
142
|
+
* Casper U512 uses variable-length little-endian encoding with a length prefix byte.
|
|
143
|
+
*/
|
|
144
|
+
function serializeU512(value) {
|
|
145
|
+
if (value === 0n) {
|
|
146
|
+
return new Uint8Array([0]); // length 0, no data bytes
|
|
147
|
+
}
|
|
148
|
+
const bytes = [];
|
|
149
|
+
let v = value;
|
|
150
|
+
while (v > 0n) {
|
|
151
|
+
bytes.push(Number(v & 0xffn));
|
|
152
|
+
v >>= 8n;
|
|
153
|
+
}
|
|
154
|
+
const result = new Uint8Array(1 + bytes.length);
|
|
155
|
+
result[0] = bytes.length;
|
|
156
|
+
result.set(bytes, 1);
|
|
157
|
+
return result;
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Serialize the payment ModuleBytes (standard payment).
|
|
161
|
+
*
|
|
162
|
+
* Format: tag(0x00) + module_bytes(length-prefixed empty) + args(runtime args for "amount")
|
|
163
|
+
*/
|
|
164
|
+
function serializeStandardPayment(amount) {
|
|
165
|
+
const parts = [];
|
|
166
|
+
// Tag: ModuleBytes = 0x00
|
|
167
|
+
parts.push(new Uint8Array([0x00]));
|
|
168
|
+
// Module bytes: empty (length-prefixed)
|
|
169
|
+
parts.push(u32ToLeBytes(0));
|
|
170
|
+
// Runtime args: 1 named arg "amount" of type U512
|
|
171
|
+
// Number of args
|
|
172
|
+
parts.push(u32ToLeBytes(1));
|
|
173
|
+
// Arg name: "amount"
|
|
174
|
+
parts.push(serializeString('amount'));
|
|
175
|
+
// CLValue: serialized value bytes + cl_type
|
|
176
|
+
const amountBytes = serializeU512(BigInt(amount));
|
|
177
|
+
// Value bytes (length-prefixed)
|
|
178
|
+
parts.push(u32ToLeBytes(amountBytes.length));
|
|
179
|
+
parts.push(amountBytes);
|
|
180
|
+
// CLType: U512 = 0x08
|
|
181
|
+
parts.push(new Uint8Array([0x08]));
|
|
182
|
+
const totalLength = parts.reduce((sum, p) => sum + p.length, 0);
|
|
183
|
+
const result = new Uint8Array(totalLength);
|
|
184
|
+
let offset = 0;
|
|
185
|
+
for (const part of parts) {
|
|
186
|
+
result.set(part, offset);
|
|
187
|
+
offset += part.length;
|
|
188
|
+
}
|
|
189
|
+
return result;
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* Serialize the session (transfer entry point).
|
|
193
|
+
*
|
|
194
|
+
* Format: tag(0x05 for Transfer) + args(amount, target, id)
|
|
195
|
+
*/
|
|
196
|
+
function serializeTransferSession(amount, targetAccountHash, transferId) {
|
|
197
|
+
const parts = [];
|
|
198
|
+
// Tag: Transfer = 0x05
|
|
199
|
+
parts.push(new Uint8Array([0x05]));
|
|
200
|
+
// Runtime args: 3 named args
|
|
201
|
+
parts.push(u32ToLeBytes(3));
|
|
202
|
+
// Arg 1: "amount" (U512)
|
|
203
|
+
parts.push(serializeString('amount'));
|
|
204
|
+
const amountBytes = serializeU512(BigInt(amount));
|
|
205
|
+
parts.push(u32ToLeBytes(amountBytes.length));
|
|
206
|
+
parts.push(amountBytes);
|
|
207
|
+
parts.push(new Uint8Array([0x08])); // CLType U512
|
|
208
|
+
// Arg 2: "target" (ByteArray 32 bytes)
|
|
209
|
+
parts.push(serializeString('target'));
|
|
210
|
+
// Value: 32 raw bytes
|
|
211
|
+
parts.push(u32ToLeBytes(32));
|
|
212
|
+
parts.push(targetAccountHash);
|
|
213
|
+
// CLType: ByteArray(32) = 0x0f + u32(32)
|
|
214
|
+
parts.push(new Uint8Array([0x0f]));
|
|
215
|
+
parts.push(u32ToLeBytes(32));
|
|
216
|
+
// Arg 3: "id" (Option<U64> — Some(transferId))
|
|
217
|
+
parts.push(serializeString('id'));
|
|
218
|
+
// Value: Option::Some tag (0x01) + u64 LE
|
|
219
|
+
const idBytes = new Uint8Array(9);
|
|
220
|
+
idBytes[0] = 0x01; // Some
|
|
221
|
+
idBytes.set(u64ToLeBytes(transferId).subarray(0, 8), 1);
|
|
222
|
+
parts.push(u32ToLeBytes(idBytes.length));
|
|
223
|
+
parts.push(idBytes);
|
|
224
|
+
// CLType: Option<U64> = 0x0d + U64(0x05)
|
|
225
|
+
parts.push(new Uint8Array([0x0d, 0x05]));
|
|
226
|
+
const totalLength = parts.reduce((sum, p) => sum + p.length, 0);
|
|
227
|
+
const result = new Uint8Array(totalLength);
|
|
228
|
+
let offset = 0;
|
|
229
|
+
for (const part of parts) {
|
|
230
|
+
result.set(part, offset);
|
|
231
|
+
offset += part.length;
|
|
232
|
+
}
|
|
233
|
+
return result;
|
|
234
|
+
}
|
|
235
|
+
/**
|
|
236
|
+
* Compute the account hash from an ed25519 public key.
|
|
237
|
+
* account-hash = blake2b256("ed25519" + 0x00 + pubkey_bytes)
|
|
238
|
+
*/
|
|
239
|
+
function accountHashFromEd25519PubKey(pubKeyHex) {
|
|
240
|
+
const prefix = new TextEncoder().encode('ed25519');
|
|
241
|
+
const separator = new Uint8Array([0x00]);
|
|
242
|
+
const pubKey = Buffer.from(pubKeyHex, 'hex');
|
|
243
|
+
const data = new Uint8Array(prefix.length + separator.length + pubKey.length);
|
|
244
|
+
data.set(prefix);
|
|
245
|
+
data.set(separator, prefix.length);
|
|
246
|
+
data.set(pubKey, prefix.length + separator.length);
|
|
247
|
+
return blake2b256(data);
|
|
248
|
+
}
|
|
249
|
+
// ── JSON-RPC helper ──
|
|
250
|
+
async function rpcCall(url, method, params) {
|
|
251
|
+
const response = await fetch(url, {
|
|
252
|
+
method: 'POST',
|
|
253
|
+
headers: { 'Content-Type': 'application/json' },
|
|
254
|
+
body: JSON.stringify({
|
|
255
|
+
jsonrpc: '2.0',
|
|
256
|
+
id: 1,
|
|
257
|
+
method,
|
|
258
|
+
params,
|
|
259
|
+
}),
|
|
260
|
+
});
|
|
261
|
+
if (!response.ok) {
|
|
262
|
+
throw new Error(`Casper RPC returned HTTP ${response.status}`);
|
|
263
|
+
}
|
|
264
|
+
const data = await response.json();
|
|
265
|
+
if (data.error) {
|
|
266
|
+
throw new Error(`Casper RPC error: ${data.error.message}`);
|
|
267
|
+
}
|
|
268
|
+
return data.result;
|
|
269
|
+
}
|
|
270
|
+
// ── Adapter ──
|
|
271
|
+
class CasperAdapter {
|
|
272
|
+
constructor(network = 'mainnet', rpcUrl) {
|
|
273
|
+
this.network = network;
|
|
274
|
+
this.rpcUrl = rpcUrl || DEFAULT_RPCS[network];
|
|
275
|
+
this.chainName = CHAIN_NAMES[network];
|
|
276
|
+
}
|
|
277
|
+
getRpcUrl() {
|
|
278
|
+
return this.rpcUrl;
|
|
279
|
+
}
|
|
280
|
+
/**
|
|
281
|
+
* Build an unsigned Casper deploy for a native CSPR transfer.
|
|
282
|
+
*
|
|
283
|
+
* The deploy is serialized and hashed using Blake2b-256 to produce
|
|
284
|
+
* the deploy hash, which is the signing payload for Ed25519.
|
|
285
|
+
*/
|
|
286
|
+
async buildTransaction(tx, fromAddress) {
|
|
287
|
+
try {
|
|
288
|
+
// Extract the raw ed25519 public key (strip 01 prefix if present)
|
|
289
|
+
const senderPubKey = tx.publicKey || (fromAddress.startsWith('01') ? fromAddress.slice(2) : fromAddress);
|
|
290
|
+
if (senderPubKey.length !== 64) {
|
|
291
|
+
throw new Error('Casper requires a 32-byte ed25519 public key. Provide publicKey in tx or use 01-prefixed address.');
|
|
292
|
+
}
|
|
293
|
+
// Resolve target account hash
|
|
294
|
+
let targetAccountHash;
|
|
295
|
+
if (tx.to.startsWith('account-hash-')) {
|
|
296
|
+
// Already an account hash
|
|
297
|
+
targetAccountHash = Buffer.from(tx.to.replace('account-hash-', ''), 'hex');
|
|
298
|
+
}
|
|
299
|
+
else {
|
|
300
|
+
// Treat as ed25519 public key (strip 01 prefix)
|
|
301
|
+
const targetPubKey = tx.to.startsWith('01') ? tx.to.slice(2) : tx.to;
|
|
302
|
+
targetAccountHash = accountHashFromEd25519PubKey(targetPubKey);
|
|
303
|
+
}
|
|
304
|
+
const timestamp = BigInt(Date.now());
|
|
305
|
+
const ttl = BigInt(tx.ttl || DEFAULT_TTL_MS);
|
|
306
|
+
const gasPrice = BigInt(tx.gasPrice || 1);
|
|
307
|
+
const paymentAmount = tx.paymentAmount || DEFAULT_PAYMENT_AMOUNT;
|
|
308
|
+
const transferId = BigInt(Math.floor(Math.random() * 2 ** 32));
|
|
309
|
+
// Serialize payment and session to compute body hash
|
|
310
|
+
const paymentSerialized = serializeStandardPayment(paymentAmount);
|
|
311
|
+
const sessionSerialized = serializeTransferSession(tx.amount, targetAccountHash, transferId);
|
|
312
|
+
// Body hash = Blake2b-256(payment || session)
|
|
313
|
+
const bodyData = new Uint8Array(paymentSerialized.length + sessionSerialized.length);
|
|
314
|
+
bodyData.set(paymentSerialized);
|
|
315
|
+
bodyData.set(sessionSerialized, paymentSerialized.length);
|
|
316
|
+
const bodyHash = blake2b256(bodyData);
|
|
317
|
+
// Serialize the deploy header
|
|
318
|
+
const headerSerialized = serializeDeployHeader({
|
|
319
|
+
account: senderPubKey,
|
|
320
|
+
timestamp,
|
|
321
|
+
ttl,
|
|
322
|
+
gasPrice,
|
|
323
|
+
bodyHash,
|
|
324
|
+
chainName: this.chainName,
|
|
325
|
+
});
|
|
326
|
+
// Deploy hash = Blake2b-256(serialized header)
|
|
327
|
+
const deployHash = blake2b256(headerSerialized);
|
|
328
|
+
const payload = {
|
|
329
|
+
deployHash: deployHash.toString('hex'),
|
|
330
|
+
senderPubKey,
|
|
331
|
+
timestamp: timestamp.toString(),
|
|
332
|
+
ttl: ttl.toString(),
|
|
333
|
+
gasPrice: gasPrice.toString(),
|
|
334
|
+
paymentAmount,
|
|
335
|
+
amount: tx.amount,
|
|
336
|
+
targetAccountHash: Buffer.from(targetAccountHash).toString('hex'),
|
|
337
|
+
transferId: transferId.toString(),
|
|
338
|
+
chainName: this.chainName,
|
|
339
|
+
fromAddress,
|
|
340
|
+
toAddress: tx.to,
|
|
341
|
+
};
|
|
342
|
+
return Buffer.from(JSON.stringify(payload)).toString('hex');
|
|
343
|
+
}
|
|
344
|
+
catch (e) {
|
|
345
|
+
if (e instanceof errors_1.ChainError)
|
|
346
|
+
throw e;
|
|
347
|
+
throw new errors_1.ChainError(`Failed to build Casper deploy: ${e.message}`, 'casper');
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
/**
|
|
351
|
+
* Extract the deploy hash (Blake2b-256 of the serialized header)
|
|
352
|
+
* as the signing payload for Ed25519.
|
|
353
|
+
*/
|
|
354
|
+
getSigningPayload(unsignedTx) {
|
|
355
|
+
try {
|
|
356
|
+
const payload = JSON.parse(Buffer.from(unsignedTx, 'hex').toString());
|
|
357
|
+
return payload.deployHash;
|
|
358
|
+
}
|
|
359
|
+
catch {
|
|
360
|
+
return unsignedTx;
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
/**
|
|
364
|
+
* Attach an Ed25519 signature to the Casper deploy.
|
|
365
|
+
*
|
|
366
|
+
* Adds the signature to the deploy's approvals list.
|
|
367
|
+
*/
|
|
368
|
+
async attachSignature(unsignedTx, signature) {
|
|
369
|
+
try {
|
|
370
|
+
const payload = JSON.parse(Buffer.from(unsignedTx, 'hex').toString());
|
|
371
|
+
const sig = signature.startsWith('0x') ? signature.slice(2) : signature;
|
|
372
|
+
const signedPayload = {
|
|
373
|
+
...payload,
|
|
374
|
+
signature: sig, // 64-byte Ed25519 signature hex
|
|
375
|
+
};
|
|
376
|
+
return Buffer.from(JSON.stringify(signedPayload)).toString('hex');
|
|
377
|
+
}
|
|
378
|
+
catch (e) {
|
|
379
|
+
throw new errors_1.ChainError(`Failed to attach Casper signature: ${e.message}`, 'casper');
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
/**
|
|
383
|
+
* Broadcast a signed Casper deploy via account_put_deploy RPC.
|
|
384
|
+
*
|
|
385
|
+
* Constructs the JSON deploy structure expected by the Casper node
|
|
386
|
+
* from the serialized payload fields.
|
|
387
|
+
*/
|
|
388
|
+
async broadcast(signedTx) {
|
|
389
|
+
try {
|
|
390
|
+
const payload = JSON.parse(Buffer.from(signedTx, 'hex').toString());
|
|
391
|
+
// Construct the deploy JSON for account_put_deploy
|
|
392
|
+
const deploy = {
|
|
393
|
+
hash: payload.deployHash,
|
|
394
|
+
header: {
|
|
395
|
+
account: '01' + payload.senderPubKey,
|
|
396
|
+
timestamp: new Date(parseInt(payload.timestamp)).toISOString(),
|
|
397
|
+
ttl: `${parseInt(payload.ttl)}ms`,
|
|
398
|
+
gas_price: parseInt(payload.gasPrice),
|
|
399
|
+
body_hash: payload.deployHash, // simplified; real impl uses body hash
|
|
400
|
+
dependencies: [],
|
|
401
|
+
chain_name: payload.chainName,
|
|
402
|
+
},
|
|
403
|
+
payment: {
|
|
404
|
+
ModuleBytes: {
|
|
405
|
+
module_bytes: '',
|
|
406
|
+
args: [
|
|
407
|
+
[
|
|
408
|
+
'amount',
|
|
409
|
+
{
|
|
410
|
+
cl_type: 'U512',
|
|
411
|
+
bytes: serializeU512(BigInt(payload.paymentAmount))
|
|
412
|
+
.slice(0) // copy
|
|
413
|
+
.reduce((hex, b) => hex + b.toString(16).padStart(2, '0'), ''),
|
|
414
|
+
parsed: payload.paymentAmount,
|
|
415
|
+
},
|
|
416
|
+
],
|
|
417
|
+
],
|
|
418
|
+
},
|
|
419
|
+
},
|
|
420
|
+
session: {
|
|
421
|
+
Transfer: {
|
|
422
|
+
args: [
|
|
423
|
+
[
|
|
424
|
+
'amount',
|
|
425
|
+
{
|
|
426
|
+
cl_type: 'U512',
|
|
427
|
+
bytes: serializeU512(BigInt(payload.amount))
|
|
428
|
+
.slice(0)
|
|
429
|
+
.reduce((hex, b) => hex + b.toString(16).padStart(2, '0'), ''),
|
|
430
|
+
parsed: payload.amount,
|
|
431
|
+
},
|
|
432
|
+
],
|
|
433
|
+
[
|
|
434
|
+
'target',
|
|
435
|
+
{
|
|
436
|
+
cl_type: { ByteArray: 32 },
|
|
437
|
+
bytes: payload.targetAccountHash,
|
|
438
|
+
parsed: payload.targetAccountHash,
|
|
439
|
+
},
|
|
440
|
+
],
|
|
441
|
+
[
|
|
442
|
+
'id',
|
|
443
|
+
{
|
|
444
|
+
cl_type: { Option: 'U64' },
|
|
445
|
+
bytes: '01' + BigInt(payload.transferId).toString(16).padStart(16, '0'),
|
|
446
|
+
parsed: parseInt(payload.transferId),
|
|
447
|
+
},
|
|
448
|
+
],
|
|
449
|
+
],
|
|
450
|
+
},
|
|
451
|
+
},
|
|
452
|
+
approvals: [
|
|
453
|
+
{
|
|
454
|
+
signer: '01' + payload.senderPubKey,
|
|
455
|
+
signature: '01' + payload.signature, // 01 prefix = ed25519
|
|
456
|
+
},
|
|
457
|
+
],
|
|
458
|
+
};
|
|
459
|
+
const result = await rpcCall(this.rpcUrl, 'account_put_deploy', [{ deploy }]);
|
|
460
|
+
const deployHash = result?.deploy_hash || payload.deployHash;
|
|
461
|
+
return deployHash;
|
|
462
|
+
}
|
|
463
|
+
catch (e) {
|
|
464
|
+
if (e instanceof errors_1.ChainError)
|
|
465
|
+
throw e;
|
|
466
|
+
throw new errors_1.ChainError(`Failed to broadcast Casper deploy: ${e.message}`, 'casper');
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
/**
|
|
470
|
+
* Get CSPR balance in motes for an account.
|
|
471
|
+
*
|
|
472
|
+
* Queries the account's main purse URef, then fetches the balance.
|
|
473
|
+
*/
|
|
474
|
+
async getBalance(address) {
|
|
475
|
+
try {
|
|
476
|
+
// Get the state root hash
|
|
477
|
+
const stateRootResult = await rpcCall(this.rpcUrl, 'chain_get_state_root_hash', []);
|
|
478
|
+
const stateRootHash = stateRootResult.state_root_hash;
|
|
479
|
+
// Determine the account hash
|
|
480
|
+
let accountHash;
|
|
481
|
+
if (address.startsWith('account-hash-')) {
|
|
482
|
+
accountHash = address;
|
|
483
|
+
}
|
|
484
|
+
else {
|
|
485
|
+
const pubKey = address.startsWith('01') ? address.slice(2) : address;
|
|
486
|
+
const hash = accountHashFromEd25519PubKey(pubKey);
|
|
487
|
+
accountHash = 'account-hash-' + Buffer.from(hash).toString('hex');
|
|
488
|
+
}
|
|
489
|
+
// Get account info to find the main purse
|
|
490
|
+
const accountResult = await rpcCall(this.rpcUrl, 'state_get_item', [stateRootHash, accountHash, []]);
|
|
491
|
+
const mainPurse = accountResult?.stored_value?.Account?.main_purse;
|
|
492
|
+
if (!mainPurse)
|
|
493
|
+
return '0';
|
|
494
|
+
// Get balance from the purse
|
|
495
|
+
const balanceResult = await rpcCall(this.rpcUrl, 'state_get_balance', [stateRootHash, mainPurse]);
|
|
496
|
+
return balanceResult?.balance_value || '0';
|
|
497
|
+
}
|
|
498
|
+
catch {
|
|
499
|
+
return '0';
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
exports.CasperAdapter = CasperAdapter;
|
|
504
|
+
/** Create a mainnet Casper adapter */
|
|
505
|
+
function createCasperAdapter(rpcUrl) {
|
|
506
|
+
return new CasperAdapter('mainnet', rpcUrl);
|
|
507
|
+
}
|
|
508
|
+
/** Create a testnet Casper adapter */
|
|
509
|
+
function createCasperTestnetAdapter(rpcUrl) {
|
|
510
|
+
return new CasperAdapter('testnet', rpcUrl);
|
|
511
|
+
}
|
|
512
|
+
//# sourceMappingURL=casper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"casper.js","sourceRoot":"","sources":["../../src/chains/casper.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;;;AA8jBH,kDAEC;AAGD,gEAEC;AAnkBD,mCAAoC;AAEpC,4CAA6C;AAE7C,8BAA8B;AAE9B,MAAM,YAAY,GAA2B;IACzC,SAAS,EAAE,uCAAuC;IAClD,SAAS,EAAE,uCAAuC;CACrD,CAAC;AAEF,MAAM,WAAW,GAA2B;IACxC,SAAS,EAAE,QAAQ;IACnB,SAAS,EAAE,aAAa;CAC3B,CAAC;AAEF,uEAAuE;AACvE,MAAM,sBAAsB,GAAG,WAAW,CAAC;AAE3C,8CAA8C;AAC9C,MAAM,cAAc,GAAG,OAAO,CAAC;AAE/B,8CAA8C;AAE9C;;GAEG;AACH,SAAS,YAAY,CAAC,KAAa;IAC/B,MAAM,GAAG,GAAG,IAAI,UAAU,CAAC,CAAC,CAAC,CAAC;IAC9B,GAAG,CAAC,CAAC,CAAC,GAAG,KAAK,GAAG,IAAI,CAAC;IACtB,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC;IAC7B,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,IAAI,EAAE,CAAC,GAAG,IAAI,CAAC;IAC9B,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,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