@sequence0/agent 0.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 +113 -0
- package/dist/agent.d.ts +83 -0
- package/dist/agent.js +201 -0
- package/dist/index.d.ts +28 -0
- package/dist/index.js +29 -0
- package/dist/networks.d.ts +21 -0
- package/dist/networks.js +43 -0
- package/package.json +35 -0
package/README.md
ADDED
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
# @sequence0/agent
|
|
2
|
+
|
|
3
|
+
> Sequence0 Network SDK — Run a FROST threshold signing agent from Node.js, Deno, or browsers.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @sequence0/agent
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Quick Start
|
|
12
|
+
|
|
13
|
+
```typescript
|
|
14
|
+
import { AgentNode } from '@sequence0/agent';
|
|
15
|
+
|
|
16
|
+
// 1. Create a node on mainnet
|
|
17
|
+
const node = new AgentNode({ network: 'mainnet' });
|
|
18
|
+
|
|
19
|
+
// 2. Connect to the relay
|
|
20
|
+
await node.connect();
|
|
21
|
+
|
|
22
|
+
// 3. Listen for events
|
|
23
|
+
node.on('signing_request', (req) => {
|
|
24
|
+
console.log('Got signing request:', req.walletId);
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
node.on('fee_collected', (fee) => {
|
|
28
|
+
console.log('Earned:', fee.amount, 'ETH');
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
// 4. Request a signature
|
|
32
|
+
await node.requestSignature('my-wallet', 'cafebabe');
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Network Selection
|
|
36
|
+
|
|
37
|
+
```typescript
|
|
38
|
+
// Mainnet (production) — chain 800801
|
|
39
|
+
new AgentNode({ network: 'mainnet' });
|
|
40
|
+
|
|
41
|
+
// Testnet — chain 800800, for development
|
|
42
|
+
new AgentNode({ network: 'testnet' });
|
|
43
|
+
|
|
44
|
+
// Custom RPC
|
|
45
|
+
new AgentNode({ network: 'mainnet', rpcUrl: 'http://localhost:8545' });
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Networks
|
|
49
|
+
|
|
50
|
+
| | Mainnet | Testnet |
|
|
51
|
+
|---|---|---|
|
|
52
|
+
| **Chain ID** | 800801 | 800800 |
|
|
53
|
+
| **RPC** | `https://rpc.sequence0.network` | `https://testnet-rpc.sequence0.network` |
|
|
54
|
+
| **WebSocket** | `wss://ws.sequence0.network` | `wss://testnet-ws.sequence0.network` |
|
|
55
|
+
| **Explorer** | `https://explorer.sequence0.network` | `https://testnet.sequence0.network` |
|
|
56
|
+
|
|
57
|
+
## API
|
|
58
|
+
|
|
59
|
+
### `AgentNode`
|
|
60
|
+
|
|
61
|
+
| Method | Description |
|
|
62
|
+
|--------|-------------|
|
|
63
|
+
| `connect(url?)` | Connect to a relay node via WebSocket |
|
|
64
|
+
| `disconnect()` | Disconnect from the relay |
|
|
65
|
+
| `requestSignature(walletId, message)` | Request a threshold signature |
|
|
66
|
+
| `initiateDkg(walletId, participants, threshold)` | Start distributed key generation |
|
|
67
|
+
| `info()` | Get node configuration info |
|
|
68
|
+
| `on(event, handler)` | Subscribe to events |
|
|
69
|
+
| `off(event, handler)` | Unsubscribe from events |
|
|
70
|
+
|
|
71
|
+
### Events
|
|
72
|
+
|
|
73
|
+
| Event | Description |
|
|
74
|
+
|-------|-------------|
|
|
75
|
+
| `connected` | WebSocket connected |
|
|
76
|
+
| `disconnected` | WebSocket disconnected |
|
|
77
|
+
| `signing_request` | New signing request received |
|
|
78
|
+
| `signature_complete` | Signature aggregation complete |
|
|
79
|
+
| `dkg_started` | DKG session started |
|
|
80
|
+
| `dkg_complete` | DKG complete, wallet created |
|
|
81
|
+
| `fee_collected` | Fee collected for a signature |
|
|
82
|
+
| `error` | Error occurred |
|
|
83
|
+
|
|
84
|
+
## Running an Agent Node
|
|
85
|
+
|
|
86
|
+
### Binary (Recommended for node operators)
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
# Install the Rust agent binary
|
|
90
|
+
curl -sSL https://install.sequence0.network | sh
|
|
91
|
+
|
|
92
|
+
# Run on mainnet
|
|
93
|
+
sequence0-agent --network mainnet --port 9000 --api-port 8080
|
|
94
|
+
|
|
95
|
+
# Run on testnet
|
|
96
|
+
sequence0-agent --network testnet --port 9000 --api-port 8080
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### Docker
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
docker run sequence0/agent --network mainnet
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
### Requirements
|
|
106
|
+
|
|
107
|
+
- 2+ CPU cores, 4GB RAM, 50GB SSD
|
|
108
|
+
- Public IP with ports 9000 (P2P) and 8080 (API) open
|
|
109
|
+
- 0.1 ETH registration fee (one-time)
|
|
110
|
+
|
|
111
|
+
## License
|
|
112
|
+
|
|
113
|
+
MIT
|
package/dist/agent.d.ts
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @sequence0/agent — High-Level Agent Node
|
|
3
|
+
*
|
|
4
|
+
* Wraps the FROST WASM core with WebSocket transport for easy integration.
|
|
5
|
+
* This is the main API surface for developers using the SDK.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```typescript
|
|
9
|
+
* import { AgentNode } from '@sequence0/agent';
|
|
10
|
+
*
|
|
11
|
+
* const node = new AgentNode({ network: 'testnet', threshold: 2, maxSigners: 3 });
|
|
12
|
+
* await node.connect('ws://18.220.162.112:8080/ws');
|
|
13
|
+
*
|
|
14
|
+
* node.on('signing_request', async (req) => {
|
|
15
|
+
* console.log('Got signing request:', req.walletId);
|
|
16
|
+
* });
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
import { NetworkConfig } from './networks.js';
|
|
20
|
+
export interface AgentNodeOptions {
|
|
21
|
+
/** Network to connect to: 'testnet' or 'mainnet' */
|
|
22
|
+
network: string;
|
|
23
|
+
/** FROST threshold (t in t-of-n) */
|
|
24
|
+
threshold?: number;
|
|
25
|
+
/** Total participants (n in t-of-n) */
|
|
26
|
+
maxSigners?: number;
|
|
27
|
+
/** This agent's FROST participant ID (1-based) */
|
|
28
|
+
agentId?: number;
|
|
29
|
+
/** Custom RPC URL (overrides network default) */
|
|
30
|
+
rpcUrl?: string;
|
|
31
|
+
/** Custom WebSocket relay URL */
|
|
32
|
+
wsUrl?: string;
|
|
33
|
+
}
|
|
34
|
+
export type AgentEvent = 'connected' | 'disconnected' | 'signing_request' | 'signature_complete' | 'dkg_started' | 'dkg_complete' | 'fee_collected' | 'error';
|
|
35
|
+
export interface SigningRequest {
|
|
36
|
+
requestId: string;
|
|
37
|
+
walletId: string;
|
|
38
|
+
message: string;
|
|
39
|
+
participants: string[];
|
|
40
|
+
}
|
|
41
|
+
export interface SignatureResult {
|
|
42
|
+
requestId: string;
|
|
43
|
+
walletId: string;
|
|
44
|
+
signature: string;
|
|
45
|
+
verified: boolean;
|
|
46
|
+
}
|
|
47
|
+
type EventHandler = (...args: any[]) => void;
|
|
48
|
+
export declare class AgentNode {
|
|
49
|
+
private config;
|
|
50
|
+
private networkConfig;
|
|
51
|
+
private ws;
|
|
52
|
+
private handlers;
|
|
53
|
+
private reconnectTimer;
|
|
54
|
+
private _connected;
|
|
55
|
+
constructor(options: AgentNodeOptions);
|
|
56
|
+
/** Get the resolved network configuration */
|
|
57
|
+
get network(): NetworkConfig;
|
|
58
|
+
/** Whether the WebSocket is connected */
|
|
59
|
+
get connected(): boolean;
|
|
60
|
+
/**
|
|
61
|
+
* Connect to a Sequence0 relay node via WebSocket
|
|
62
|
+
* @param url - WebSocket URL (e.g., 'ws://18.220.162.112:8080/ws')
|
|
63
|
+
*/
|
|
64
|
+
connect(url?: string): Promise<void>;
|
|
65
|
+
/** Disconnect from the relay */
|
|
66
|
+
disconnect(): void;
|
|
67
|
+
/** Register an event handler */
|
|
68
|
+
on(event: AgentEvent, handler: EventHandler): void;
|
|
69
|
+
/** Remove an event handler */
|
|
70
|
+
off(event: AgentEvent, handler: EventHandler): void;
|
|
71
|
+
/** Send a signing request to the network */
|
|
72
|
+
requestSignature(walletId: string, message: string): Promise<void>;
|
|
73
|
+
/** Initiate a DKG session */
|
|
74
|
+
initiateDkg(walletId: string, participants: string[], threshold: number): Promise<void>;
|
|
75
|
+
/** Get agent node info */
|
|
76
|
+
info(): Record<string, any>;
|
|
77
|
+
private defaultWsUrl;
|
|
78
|
+
private send;
|
|
79
|
+
private handleMessage;
|
|
80
|
+
private emit;
|
|
81
|
+
private scheduleReconnect;
|
|
82
|
+
}
|
|
83
|
+
export {};
|
package/dist/agent.js
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @sequence0/agent — High-Level Agent Node
|
|
3
|
+
*
|
|
4
|
+
* Wraps the FROST WASM core with WebSocket transport for easy integration.
|
|
5
|
+
* This is the main API surface for developers using the SDK.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```typescript
|
|
9
|
+
* import { AgentNode } from '@sequence0/agent';
|
|
10
|
+
*
|
|
11
|
+
* const node = new AgentNode({ network: 'testnet', threshold: 2, maxSigners: 3 });
|
|
12
|
+
* await node.connect('ws://18.220.162.112:8080/ws');
|
|
13
|
+
*
|
|
14
|
+
* node.on('signing_request', async (req) => {
|
|
15
|
+
* console.log('Got signing request:', req.walletId);
|
|
16
|
+
* });
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
import { resolveNetwork } from './networks.js';
|
|
20
|
+
export class AgentNode {
|
|
21
|
+
constructor(options) {
|
|
22
|
+
this.ws = null;
|
|
23
|
+
this.handlers = new Map();
|
|
24
|
+
this.reconnectTimer = null;
|
|
25
|
+
this._connected = false;
|
|
26
|
+
this.config = {
|
|
27
|
+
threshold: 2,
|
|
28
|
+
maxSigners: 3,
|
|
29
|
+
agentId: 1,
|
|
30
|
+
...options,
|
|
31
|
+
};
|
|
32
|
+
this.networkConfig = resolveNetwork(options.network);
|
|
33
|
+
// Apply custom RPC if provided
|
|
34
|
+
if (options.rpcUrl) {
|
|
35
|
+
this.networkConfig = { ...this.networkConfig, rpcUrl: options.rpcUrl };
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
/** Get the resolved network configuration */
|
|
39
|
+
get network() {
|
|
40
|
+
return this.networkConfig;
|
|
41
|
+
}
|
|
42
|
+
/** Whether the WebSocket is connected */
|
|
43
|
+
get connected() {
|
|
44
|
+
return this._connected;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Connect to a Sequence0 relay node via WebSocket
|
|
48
|
+
* @param url - WebSocket URL (e.g., 'ws://18.220.162.112:8080/ws')
|
|
49
|
+
*/
|
|
50
|
+
async connect(url) {
|
|
51
|
+
const wsUrl = url || this.config.wsUrl || this.defaultWsUrl();
|
|
52
|
+
return new Promise((resolve, reject) => {
|
|
53
|
+
try {
|
|
54
|
+
this.ws = new WebSocket(wsUrl);
|
|
55
|
+
this.ws.onopen = () => {
|
|
56
|
+
this._connected = true;
|
|
57
|
+
this.emit('connected', { url: wsUrl, network: this.networkConfig.name });
|
|
58
|
+
resolve();
|
|
59
|
+
};
|
|
60
|
+
this.ws.onmessage = (event) => {
|
|
61
|
+
try {
|
|
62
|
+
const data = JSON.parse(event.data);
|
|
63
|
+
this.handleMessage(data);
|
|
64
|
+
}
|
|
65
|
+
catch (e) {
|
|
66
|
+
this.emit('error', { type: 'parse_error', detail: e });
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
this.ws.onclose = () => {
|
|
70
|
+
this._connected = false;
|
|
71
|
+
this.emit('disconnected', {});
|
|
72
|
+
this.scheduleReconnect(wsUrl);
|
|
73
|
+
};
|
|
74
|
+
this.ws.onerror = (error) => {
|
|
75
|
+
this.emit('error', { type: 'ws_error', detail: error });
|
|
76
|
+
reject(error);
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
catch (e) {
|
|
80
|
+
reject(e);
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
/** Disconnect from the relay */
|
|
85
|
+
disconnect() {
|
|
86
|
+
if (this.reconnectTimer) {
|
|
87
|
+
clearTimeout(this.reconnectTimer);
|
|
88
|
+
this.reconnectTimer = null;
|
|
89
|
+
}
|
|
90
|
+
if (this.ws) {
|
|
91
|
+
this.ws.close();
|
|
92
|
+
this.ws = null;
|
|
93
|
+
}
|
|
94
|
+
this._connected = false;
|
|
95
|
+
}
|
|
96
|
+
/** Register an event handler */
|
|
97
|
+
on(event, handler) {
|
|
98
|
+
const existing = this.handlers.get(event) || [];
|
|
99
|
+
existing.push(handler);
|
|
100
|
+
this.handlers.set(event, existing);
|
|
101
|
+
}
|
|
102
|
+
/** Remove an event handler */
|
|
103
|
+
off(event, handler) {
|
|
104
|
+
const existing = this.handlers.get(event) || [];
|
|
105
|
+
this.handlers.set(event, existing.filter(h => h !== handler));
|
|
106
|
+
}
|
|
107
|
+
/** Send a signing request to the network */
|
|
108
|
+
async requestSignature(walletId, message) {
|
|
109
|
+
this.send({
|
|
110
|
+
type: 'sign_request',
|
|
111
|
+
wallet_id: walletId,
|
|
112
|
+
message,
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
/** Initiate a DKG session */
|
|
116
|
+
async initiateDkg(walletId, participants, threshold) {
|
|
117
|
+
this.send({
|
|
118
|
+
type: 'dkg_initiate',
|
|
119
|
+
wallet_id: walletId,
|
|
120
|
+
participants,
|
|
121
|
+
threshold,
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
/** Get agent node info */
|
|
125
|
+
info() {
|
|
126
|
+
return {
|
|
127
|
+
network: this.networkConfig.name,
|
|
128
|
+
chainId: this.networkConfig.chainId,
|
|
129
|
+
threshold: this.config.threshold,
|
|
130
|
+
maxSigners: this.config.maxSigners,
|
|
131
|
+
agentId: this.config.agentId,
|
|
132
|
+
connected: this._connected,
|
|
133
|
+
rpcUrl: this.networkConfig.rpcUrl,
|
|
134
|
+
contracts: {
|
|
135
|
+
registry: this.networkConfig.registry,
|
|
136
|
+
feeCollector: this.networkConfig.feeCollector,
|
|
137
|
+
walletFactory: this.networkConfig.walletFactory,
|
|
138
|
+
},
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
// ── Private ──
|
|
142
|
+
defaultWsUrl() {
|
|
143
|
+
// Derive WS URL from RPC URL
|
|
144
|
+
const rpc = this.networkConfig.rpcUrl;
|
|
145
|
+
const host = rpc.replace(/^https?:\/\//, '').replace(/:\d+$/, '').replace(/\/.*$/, '');
|
|
146
|
+
return `ws://${host}:8080/ws`;
|
|
147
|
+
}
|
|
148
|
+
send(data) {
|
|
149
|
+
if (!this.ws || this.ws.readyState !== WebSocket.OPEN) {
|
|
150
|
+
throw new Error('Not connected — call connect() first');
|
|
151
|
+
}
|
|
152
|
+
this.ws.send(JSON.stringify(data));
|
|
153
|
+
}
|
|
154
|
+
handleMessage(data) {
|
|
155
|
+
const eventType = data.event || data.type;
|
|
156
|
+
switch (eventType) {
|
|
157
|
+
case 'SigningStarted':
|
|
158
|
+
this.emit('signing_request', data);
|
|
159
|
+
break;
|
|
160
|
+
case 'SigningComplete':
|
|
161
|
+
this.emit('signature_complete', data);
|
|
162
|
+
break;
|
|
163
|
+
case 'DkgStarted':
|
|
164
|
+
this.emit('dkg_started', data);
|
|
165
|
+
break;
|
|
166
|
+
case 'WalletCreated':
|
|
167
|
+
this.emit('dkg_complete', data);
|
|
168
|
+
break;
|
|
169
|
+
case 'FeeCollected':
|
|
170
|
+
this.emit('fee_collected', data);
|
|
171
|
+
break;
|
|
172
|
+
default:
|
|
173
|
+
// Pass through unknown events
|
|
174
|
+
break;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
emit(event, data) {
|
|
178
|
+
const handlers = this.handlers.get(event) || [];
|
|
179
|
+
for (const handler of handlers) {
|
|
180
|
+
try {
|
|
181
|
+
handler(data);
|
|
182
|
+
}
|
|
183
|
+
catch (e) {
|
|
184
|
+
console.error(`Error in ${event} handler:`, e);
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
scheduleReconnect(url) {
|
|
189
|
+
if (this.reconnectTimer)
|
|
190
|
+
return;
|
|
191
|
+
this.reconnectTimer = setTimeout(async () => {
|
|
192
|
+
this.reconnectTimer = null;
|
|
193
|
+
try {
|
|
194
|
+
await this.connect(url);
|
|
195
|
+
}
|
|
196
|
+
catch {
|
|
197
|
+
// Will retry on next close
|
|
198
|
+
}
|
|
199
|
+
}, 3000);
|
|
200
|
+
}
|
|
201
|
+
}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @sequence0/agent
|
|
3
|
+
*
|
|
4
|
+
* Sequence0 Network SDK — FROST threshold signing for Node.js and browsers.
|
|
5
|
+
* Run a signing agent or integrate threshold signatures into your application.
|
|
6
|
+
*
|
|
7
|
+
* ## Quick Start
|
|
8
|
+
*
|
|
9
|
+
* ```typescript
|
|
10
|
+
* import { AgentNode, TESTNET, MAINNET } from '@sequence0/agent';
|
|
11
|
+
*
|
|
12
|
+
* // Connect to testnet
|
|
13
|
+
* const node = new AgentNode({ network: 'testnet' });
|
|
14
|
+
* await node.connect();
|
|
15
|
+
*
|
|
16
|
+
* // Listen for events
|
|
17
|
+
* node.on('signing_request', (req) => console.log('Sign:', req));
|
|
18
|
+
* node.on('fee_collected', (fee) => console.log('Earned:', fee));
|
|
19
|
+
*
|
|
20
|
+
* // Request a signature
|
|
21
|
+
* await node.requestSignature('wallet-id', 'cafebabe');
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
export { AgentNode } from './agent.js';
|
|
25
|
+
export type { AgentNodeOptions, AgentEvent, SigningRequest, SignatureResult } from './agent.js';
|
|
26
|
+
export { TESTNET, MAINNET, resolveNetwork } from './networks.js';
|
|
27
|
+
export type { NetworkConfig } from './networks.js';
|
|
28
|
+
export declare const VERSION = "0.1.0";
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @sequence0/agent
|
|
3
|
+
*
|
|
4
|
+
* Sequence0 Network SDK — FROST threshold signing for Node.js and browsers.
|
|
5
|
+
* Run a signing agent or integrate threshold signatures into your application.
|
|
6
|
+
*
|
|
7
|
+
* ## Quick Start
|
|
8
|
+
*
|
|
9
|
+
* ```typescript
|
|
10
|
+
* import { AgentNode, TESTNET, MAINNET } from '@sequence0/agent';
|
|
11
|
+
*
|
|
12
|
+
* // Connect to testnet
|
|
13
|
+
* const node = new AgentNode({ network: 'testnet' });
|
|
14
|
+
* await node.connect();
|
|
15
|
+
*
|
|
16
|
+
* // Listen for events
|
|
17
|
+
* node.on('signing_request', (req) => console.log('Sign:', req));
|
|
18
|
+
* node.on('fee_collected', (fee) => console.log('Earned:', fee));
|
|
19
|
+
*
|
|
20
|
+
* // Request a signature
|
|
21
|
+
* await node.requestSignature('wallet-id', 'cafebabe');
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
// Agent Node (high-level API)
|
|
25
|
+
export { AgentNode } from './agent.js';
|
|
26
|
+
// Network configurations
|
|
27
|
+
export { TESTNET, MAINNET, resolveNetwork } from './networks.js';
|
|
28
|
+
// Version
|
|
29
|
+
export const VERSION = '0.1.0';
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @sequence0/agent — Network Configurations
|
|
3
|
+
*
|
|
4
|
+
* Testnet and mainnet configs mirroring the Rust NetworkProfile.
|
|
5
|
+
* Contract addresses, RPC URLs, and chain IDs for each environment.
|
|
6
|
+
*/
|
|
7
|
+
export interface NetworkConfig {
|
|
8
|
+
name: string;
|
|
9
|
+
chainId: number;
|
|
10
|
+
rpcUrl: string;
|
|
11
|
+
wsUrl: string;
|
|
12
|
+
registry: string;
|
|
13
|
+
feeCollector: string;
|
|
14
|
+
walletFactory: string;
|
|
15
|
+
bootstrapPeers: string[];
|
|
16
|
+
signatureFeeWei: bigint;
|
|
17
|
+
registrationFeeWei: bigint;
|
|
18
|
+
}
|
|
19
|
+
export declare const TESTNET: NetworkConfig;
|
|
20
|
+
export declare const MAINNET: NetworkConfig;
|
|
21
|
+
export declare function resolveNetwork(name: string): NetworkConfig;
|
package/dist/networks.js
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @sequence0/agent — Network Configurations
|
|
3
|
+
*
|
|
4
|
+
* Testnet and mainnet configs mirroring the Rust NetworkProfile.
|
|
5
|
+
* Contract addresses, RPC URLs, and chain IDs for each environment.
|
|
6
|
+
*/
|
|
7
|
+
export const TESTNET = {
|
|
8
|
+
name: 'testnet',
|
|
9
|
+
chainId: 800800,
|
|
10
|
+
rpcUrl: 'https://testnet-rpc.sequence0.network',
|
|
11
|
+
wsUrl: 'wss://testnet-ws.sequence0.network',
|
|
12
|
+
registry: '0x2d6c5f5f4bf21af697e29472800aa8b930e15e0a',
|
|
13
|
+
feeCollector: '0x4154a696acfd9bac8eef6f2c8c4dde20e22421b8',
|
|
14
|
+
walletFactory: '0x9cff7013a9d671f84100f8055a10f8620ae42d3b',
|
|
15
|
+
bootstrapPeers: [
|
|
16
|
+
'/ip4/18.220.162.112/tcp/9001',
|
|
17
|
+
'/ip4/18.220.162.112/tcp/9002',
|
|
18
|
+
'/ip4/18.220.162.112/tcp/9003',
|
|
19
|
+
],
|
|
20
|
+
signatureFeeWei: 30000000000000n, // 0.00003 ETH
|
|
21
|
+
registrationFeeWei: 10000000000000000n, // 0.01 ETH
|
|
22
|
+
};
|
|
23
|
+
export const MAINNET = {
|
|
24
|
+
name: 'mainnet',
|
|
25
|
+
chainId: 800801,
|
|
26
|
+
rpcUrl: 'https://rpc.sequence0.network',
|
|
27
|
+
wsUrl: 'wss://ws.sequence0.network',
|
|
28
|
+
registry: '0x3d5c81e158b0e30f573a3dae02e58b72b11042ae',
|
|
29
|
+
feeCollector: '0x73c785d58daa7afeffc071cea373acae8835f9c0',
|
|
30
|
+
walletFactory: '0x54acfe8c3babed69f251c387971bc4e0cb4c1fe3',
|
|
31
|
+
bootstrapPeers: [
|
|
32
|
+
'/ip4/3.148.239.3/tcp/9000',
|
|
33
|
+
],
|
|
34
|
+
signatureFeeWei: 30000000000000n,
|
|
35
|
+
registrationFeeWei: 100000000000000000n,
|
|
36
|
+
};
|
|
37
|
+
export function resolveNetwork(name) {
|
|
38
|
+
switch (name.toLowerCase()) {
|
|
39
|
+
case 'testnet': return TESTNET;
|
|
40
|
+
case 'mainnet': return MAINNET;
|
|
41
|
+
default: throw new Error(`Unknown network: ${name}. Use 'testnet' or 'mainnet'.`);
|
|
42
|
+
}
|
|
43
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@sequence0/agent",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Sequence0 Network — FROST threshold signing agent for Node.js and browsers",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"module": "dist/index.mjs",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"files": [
|
|
9
|
+
"dist/",
|
|
10
|
+
"README.md"
|
|
11
|
+
],
|
|
12
|
+
"scripts": {
|
|
13
|
+
"build": "tsc",
|
|
14
|
+
"test": "node --experimental-wasm-modules test/test.mjs"
|
|
15
|
+
},
|
|
16
|
+
"keywords": [
|
|
17
|
+
"sequence0",
|
|
18
|
+
"frost",
|
|
19
|
+
"threshold-signatures",
|
|
20
|
+
"mpc",
|
|
21
|
+
"dkg",
|
|
22
|
+
"web3",
|
|
23
|
+
"decentralized-signing"
|
|
24
|
+
],
|
|
25
|
+
"author": "Sequence0 Network",
|
|
26
|
+
"license": "MIT",
|
|
27
|
+
"repository": {
|
|
28
|
+
"type": "git",
|
|
29
|
+
"url": "https://github.com/sequence0-network/agent-node"
|
|
30
|
+
},
|
|
31
|
+
"dependencies": {},
|
|
32
|
+
"devDependencies": {
|
|
33
|
+
"typescript": "^5.0.0"
|
|
34
|
+
}
|
|
35
|
+
}
|