tenzro-sdk 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/LICENSE +201 -0
- package/README.md +107 -0
- package/dist/agent-payments.d.ts +47 -0
- package/dist/agent-payments.d.ts.map +1 -0
- package/dist/agent-payments.js +76 -0
- package/dist/agent-payments.js.map +1 -0
- package/dist/agent.d.ts +177 -0
- package/dist/agent.d.ts.map +1 -0
- package/dist/agent.js +300 -0
- package/dist/agent.js.map +1 -0
- package/dist/ap2.d.ts +54 -0
- package/dist/ap2.d.ts.map +1 -0
- package/dist/ap2.js +88 -0
- package/dist/ap2.js.map +1 -0
- package/dist/app.d.ts +186 -0
- package/dist/app.d.ts.map +1 -0
- package/dist/app.js +317 -0
- package/dist/app.js.map +1 -0
- package/dist/bridge.d.ts +64 -0
- package/dist/bridge.d.ts.map +1 -0
- package/dist/bridge.js +93 -0
- package/dist/bridge.js.map +1 -0
- package/dist/canton.d.ts +36 -0
- package/dist/canton.d.ts.map +1 -0
- package/dist/canton.js +46 -0
- package/dist/canton.js.map +1 -0
- package/dist/circuit-breaker.d.ts +35 -0
- package/dist/circuit-breaker.d.ts.map +1 -0
- package/dist/circuit-breaker.js +53 -0
- package/dist/circuit-breaker.js.map +1 -0
- package/dist/client.d.ts +134 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +265 -0
- package/dist/client.js.map +1 -0
- package/dist/compliance.d.ts +83 -0
- package/dist/compliance.d.ts.map +1 -0
- package/dist/compliance.js +74 -0
- package/dist/compliance.js.map +1 -0
- package/dist/config.d.ts +10 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +24 -0
- package/dist/config.js.map +1 -0
- package/dist/contract.d.ts +68 -0
- package/dist/contract.d.ts.map +1 -0
- package/dist/contract.js +59 -0
- package/dist/contract.js.map +1 -0
- package/dist/crypto.d.ts +112 -0
- package/dist/crypto.d.ts.map +1 -0
- package/dist/crypto.js +97 -0
- package/dist/crypto.js.map +1 -0
- package/dist/custody.d.ts +114 -0
- package/dist/custody.d.ts.map +1 -0
- package/dist/custody.js +96 -0
- package/dist/custody.js.map +1 -0
- package/dist/debridge.d.ts +129 -0
- package/dist/debridge.d.ts.map +1 -0
- package/dist/debridge.js +93 -0
- package/dist/debridge.js.map +1 -0
- package/dist/erc7802.d.ts +36 -0
- package/dist/erc7802.d.ts.map +1 -0
- package/dist/erc7802.js +52 -0
- package/dist/erc7802.js.map +1 -0
- package/dist/events.d.ts +112 -0
- package/dist/events.d.ts.map +1 -0
- package/dist/events.js +70 -0
- package/dist/events.js.map +1 -0
- package/dist/governance.d.ts +55 -0
- package/dist/governance.d.ts.map +1 -0
- package/dist/governance.js +77 -0
- package/dist/governance.js.map +1 -0
- package/dist/identity.d.ts +102 -0
- package/dist/identity.d.ts.map +1 -0
- package/dist/identity.js +147 -0
- package/dist/identity.js.map +1 -0
- package/dist/index.d.ts +67 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +85 -0
- package/dist/index.js.map +1 -0
- package/dist/inference.d.ts +27 -0
- package/dist/inference.d.ts.map +1 -0
- package/dist/inference.js +43 -0
- package/dist/inference.js.map +1 -0
- package/dist/marketplace.d.ts +44 -0
- package/dist/marketplace.d.ts.map +1 -0
- package/dist/marketplace.js +74 -0
- package/dist/marketplace.js.map +1 -0
- package/dist/nanopayment.d.ts +53 -0
- package/dist/nanopayment.d.ts.map +1 -0
- package/dist/nanopayment.js +81 -0
- package/dist/nanopayment.js.map +1 -0
- package/dist/nft.d.ts +127 -0
- package/dist/nft.d.ts.map +1 -0
- package/dist/nft.js +99 -0
- package/dist/nft.js.map +1 -0
- package/dist/payment.d.ts +71 -0
- package/dist/payment.d.ts.map +1 -0
- package/dist/payment.js +105 -0
- package/dist/payment.js.map +1 -0
- package/dist/provider.d.ts +351 -0
- package/dist/provider.d.ts.map +1 -0
- package/dist/provider.js +368 -0
- package/dist/provider.js.map +1 -0
- package/dist/rpc.d.ts +35 -0
- package/dist/rpc.d.ts.map +1 -0
- package/dist/rpc.js +127 -0
- package/dist/rpc.js.map +1 -0
- package/dist/settlement.d.ts +52 -0
- package/dist/settlement.d.ts.map +1 -0
- package/dist/settlement.js +86 -0
- package/dist/settlement.js.map +1 -0
- package/dist/skill.d.ts +55 -0
- package/dist/skill.d.ts.map +1 -0
- package/dist/skill.js +79 -0
- package/dist/skill.js.map +1 -0
- package/dist/staking.d.ts +42 -0
- package/dist/staking.d.ts.map +1 -0
- package/dist/staking.js +62 -0
- package/dist/staking.js.map +1 -0
- package/dist/streaming.d.ts +83 -0
- package/dist/streaming.d.ts.map +1 -0
- package/dist/streaming.js +193 -0
- package/dist/streaming.js.map +1 -0
- package/dist/task.d.ts +46 -0
- package/dist/task.d.ts.map +1 -0
- package/dist/task.js +76 -0
- package/dist/task.js.map +1 -0
- package/dist/tee.d.ts +88 -0
- package/dist/tee.d.ts.map +1 -0
- package/dist/tee.js +62 -0
- package/dist/tee.js.map +1 -0
- package/dist/token.d.ts +165 -0
- package/dist/token.d.ts.map +1 -0
- package/dist/token.js +80 -0
- package/dist/token.js.map +1 -0
- package/dist/tool.d.ts +55 -0
- package/dist/tool.d.ts.map +1 -0
- package/dist/tool.js +79 -0
- package/dist/tool.js.map +1 -0
- package/dist/types.d.ts +1318 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +117 -0
- package/dist/types.js.map +1 -0
- package/dist/wallet.d.ts +44 -0
- package/dist/wallet.d.ts.map +1 -0
- package/dist/wallet.js +75 -0
- package/dist/wallet.js.map +1 -0
- package/dist/zk.d.ts +66 -0
- package/dist/zk.d.ts.map +1 -0
- package/dist/zk.js +58 -0
- package/dist/zk.js.map +1 -0
- package/package.json +41 -0
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import type { RpcClient } from './rpc';
|
|
2
|
+
/** A chain supported by deBridge DLN. */
|
|
3
|
+
export interface DebridgeChain {
|
|
4
|
+
/** Numeric chain ID */
|
|
5
|
+
chainId: number;
|
|
6
|
+
/** Human-readable chain name (e.g. "Ethereum", "Solana") */
|
|
7
|
+
name: string;
|
|
8
|
+
/** Chain type (e.g. "evm", "svm") */
|
|
9
|
+
chain_type?: string;
|
|
10
|
+
}
|
|
11
|
+
/** A token available on deBridge DLN. */
|
|
12
|
+
export interface DebridgeToken {
|
|
13
|
+
/** Token contract address (or native token sentinel) */
|
|
14
|
+
address: string;
|
|
15
|
+
/** Token ticker symbol (e.g. "USDC") */
|
|
16
|
+
symbol: string;
|
|
17
|
+
/** Full token name */
|
|
18
|
+
name: string;
|
|
19
|
+
/** Number of decimals */
|
|
20
|
+
decimals: number;
|
|
21
|
+
/** Chain ID the token is on */
|
|
22
|
+
chainId?: number;
|
|
23
|
+
}
|
|
24
|
+
/** A cross-chain order created via deBridge DLN. */
|
|
25
|
+
export interface DebridgeOrder {
|
|
26
|
+
/** Order identifier */
|
|
27
|
+
order_id: string;
|
|
28
|
+
/** Source chain ID */
|
|
29
|
+
src_chain: number;
|
|
30
|
+
/** Destination chain ID */
|
|
31
|
+
dst_chain: number;
|
|
32
|
+
/** Source token address */
|
|
33
|
+
src_token: string;
|
|
34
|
+
/** Destination token address */
|
|
35
|
+
dst_token: string;
|
|
36
|
+
/** Amount as a decimal string */
|
|
37
|
+
amount: string;
|
|
38
|
+
/** Recipient address on the destination chain */
|
|
39
|
+
recipient: string;
|
|
40
|
+
/** Order status */
|
|
41
|
+
status: string;
|
|
42
|
+
/** Transaction data to sign and submit */
|
|
43
|
+
tx_data?: Record<string, unknown>;
|
|
44
|
+
}
|
|
45
|
+
/** Result of a same-chain swap via deBridge. */
|
|
46
|
+
export interface DebridgeSwapResult {
|
|
47
|
+
/** Transaction hash */
|
|
48
|
+
tx_hash?: string;
|
|
49
|
+
/** Input token address */
|
|
50
|
+
token_in: string;
|
|
51
|
+
/** Output token address */
|
|
52
|
+
token_out: string;
|
|
53
|
+
/** Input amount as a decimal string */
|
|
54
|
+
amount_in: string;
|
|
55
|
+
/** Output amount as a decimal string */
|
|
56
|
+
amount_out: string;
|
|
57
|
+
/** Status */
|
|
58
|
+
status: string;
|
|
59
|
+
/** Transaction data to sign and submit */
|
|
60
|
+
tx_data?: Record<string, unknown>;
|
|
61
|
+
}
|
|
62
|
+
/** deBridge usage instructions and supported features. */
|
|
63
|
+
export interface DebridgeInstructions {
|
|
64
|
+
/** Supported order types */
|
|
65
|
+
order_types: string[];
|
|
66
|
+
/** Supported features */
|
|
67
|
+
features: string[];
|
|
68
|
+
/** API version */
|
|
69
|
+
api_version: string;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Client for deBridge DLN (Decentalized Liquidity Network) cross-chain operations.
|
|
73
|
+
* Supports token search, chain listing, cross-chain order creation,
|
|
74
|
+
* and same-chain swaps. Order status is tracked via `stats-api.dln.trade`.
|
|
75
|
+
*
|
|
76
|
+
* deBridge uses an intent-based model: callers create orders specifying
|
|
77
|
+
* source/destination chains and tokens, and market makers (takers) fill them.
|
|
78
|
+
*/
|
|
79
|
+
export declare class DebridgeClient {
|
|
80
|
+
private readonly rpc;
|
|
81
|
+
constructor(rpc: RpcClient);
|
|
82
|
+
/**
|
|
83
|
+
* Search for tokens available on deBridge DLN.
|
|
84
|
+
* @param query - Search query (token name or symbol)
|
|
85
|
+
* @param chainId - Optional chain ID filter
|
|
86
|
+
* @returns Array of matching tokens
|
|
87
|
+
*/
|
|
88
|
+
searchTokens(query: string, chainId?: number): Promise<DebridgeToken[]>;
|
|
89
|
+
/**
|
|
90
|
+
* List all chains supported by deBridge DLN.
|
|
91
|
+
* @returns Array of supported chains
|
|
92
|
+
*/
|
|
93
|
+
getChains(): Promise<DebridgeChain[]>;
|
|
94
|
+
/**
|
|
95
|
+
* Get deBridge usage instructions and supported features.
|
|
96
|
+
* @returns Instructions including order types and API version
|
|
97
|
+
*/
|
|
98
|
+
getInstructions(): Promise<DebridgeInstructions>;
|
|
99
|
+
/**
|
|
100
|
+
* Create a cross-chain order via deBridge DLN.
|
|
101
|
+
* Returns unsigned transaction data that the caller must sign and submit.
|
|
102
|
+
* @param srcChain - Source chain ID
|
|
103
|
+
* @param dstChain - Destination chain ID
|
|
104
|
+
* @param srcToken - Source token address
|
|
105
|
+
* @param dstToken - Destination token address
|
|
106
|
+
* @param amount - Amount as a decimal string (in source token units)
|
|
107
|
+
* @param recipient - Recipient address on the destination chain
|
|
108
|
+
* @returns Order details with transaction data to sign
|
|
109
|
+
*/
|
|
110
|
+
createTx(srcChain: number, dstChain: number, srcToken: string, dstToken: string, amount: string, recipient: string): Promise<DebridgeOrder>;
|
|
111
|
+
/**
|
|
112
|
+
* Execute a same-chain swap via deBridge.
|
|
113
|
+
* Returns unsigned transaction data for a single-chain token swap.
|
|
114
|
+
* @param chainId - Chain ID to swap on
|
|
115
|
+
* @param tokenIn - Input token address
|
|
116
|
+
* @param tokenOut - Output token address
|
|
117
|
+
* @param amount - Input amount as a decimal string
|
|
118
|
+
* @returns Swap result with transaction data
|
|
119
|
+
*/
|
|
120
|
+
sameChainSwap(chainId: number, tokenIn: string, tokenOut: string, amount: string): Promise<DebridgeSwapResult>;
|
|
121
|
+
/**
|
|
122
|
+
* Get the status of an existing deBridge DLN order.
|
|
123
|
+
* Status is fetched from the deBridge stats API (`stats-api.dln.trade`).
|
|
124
|
+
* @param orderId - Order identifier
|
|
125
|
+
* @returns Order details including current status
|
|
126
|
+
*/
|
|
127
|
+
getOrderStatus(orderId: string): Promise<DebridgeOrder>;
|
|
128
|
+
}
|
|
129
|
+
//# sourceMappingURL=debridge.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"debridge.d.ts","sourceRoot":"","sources":["../src/debridge.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAIvC,yCAAyC;AACzC,MAAM,WAAW,aAAa;IAC5B,uBAAuB;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,4DAA4D;IAC5D,IAAI,EAAE,MAAM,CAAC;IACb,qCAAqC;IACr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oB;IACnC,4BAA4B;IAC5B,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,yBAAyB;IACzB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,kBAAkB;IAClB,WAAW,EAAE,MAAM,CAAC;CACrB;AAID;;;;;;;GAOG;AACH,qBAAa,cAAc;IACb,OAAO,CAAC,QAAQ,CAAC,GAAG;gBAAH,GAAG,EAAE,SAAS;IAE3C;;;;;OAKG;IACG,YAAY,CAChB,KAAK,EAAE,MAAM,EACb,OAAO,CAAC,EAAE,MAAM,GACf,OAAO,CAAC,aAAa,EAAE,CAAC;IAM3B;;;OAGG;IACG,SAAS,IAAI,OAAO,CAAC,aAAa,EAAE,CAAC;IAI3C;;;OAGG;IACG,eAAe,IAAI,OAAO,CAAC,oBAAoB,CAAC;IAMtD;;;;;;;;;;OAUG;IACG,QAAQ,CACZ,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,aAAa,CAAC;IAazB;;;;;;;;OAQG;IACG,aAAa,CACjB,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,kBAAkB,CAAC;IAM9B;;;;;OAKG;IACG,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC;CAK9D"}
|
package/dist/debridge.js
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DebridgeClient = void 0;
|
|
4
|
+
// ── Client ──
|
|
5
|
+
/**
|
|
6
|
+
* Client for deBridge DLN (Decentalized Liquidity Network) cross-chain operations.
|
|
7
|
+
* Supports token search, chain listing, cross-chain order creation,
|
|
8
|
+
* and same-chain swaps. Order status is tracked via `stats-api.dln.trade`.
|
|
9
|
+
*
|
|
10
|
+
* deBridge uses an intent-based model: callers create orders specifying
|
|
11
|
+
* source/destination chains and tokens, and market makers (takers) fill them.
|
|
12
|
+
*/
|
|
13
|
+
class DebridgeClient {
|
|
14
|
+
rpc;
|
|
15
|
+
constructor(rpc) {
|
|
16
|
+
this.rpc = rpc;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Search for tokens available on deBridge DLN.
|
|
20
|
+
* @param query - Search query (token name or symbol)
|
|
21
|
+
* @param chainId - Optional chain ID filter
|
|
22
|
+
* @returns Array of matching tokens
|
|
23
|
+
*/
|
|
24
|
+
async searchTokens(query, chainId) {
|
|
25
|
+
return this.rpc.call('tenzro_debridgeSearchTokens', [
|
|
26
|
+
{ query, chain_id: chainId },
|
|
27
|
+
]);
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* List all chains supported by deBridge DLN.
|
|
31
|
+
* @returns Array of supported chains
|
|
32
|
+
*/
|
|
33
|
+
async getChains() {
|
|
34
|
+
return this.rpc.call('tenzro_debridgeGetChains');
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Get deBridge usage instructions and supported features.
|
|
38
|
+
* @returns Instructions including order types and API version
|
|
39
|
+
*/
|
|
40
|
+
async getInstructions() {
|
|
41
|
+
return this.rpc.call('tenzro_debridgeGetInstructions');
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Create a cross-chain order via deBridge DLN.
|
|
45
|
+
* Returns unsigned transaction data that the caller must sign and submit.
|
|
46
|
+
* @param srcChain - Source chain ID
|
|
47
|
+
* @param dstChain - Destination chain ID
|
|
48
|
+
* @param srcToken - Source token address
|
|
49
|
+
* @param dstToken - Destination token address
|
|
50
|
+
* @param amount - Amount as a decimal string (in source token units)
|
|
51
|
+
* @param recipient - Recipient address on the destination chain
|
|
52
|
+
* @returns Order details with transaction data to sign
|
|
53
|
+
*/
|
|
54
|
+
async createTx(srcChain, dstChain, srcToken, dstToken, amount, recipient) {
|
|
55
|
+
return this.rpc.call('tenzro_debridgeCreateTx', [
|
|
56
|
+
{
|
|
57
|
+
src_chain: srcChain,
|
|
58
|
+
dst_chain: dstChain,
|
|
59
|
+
src_token: srcToken,
|
|
60
|
+
dst_token: dstToken,
|
|
61
|
+
amount,
|
|
62
|
+
recipient,
|
|
63
|
+
},
|
|
64
|
+
]);
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Execute a same-chain swap via deBridge.
|
|
68
|
+
* Returns unsigned transaction data for a single-chain token swap.
|
|
69
|
+
* @param chainId - Chain ID to swap on
|
|
70
|
+
* @param tokenIn - Input token address
|
|
71
|
+
* @param tokenOut - Output token address
|
|
72
|
+
* @param amount - Input amount as a decimal string
|
|
73
|
+
* @returns Swap result with transaction data
|
|
74
|
+
*/
|
|
75
|
+
async sameChainSwap(chainId, tokenIn, tokenOut, amount) {
|
|
76
|
+
return this.rpc.call('tenzro_debridgeSameChainSwap', [
|
|
77
|
+
{ chain_id: chainId, token_in: tokenIn, token_out: tokenOut, amount },
|
|
78
|
+
]);
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Get the status of an existing deBridge DLN order.
|
|
82
|
+
* Status is fetched from the deBridge stats API (`stats-api.dln.trade`).
|
|
83
|
+
* @param orderId - Order identifier
|
|
84
|
+
* @returns Order details including current status
|
|
85
|
+
*/
|
|
86
|
+
async getOrderStatus(orderId) {
|
|
87
|
+
return this.rpc.call('tenzro_debridgeGetOrderStatus', [
|
|
88
|
+
{ order_id: orderId },
|
|
89
|
+
]);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
exports.DebridgeClient = DebridgeClient;
|
|
93
|
+
//# sourceMappingURL=debridge.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"debridge.js","sourceRoot":"","sources":["../src/debridge.ts"],"names":[],"mappings":";;;AA8EA,eAAe;AAEf;;;;;;;GA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IAAI,CAAC,GAAG,CAAC,IAAI,CAAgB,+BAA+B,EAAE;YACnE,EAAE,QAAQ,EAAE,OAAO,EAAE;SACtB,CAAC,CAAC;IACL,CAAC;CACF;AAlGD,wCAkGC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { RpcClient } from './rpc';
|
|
2
|
+
import type { MintResult, BurnResult, CrossChainSupply } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Client for ERC-7802 cross-chain token interface operations.
|
|
5
|
+
* Supports cross-chain minting, burning, and supply queries
|
|
6
|
+
* for tokens that implement the ERC-7802 standard.
|
|
7
|
+
*/
|
|
8
|
+
export declare class Erc7802Client {
|
|
9
|
+
private readonly rpc;
|
|
10
|
+
constructor(rpc: RpcClient);
|
|
11
|
+
/**
|
|
12
|
+
* Mint tokens on the current chain authorized by a source chain burn.
|
|
13
|
+
* @param token - Token address or symbol
|
|
14
|
+
* @param recipient - Recipient address for the minted tokens
|
|
15
|
+
* @param amount - Amount to mint (decimal string)
|
|
16
|
+
* @param sourceChain - Source chain that authorized this mint
|
|
17
|
+
* @returns Mint result with transaction hash
|
|
18
|
+
*/
|
|
19
|
+
crosschainMint(token: string, recipient: string, amount: string, sourceChain: string): Promise<MintResult>;
|
|
20
|
+
/**
|
|
21
|
+
* Burn tokens on the current chain to authorize minting on a target chain.
|
|
22
|
+
* @param token - Token address or symbol
|
|
23
|
+
* @param from - Address to burn tokens from
|
|
24
|
+
* @param amount - Amount to burn (decimal string)
|
|
25
|
+
* @param targetChain - Target chain where tokens will be minted
|
|
26
|
+
* @returns Burn result with transaction hash
|
|
27
|
+
*/
|
|
28
|
+
crosschainBurn(token: string, from: string, amount: string, targetChain: string): Promise<BurnResult>;
|
|
29
|
+
/**
|
|
30
|
+
* Get the cross-chain supply breakdown for a token.
|
|
31
|
+
* @param token - Token address or symbol
|
|
32
|
+
* @returns Cross-chain supply with per-chain breakdown
|
|
33
|
+
*/
|
|
34
|
+
getCrossChainSupply(token: string): Promise<CrossChainSupply>;
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=erc7802.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"erc7802.d.ts","sourceRoot":"","sources":["../src/erc7802.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAExE;;;;GAIG;AACH,qBAAa,aAAa;IACZ,OAAO,CAAC,QAAQ,CAAC,GAAG;gBAAH,GAAG,EAAE,SAAS;IAE3C;;;;;;;OAOG;IACG,cAAc,CAClB,KAAK,EAAE,MAAM,EACb,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC,UAAU,CAAC;IAMtB;;;;;;;OAOG;IACG,cAAc,CAClB,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC,UAAU,CAAC;IAMtB;;;;OAIG;IACG,mBAAmB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC;CAKpE"}
|
package/dist/erc7802.js
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Erc7802Client = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Client for ERC-7802 cross-chain token interface operations.
|
|
6
|
+
* Supports cross-chain minting, burning, and supply queries
|
|
7
|
+
* for tokens that implement the ERC-7802 standard.
|
|
8
|
+
*/
|
|
9
|
+
class Erc7802Client {
|
|
10
|
+
rpc;
|
|
11
|
+
constructor(rpc) {
|
|
12
|
+
this.rpc = rpc;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Mint tokens on the current chain authorized by a source chain burn.
|
|
16
|
+
* @param token - Token address or symbol
|
|
17
|
+
* @param recipient - Recipient address for the minted tokens
|
|
18
|
+
* @param amount - Amount to mint (decimal string)
|
|
19
|
+
* @param sourceChain - Source chain that authorized this mint
|
|
20
|
+
* @returns Mint result with transaction hash
|
|
21
|
+
*/
|
|
22
|
+
async crosschainMint(token, recipient, amount, sourceChain) {
|
|
23
|
+
return this.rpc.call('tenzro_erc7802CrosschainMint', [
|
|
24
|
+
{ token, recipient, amount, source_chain: sourceChain },
|
|
25
|
+
]);
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Burn tokens on the current chain to authorize minting on a target chain.
|
|
29
|
+
* @param token - Token address or symbol
|
|
30
|
+
* @param from - Address to burn tokens from
|
|
31
|
+
* @param amount - Amount to burn (decimal string)
|
|
32
|
+
* @param targetChain - Target chain where tokens will be minted
|
|
33
|
+
* @returns Burn result with transaction hash
|
|
34
|
+
*/
|
|
35
|
+
async crosschainBurn(token, from, amount, targetChain) {
|
|
36
|
+
return this.rpc.call('tenzro_erc7802CrosschainBurn', [
|
|
37
|
+
{ token, from, amount, target_chain: targetChain },
|
|
38
|
+
]);
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Get the cross-chain supply breakdown for a token.
|
|
42
|
+
* @param token - Token address or symbol
|
|
43
|
+
* @returns Cross-chain supply with per-chain breakdown
|
|
44
|
+
*/
|
|
45
|
+
async getCrossChainSupply(token) {
|
|
46
|
+
return this.rpc.call('tenzro_erc7802GetCrossChainSupply', [
|
|
47
|
+
{ token },
|
|
48
|
+
]);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
exports.Erc7802Client = Erc7802Client;
|
|
52
|
+
//# sourceMappingURL=erc7802.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"erc7802.js","sourceRoot":"","sources":["../src/erc7802.ts"],"names":[],"mappings":";;;AAGA;;;;GAIG;AACH,MAAa,aAAa;IACK;IAA7B,YAA6B,GAAc;QAAd,QAAG,GAAH,GAAG,CAAW;IAAG,CAAC;IAE/C;;;;;;;OAOG;IACH,KAAK,CAAC,cAAc,CAClB,KAAa,EACb,SAAiB,EACjB,MAAc,EACd,WAAmB;QAEnB,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAa,8BAA8B,EAAE;YAC/D,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,YAAY,EAAE,WAAW,EAAE;SACxD,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;OAOG;IACH,KAAK,CAAC,cAAc,CAClB,KAAa,EACb,IAAY,EACZ,MAAc,EACd,WAAmB;QAEnB,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAa,8BAA8B,EAAE;YAC/D,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,YAAY,EAAE,WAAW,EAAE;SACnD,CAAC,CAAC;IACL,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,mBAAmB,CAAC,KAAa;QACrC,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAmB,mCAAmC,EAAE;YAC1E,EAAE,KAAK,EAAE;SACV,CAAC,CAAC;IACL,CAAC;CACF;AAnDD,sCAmDC"}
|
package/dist/events.d.ts
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import type { RpcClient } from './rpc';
|
|
2
|
+
/** A blockchain event emitted by the Tenzro Ledger. */
|
|
3
|
+
export interface BlockchainEvent {
|
|
4
|
+
/** Event type (e.g. "Transfer", "Mint", "Stake", "Slash", "ProposalCreated") */
|
|
5
|
+
event_type: string;
|
|
6
|
+
/** Block number where the event was emitted */
|
|
7
|
+
block_number: number;
|
|
8
|
+
/** Transaction hash that produced the event */
|
|
9
|
+
tx_hash?: string;
|
|
10
|
+
/** Event-specific data payload */
|
|
11
|
+
data: Record<string, unknown>;
|
|
12
|
+
/** ISO-8601 timestamp */
|
|
13
|
+
timestamp?: string;
|
|
14
|
+
}
|
|
15
|
+
/** Parameters for querying events. */
|
|
16
|
+
export interface GetEventsParams {
|
|
17
|
+
/** Start block number (inclusive) */
|
|
18
|
+
from_block?: number;
|
|
19
|
+
/** End block number (inclusive) */
|
|
20
|
+
to_block?: number;
|
|
21
|
+
/** Filter by event type */
|
|
22
|
+
event_type?: string;
|
|
23
|
+
/** Filter by emitting contract address */
|
|
24
|
+
address?: string;
|
|
25
|
+
/** Maximum number of events to return */
|
|
26
|
+
limit?: number;
|
|
27
|
+
}
|
|
28
|
+
/** An active event subscription. */
|
|
29
|
+
export interface Subscription {
|
|
30
|
+
/** Unique subscription identifier */
|
|
31
|
+
subscription_id: string;
|
|
32
|
+
/** WebSocket URL for receiving events (if available) */
|
|
33
|
+
ws_url?: string;
|
|
34
|
+
/** gRPC URL for receiving events (if available) */
|
|
35
|
+
grpc_url?: string;
|
|
36
|
+
/** Event types included in this subscription */
|
|
37
|
+
event_types: string[];
|
|
38
|
+
/** Subscription status */
|
|
39
|
+
status: string;
|
|
40
|
+
}
|
|
41
|
+
/** A registered webhook for event notifications. */
|
|
42
|
+
export interface WebhookRegistration {
|
|
43
|
+
/** Unique webhook identifier */
|
|
44
|
+
webhook_id: string;
|
|
45
|
+
/** Callback URL where events will be POSTed */
|
|
46
|
+
url: string;
|
|
47
|
+
/** Event types the webhook is subscribed to */
|
|
48
|
+
event_types?: string[];
|
|
49
|
+
/** Whether HMAC verification is enabled */
|
|
50
|
+
hmac_enabled: boolean;
|
|
51
|
+
/** Webhook status */
|
|
52
|
+
status: string;
|
|
53
|
+
}
|
|
54
|
+
/** Result of unsubscribing from events. */
|
|
55
|
+
export interface UnsubscribeResult {
|
|
56
|
+
/** Subscription identifier that was removed */
|
|
57
|
+
subscription_id: string;
|
|
58
|
+
/** Whether the unsubscription succeeded */
|
|
59
|
+
success: boolean;
|
|
60
|
+
}
|
|
61
|
+
/** Result of removing a webhook registration. */
|
|
62
|
+
export interface WebhookRemoveResult {
|
|
63
|
+
/** Webhook identifier that was removed */
|
|
64
|
+
webhook_id: string;
|
|
65
|
+
/** Whether the removal succeeded */
|
|
66
|
+
success: boolean;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Client for blockchain event queries, subscriptions, and webhooks.
|
|
70
|
+
* Supports querying historical events, subscribing to real-time events
|
|
71
|
+
* via WebSocket/gRPC, and registering webhooks for push notifications.
|
|
72
|
+
*/
|
|
73
|
+
export declare class EventsClient {
|
|
74
|
+
private readonly rpc;
|
|
75
|
+
constructor(rpc: RpcClient);
|
|
76
|
+
/**
|
|
77
|
+
* Query historical blockchain events with optional filters.
|
|
78
|
+
* @param params - Optional filter parameters (block range, event type, address)
|
|
79
|
+
* @returns Array of matching events
|
|
80
|
+
*/
|
|
81
|
+
getEvents(params?: GetEventsParams): Promise<BlockchainEvent[]>;
|
|
82
|
+
/**
|
|
83
|
+
* Subscribe to real-time blockchain events.
|
|
84
|
+
* Returns connection details for receiving events via WebSocket or gRPC.
|
|
85
|
+
* @param eventTypes - Array of event types to subscribe to (e.g. ["Transfer", "Stake"])
|
|
86
|
+
* @returns Subscription details with connection URLs
|
|
87
|
+
*/
|
|
88
|
+
subscribeEvents(eventTypes: string[]): Promise<Subscription>;
|
|
89
|
+
/**
|
|
90
|
+
* Unsubscribe from a previously created event subscription.
|
|
91
|
+
* @param subscriptionId - Subscription identifier to remove
|
|
92
|
+
* @returns Unsubscription result
|
|
93
|
+
*/
|
|
94
|
+
unsubscribeEvents(subscriptionId: string): Promise<UnsubscribeResult>;
|
|
95
|
+
/**
|
|
96
|
+
* Register a webhook to receive event notifications via HTTP POST.
|
|
97
|
+
* Events matching the specified types will be POSTed to the callback URL.
|
|
98
|
+
* An optional HMAC secret enables signature verification on the receiver side.
|
|
99
|
+
* @param url - Callback URL (must be HTTPS in production)
|
|
100
|
+
* @param eventTypes - Optional event type filter; omit to receive all events
|
|
101
|
+
* @param secret - Optional HMAC-SHA256 secret for webhook signature verification
|
|
102
|
+
* @returns Webhook registration details
|
|
103
|
+
*/
|
|
104
|
+
registerWebhook(url: string, eventTypes?: string[], secret?: string): Promise<WebhookRegistration>;
|
|
105
|
+
/**
|
|
106
|
+
* Remove a previously registered webhook.
|
|
107
|
+
* @param webhookId - Webhook identifier to remove
|
|
108
|
+
* @returns Removal result
|
|
109
|
+
*/
|
|
110
|
+
removeWebhook(webhookId: string): Promise<WebhookRemoveResult>;
|
|
111
|
+
}
|
|
112
|
+
//# sourceMappingURL=events.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAIvC,uDAAuD;AACvD,MAAM,WAAW,eAAe;IAC9B,gFAAgF;IAChF,UAAU,EAAE,MAAM,CAAC;IACnB,+CAA+C;IAC/C,YAAY,EAAE,MAAM,CAAC;IACrB,+CAA+C;IAC/C,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,kCAAkC;IAClC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC9B,yBAAyB;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,sCAAsC;AACtC,MAAM,WAAW,eAAe;IAC9B,qCAAqC;IACrC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,mCAAmC;IACnC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,2BAA2B;IAC3B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,0CAA0C;IAC1C,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,yCAAyC;IACzC,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,oCAAoC;AACpC,MAAM,WAAW,YAAY;IAC3B,qCAAqC;IACrC,eAAe,EAAE,MAAM,CAAC;IACxB,wDAAwD;IACxD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,mDAAmD;IACnD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,g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,CAAC,mBAAmB,CAAC;CAKrE"}
|
package/dist/events.js
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EventsClient = void 0;
|
|
4
|
+
// ── Client ──
|
|
5
|
+
/**
|
|
6
|
+
* Client for blockchain event queries, subscriptions, and webhooks.
|
|
7
|
+
* Supports querying historical events, subscribing to real-time events
|
|
8
|
+
* via WebSocket/gRPC, and registering webhooks for push notifications.
|
|
9
|
+
*/
|
|
10
|
+
class EventsClient {
|
|
11
|
+
rpc;
|
|
12
|
+
constructor(rpc) {
|
|
13
|
+
this.rpc = rpc;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Query historical blockchain events with optional filters.
|
|
17
|
+
* @param params - Optional filter parameters (block range, event type, address)
|
|
18
|
+
* @returns Array of matching events
|
|
19
|
+
*/
|
|
20
|
+
async getEvents(params) {
|
|
21
|
+
return this.rpc.call('tenzro_getEvents', [params ?? {}]);
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Subscribe to real-time blockchain events.
|
|
25
|
+
* Returns connection details for receiving events via WebSocket or gRPC.
|
|
26
|
+
* @param eventTypes - Array of event types to subscribe to (e.g. ["Transfer", "Stake"])
|
|
27
|
+
* @returns Subscription details with connection URLs
|
|
28
|
+
*/
|
|
29
|
+
async subscribeEvents(eventTypes) {
|
|
30
|
+
return this.rpc.call('tenzro_subscribeEvents', [
|
|
31
|
+
{ event_types: eventTypes },
|
|
32
|
+
]);
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Unsubscribe from a previously created event subscription.
|
|
36
|
+
* @param subscriptionId - Subscription identifier to remove
|
|
37
|
+
* @returns Unsubscription result
|
|
38
|
+
*/
|
|
39
|
+
async unsubscribeEvents(subscriptionId) {
|
|
40
|
+
return this.rpc.call('tenzro_unsubscribeEvents', [
|
|
41
|
+
{ subscription_id: subscriptionId },
|
|
42
|
+
]);
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Register a webhook to receive event notifications via HTTP POST.
|
|
46
|
+
* Events matching the specified types will be POSTed to the callback URL.
|
|
47
|
+
* An optional HMAC secret enables signature verification on the receiver side.
|
|
48
|
+
* @param url - Callback URL (must be HTTPS in production)
|
|
49
|
+
* @param eventTypes - Optional event type filter; omit to receive all events
|
|
50
|
+
* @param secret - Optional HMAC-SHA256 secret for webhook signature verification
|
|
51
|
+
* @returns Webhook registration details
|
|
52
|
+
*/
|
|
53
|
+
async registerWebhook(url, eventTypes, secret) {
|
|
54
|
+
return this.rpc.call('tenzro_registerWebhook', [
|
|
55
|
+
{ url, event_types: eventTypes, secret },
|
|
56
|
+
]);
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Remove a previously registered webhook.
|
|
60
|
+
* @param webhookId - Webhook identifier to remove
|
|
61
|
+
* @returns Removal result
|
|
62
|
+
*/
|
|
63
|
+
async removeWebhook(webhookId) {
|
|
64
|
+
return this.rpc.call('tenzro_removeWebhook', [
|
|
65
|
+
{ webhook_id: webhookId },
|
|
66
|
+
]);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
exports.EventsClient = EventsClient;
|
|
70
|
+
//# sourceMappingURL=events.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"events.js","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":";;;AA4EA,eAAe;AAEf;;;;GAIG;AACH,MAAa,YAAY;IACM;IAA7B,YAA6B,GAAc;QAAd,QAAG,GAAH,GAAG,CAAW;IAAG,CAAC;IAE/C;;;;OAIG;IACH,KAAK,CAAC,SAAS,CAAC,MAAwB;QACtC,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAoB,kBAAkB,EAAE,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC,CAAC;IAC9E,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,eAAe,CAAC,UAAoB;QACxC,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAe,wBAAwB,EAAE;YAC3D,EAAE,WAAW,EAAE,UAAU,EAAE;SAC5B,CAAC,CAAC;IACL,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,iBAAiB,CAAC,cAAsB;QAC5C,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAoB,0BAA0B,EAAE;YAClE,EAAE,eAAe,EAAE,cAAc,EAAE;SACpC,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;;OAQG;IACH,KAAK,CAAC,eAAe,CACnB,GAAW,EACX,UAAqB,EACrB,MAAe;QAEf,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAsB,wBAAwB,EAAE;YAClE,EAAE,GAAG,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,EAAE;SACzC,CAAC,CAAC;IACL,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,aAAa,CAAC,SAAiB;QACnC,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAsB,sBAAsB,EAAE;YAChE,EAAE,UAAU,EAAE,SAAS,EAAE;SAC1B,CAAC,CAAC;IACL,CAAC;CACF;AAhED,oCAgEC"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { RpcClient } from "./rpc";
|
|
2
|
+
import { GovernanceProposal, VoteType, VoteReceipt, VotingPower } from "./types";
|
|
3
|
+
/**
|
|
4
|
+
* Client for on-chain governance operations.
|
|
5
|
+
* Supports proposal creation, voting, and delegation.
|
|
6
|
+
*/
|
|
7
|
+
export declare class GovernanceClient {
|
|
8
|
+
private rpc;
|
|
9
|
+
constructor(rpc: RpcClient);
|
|
10
|
+
/**
|
|
11
|
+
* List governance proposals.
|
|
12
|
+
* @param status - Optional filter by proposal status
|
|
13
|
+
* @returns Array of governance proposals
|
|
14
|
+
*/
|
|
15
|
+
listProposals(status?: string): Promise<GovernanceProposal[]>;
|
|
16
|
+
/**
|
|
17
|
+
* Get details of a specific proposal.
|
|
18
|
+
* @param proposalId - The proposal identifier
|
|
19
|
+
* @returns Proposal details
|
|
20
|
+
*/
|
|
21
|
+
getProposal(proposalId: string): Promise<GovernanceProposal>;
|
|
22
|
+
/**
|
|
23
|
+
* Create a new governance proposal.
|
|
24
|
+
* @param params - Proposal parameters
|
|
25
|
+
* @returns Created proposal
|
|
26
|
+
*/
|
|
27
|
+
createProposal(params: {
|
|
28
|
+
title: string;
|
|
29
|
+
description: string;
|
|
30
|
+
proposalType: string;
|
|
31
|
+
executionData?: string;
|
|
32
|
+
}): Promise<GovernanceProposal>;
|
|
33
|
+
/**
|
|
34
|
+
* Vote on a governance proposal.
|
|
35
|
+
* @param proposalId - The proposal to vote on
|
|
36
|
+
* @param voteType - "For", "Against", or "Abstain"
|
|
37
|
+
* @param justification - Optional justification for the vote
|
|
38
|
+
* @returns Vote receipt
|
|
39
|
+
*/
|
|
40
|
+
vote(proposalId: string, voteType: VoteType, justification?: string): Promise<VoteReceipt>;
|
|
41
|
+
/**
|
|
42
|
+
* Get voting power for an address.
|
|
43
|
+
* @param address - The address to query
|
|
44
|
+
* @returns Voting power information
|
|
45
|
+
*/
|
|
46
|
+
getVotingPower(address: string): Promise<VotingPower>;
|
|
47
|
+
/**
|
|
48
|
+
* Delegate voting power to another address.
|
|
49
|
+
* @param delegate - Address to delegate to
|
|
50
|
+
* @param amount - Amount of voting power to delegate
|
|
51
|
+
* @returns Transaction hash
|
|
52
|
+
*/
|
|
53
|
+
delegateVotingPower(delegate: string, amount: string): Promise<string>;
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=governance.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"governance.d.ts","sourceRoot":"","sources":["../src/governance.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAClC,OAAO,EACL,kBAAkB,EAClB,QAAQ,EACR,WAAW,EACX,WAAW,EACZ,MAAM,SAAS,CAAC;AAEjB;;;GAGG;AACH,qBAAa,gBAAgB;IACf,OAAO,CAAC,GAAG;gBAAH,GAAG,EAAE,SAAS;IAElC;;;;OAIG;IACG,aAAa,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,EAAE,CAAC;IAMnE;;;;OAIG;IACG,WAAW,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAMlE;;;;OAIG;IACG,cAAc,CAAC,MAAM,EAAE;QAC3B,KAAK,EAAE,MAAM,CAAC;QACd,WAAW,EAAE,MAAM,CAAC;QACpB,YAAY,EAAE,MAAM,CAAC;QACrB,aAAa,CAAC,EAAE,MAAM,CAAC;KACxB,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAI/B;;;;;;OAMG;IACG,IAAI,CACR,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,QAAQ,EAClB,aAAa,CAAC,EAAE,MAAM,GACrB,OAAO,CAAC,WAAW,CAAC;IAQvB;;;;OAIG;IACG,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;IAI3D;;;;;OAKG;IACG,mBAAmB,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;CAM7E"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GovernanceClient = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Client for on-chain governance operations.
|
|
6
|
+
* Supports proposal creation, voting, and delegation.
|
|
7
|
+
*/
|
|
8
|
+
class GovernanceClient {
|
|
9
|
+
rpc;
|
|
10
|
+
constructor(rpc) {
|
|
11
|
+
this.rpc = rpc;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* List governance proposals.
|
|
15
|
+
* @param status - Optional filter by proposal status
|
|
16
|
+
* @returns Array of governance proposals
|
|
17
|
+
*/
|
|
18
|
+
async listProposals(status) {
|
|
19
|
+
return this.rpc.call("tenzro_listProposals", [
|
|
20
|
+
status,
|
|
21
|
+
]);
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Get details of a specific proposal.
|
|
25
|
+
* @param proposalId - The proposal identifier
|
|
26
|
+
* @returns Proposal details
|
|
27
|
+
*/
|
|
28
|
+
async getProposal(proposalId) {
|
|
29
|
+
return this.rpc.call("tenzro_getProposal", [
|
|
30
|
+
proposalId,
|
|
31
|
+
]);
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Create a new governance proposal.
|
|
35
|
+
* @param params - Proposal parameters
|
|
36
|
+
* @returns Created proposal
|
|
37
|
+
*/
|
|
38
|
+
async createProposal(params) {
|
|
39
|
+
return this.rpc.call("tenzro_createProposal", [params]);
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Vote on a governance proposal.
|
|
43
|
+
* @param proposalId - The proposal to vote on
|
|
44
|
+
* @param voteType - "For", "Against", or "Abstain"
|
|
45
|
+
* @param justification - Optional justification for the vote
|
|
46
|
+
* @returns Vote receipt
|
|
47
|
+
*/
|
|
48
|
+
async vote(proposalId, voteType, justification) {
|
|
49
|
+
return this.rpc.call("tenzro_vote", [
|
|
50
|
+
proposalId,
|
|
51
|
+
voteType,
|
|
52
|
+
justification,
|
|
53
|
+
]);
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Get voting power for an address.
|
|
57
|
+
* @param address - The address to query
|
|
58
|
+
* @returns Voting power information
|
|
59
|
+
*/
|
|
60
|
+
async getVotingPower(address) {
|
|
61
|
+
return this.rpc.call("tenzro_getVotingPower", [address]);
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Delegate voting power to another address.
|
|
65
|
+
* @param delegate - Address to delegate to
|
|
66
|
+
* @param amount - Amount of voting power to delegate
|
|
67
|
+
* @returns Transaction hash
|
|
68
|
+
*/
|
|
69
|
+
async delegateVotingPower(delegate, amount) {
|
|
70
|
+
return this.rpc.call("tenzro_delegateVotingPower", [
|
|
71
|
+
delegate,
|
|
72
|
+
amount,
|
|
73
|
+
]);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
exports.GovernanceClient = GovernanceClient;
|
|
77
|
+
//# sourceMappingURL=governance.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"governance.js","sourceRoot":"","sources":["../src/governance.ts"],"names":[],"mappings":";;;AAQA;;;GAGG;AACH,MAAa,gBAAgB;IACP;IAApB,YAAoB,GAAc;QAAd,QAAG,GAAH,GAAG,CAAW;IAAG,CAAC;IAEtC;;;;OAIG;IACH,KAAK,CAAC,aAAa,CAAC,MAAe;QACjC,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAuB,sBAAsB,EAAE;YACjE,MAAM;SACP,CAAC,CAAC;IACL,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,WAAW,CAAC,UAAkB;QAClC,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAqB,oBAAoB,EAAE;YAC7D,UAAU;SACX,CAAC,CAAC;IACL,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,cAAc,CAAC,MAKpB;QACC,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAqB,uBAAuB,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;IAC9E,CAAC;IAED;;;;;;OAMG;IACH,KAAK,CAAC,IAAI,CACR,UAAkB,EAClB,QAAkB,EAClB,aAAsB;QAEtB,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAc,aAAa,EAAE;YAC/C,UAAU;YACV,QAAQ;YACR,aAAa;SACd,CAAC,CAAC;IACL,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,cAAc,CAAC,OAAe;QAClC,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAc,uBAAuB,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;IACxE,CAAC;IAED;;;;;O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