@t402/wdk 2.3.0 → 2.4.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 +8 -0
- package/dist/cjs/adapters/index.d.ts +5 -0
- package/dist/cjs/adapters/index.js +455 -0
- package/dist/cjs/adapters/index.js.map +1 -0
- package/dist/cjs/adapters/svm-adapter.d.ts +125 -0
- package/dist/cjs/adapters/svm-adapter.js +132 -0
- package/dist/cjs/adapters/svm-adapter.js.map +1 -0
- package/dist/cjs/adapters/ton-adapter.d.ts +139 -0
- package/dist/cjs/adapters/ton-adapter.js +152 -0
- package/dist/cjs/adapters/ton-adapter.js.map +1 -0
- package/dist/cjs/adapters/tron-adapter.d.ts +139 -0
- package/dist/cjs/adapters/tron-adapter.js +221 -0
- package/dist/cjs/adapters/tron-adapter.js.map +1 -0
- package/dist/cjs/index.d.ts +292 -217
- package/dist/cjs/index.js +1042 -23
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types-V7c-qhn6.d.ts +489 -0
- package/dist/esm/adapters/index.d.mts +5 -0
- package/dist/esm/adapters/index.mjs +21 -0
- package/dist/esm/adapters/index.mjs.map +1 -0
- package/dist/esm/adapters/svm-adapter.d.mts +125 -0
- package/dist/esm/adapters/svm-adapter.mjs +9 -0
- package/dist/esm/adapters/svm-adapter.mjs.map +1 -0
- package/dist/esm/adapters/ton-adapter.d.mts +139 -0
- package/dist/esm/adapters/ton-adapter.mjs +9 -0
- package/dist/esm/adapters/ton-adapter.mjs.map +1 -0
- package/dist/esm/adapters/tron-adapter.d.mts +139 -0
- package/dist/esm/adapters/tron-adapter.mjs +9 -0
- package/dist/esm/adapters/tron-adapter.mjs.map +1 -0
- package/dist/esm/chunk-HB2DGKQ3.mjs +196 -0
- package/dist/esm/chunk-HB2DGKQ3.mjs.map +1 -0
- package/dist/esm/chunk-MCFHZSF7.mjs +107 -0
- package/dist/esm/chunk-MCFHZSF7.mjs.map +1 -0
- package/dist/esm/chunk-YWBJJV5M.mjs +117 -0
- package/dist/esm/chunk-YWBJJV5M.mjs.map +1 -0
- package/dist/esm/index.d.mts +292 -217
- package/dist/esm/index.mjs +640 -23
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm/types-V7c-qhn6.d.mts +489 -0
- package/package.json +70 -6
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/adapters/tron-adapter.ts
|
|
21
|
+
var tron_adapter_exports = {};
|
|
22
|
+
__export(tron_adapter_exports, {
|
|
23
|
+
WDKTronSignerAdapter: () => WDKTronSignerAdapter,
|
|
24
|
+
createWDKTronSigner: () => createWDKTronSigner
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(tron_adapter_exports);
|
|
27
|
+
var WDKTronSignerAdapter = class {
|
|
28
|
+
_account;
|
|
29
|
+
_address = null;
|
|
30
|
+
_initialized = false;
|
|
31
|
+
_rpcUrl;
|
|
32
|
+
constructor(account, rpcUrl = "https://api.trongrid.io") {
|
|
33
|
+
if (!account) {
|
|
34
|
+
throw new Error("WDK TRON account is required");
|
|
35
|
+
}
|
|
36
|
+
this._account = account;
|
|
37
|
+
this._rpcUrl = rpcUrl;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Get the wallet address (T-prefix base58check)
|
|
41
|
+
* @throws Error if not initialized
|
|
42
|
+
*/
|
|
43
|
+
get address() {
|
|
44
|
+
if (!this._address) {
|
|
45
|
+
throw new Error(
|
|
46
|
+
"TRON signer not initialized. Call initialize() first or use createWDKTronSigner()."
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
return this._address;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Check if the adapter is initialized
|
|
53
|
+
*/
|
|
54
|
+
get isInitialized() {
|
|
55
|
+
return this._initialized;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Initialize the adapter by fetching the address
|
|
59
|
+
* Must be called before using the signer
|
|
60
|
+
*/
|
|
61
|
+
async initialize() {
|
|
62
|
+
if (this._initialized) {
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
this._address = await this._account.getAddress();
|
|
66
|
+
this._initialized = true;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Sign a TRC20 transfer transaction
|
|
70
|
+
*
|
|
71
|
+
* This method:
|
|
72
|
+
* 1. Builds a TRC20 transfer transaction
|
|
73
|
+
* 2. Signs it using the WDK account
|
|
74
|
+
* 3. Returns the hex-encoded signed transaction
|
|
75
|
+
*
|
|
76
|
+
* @param params - Transaction parameters
|
|
77
|
+
* @returns Hex-encoded signed transaction
|
|
78
|
+
*/
|
|
79
|
+
async signTransaction(params) {
|
|
80
|
+
if (!params.contractAddress) {
|
|
81
|
+
throw new Error("contractAddress is required");
|
|
82
|
+
}
|
|
83
|
+
if (!params.to) {
|
|
84
|
+
throw new Error("recipient address (to) is required");
|
|
85
|
+
}
|
|
86
|
+
if (!params.amount || BigInt(params.amount) <= 0n) {
|
|
87
|
+
throw new Error("amount must be a positive value");
|
|
88
|
+
}
|
|
89
|
+
const blockInfo = await this.getBlockInfo();
|
|
90
|
+
const feeLimit = params.feeLimit ?? 1e8;
|
|
91
|
+
const transaction = await this.buildTrc20Transaction({
|
|
92
|
+
contractAddress: params.contractAddress,
|
|
93
|
+
to: params.to,
|
|
94
|
+
amount: params.amount,
|
|
95
|
+
feeLimit,
|
|
96
|
+
refBlockBytes: blockInfo.refBlockBytes,
|
|
97
|
+
refBlockHash: blockInfo.refBlockHash,
|
|
98
|
+
expiration: params.expiration ?? blockInfo.expiration
|
|
99
|
+
});
|
|
100
|
+
const signedTx = await this._account.signTransaction(transaction);
|
|
101
|
+
return this.serializeTransaction(signedTx);
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Get the current reference block info for transaction building
|
|
105
|
+
* This is required for TRON's replay protection mechanism
|
|
106
|
+
*/
|
|
107
|
+
async getBlockInfo() {
|
|
108
|
+
try {
|
|
109
|
+
const response = await fetch(`${this._rpcUrl}/wallet/getnowblock`, {
|
|
110
|
+
method: "POST",
|
|
111
|
+
headers: { "Content-Type": "application/json" },
|
|
112
|
+
body: JSON.stringify({})
|
|
113
|
+
});
|
|
114
|
+
if (!response.ok) {
|
|
115
|
+
throw new Error(`Failed to get block info: ${response.status}`);
|
|
116
|
+
}
|
|
117
|
+
const block = await response.json();
|
|
118
|
+
const blockNum = block.block_header.raw_data.number;
|
|
119
|
+
const refBlockBytes = blockNum.toString(16).padStart(8, "0").slice(-4);
|
|
120
|
+
const refBlockHash = block.blockID.slice(16, 32);
|
|
121
|
+
const expiration = block.block_header.raw_data.timestamp + 6e4;
|
|
122
|
+
return {
|
|
123
|
+
refBlockBytes,
|
|
124
|
+
refBlockHash,
|
|
125
|
+
expiration
|
|
126
|
+
};
|
|
127
|
+
} catch (error) {
|
|
128
|
+
throw new Error(
|
|
129
|
+
`Failed to get TRON block info: ${error instanceof Error ? error.message : String(error)}`
|
|
130
|
+
);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Build a TRC20 transfer transaction
|
|
135
|
+
*/
|
|
136
|
+
async buildTrc20Transaction(params) {
|
|
137
|
+
const functionSelector = "transfer(address,uint256)";
|
|
138
|
+
const toAddressHex = this.addressToHex(params.to).slice(2).padStart(64, "0");
|
|
139
|
+
const amountHex = BigInt(params.amount).toString(16).padStart(64, "0");
|
|
140
|
+
const parameter = toAddressHex + amountHex;
|
|
141
|
+
try {
|
|
142
|
+
const response = await fetch(`${this._rpcUrl}/wallet/triggersmartcontract`, {
|
|
143
|
+
method: "POST",
|
|
144
|
+
headers: { "Content-Type": "application/json" },
|
|
145
|
+
body: JSON.stringify({
|
|
146
|
+
owner_address: this.addressToHex(this._address),
|
|
147
|
+
contract_address: this.addressToHex(params.contractAddress),
|
|
148
|
+
function_selector: functionSelector,
|
|
149
|
+
parameter,
|
|
150
|
+
fee_limit: params.feeLimit
|
|
151
|
+
})
|
|
152
|
+
});
|
|
153
|
+
if (!response.ok) {
|
|
154
|
+
throw new Error(`Failed to build transaction: ${response.status}`);
|
|
155
|
+
}
|
|
156
|
+
const result = await response.json();
|
|
157
|
+
if (result.result?.code) {
|
|
158
|
+
throw new Error(`Transaction build failed: ${result.result.message}`);
|
|
159
|
+
}
|
|
160
|
+
return result.transaction;
|
|
161
|
+
} catch (error) {
|
|
162
|
+
throw new Error(
|
|
163
|
+
`Failed to build TRC20 transaction: ${error instanceof Error ? error.message : String(error)}`
|
|
164
|
+
);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Serialize a signed transaction to hex format
|
|
169
|
+
*/
|
|
170
|
+
serializeTransaction(signedTx) {
|
|
171
|
+
if (signedTx.signature && signedTx.signature.length > 0) {
|
|
172
|
+
return JSON.stringify(signedTx);
|
|
173
|
+
}
|
|
174
|
+
return signedTx.raw_data_hex;
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Convert TRON base58 address to hex format
|
|
178
|
+
*/
|
|
179
|
+
addressToHex(address) {
|
|
180
|
+
if (address.startsWith("41") || address.startsWith("0x")) {
|
|
181
|
+
return address.startsWith("0x") ? "41" + address.slice(2) : address;
|
|
182
|
+
}
|
|
183
|
+
const ALPHABET = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
|
|
184
|
+
let num = BigInt(0);
|
|
185
|
+
for (const char of address) {
|
|
186
|
+
num = num * BigInt(58) + BigInt(ALPHABET.indexOf(char));
|
|
187
|
+
}
|
|
188
|
+
let hex = num.toString(16);
|
|
189
|
+
let leadingZeros = 0;
|
|
190
|
+
for (const char of address) {
|
|
191
|
+
if (char === "1") leadingZeros++;
|
|
192
|
+
else break;
|
|
193
|
+
}
|
|
194
|
+
hex = "00".repeat(leadingZeros) + hex;
|
|
195
|
+
return hex.slice(0, 42);
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* Get TRX balance in SUN
|
|
199
|
+
*/
|
|
200
|
+
async getBalance() {
|
|
201
|
+
return this._account.getBalance();
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* Get TRC20 token balance
|
|
205
|
+
* @param contractAddress - TRC20 contract address
|
|
206
|
+
*/
|
|
207
|
+
async getTrc20Balance(contractAddress) {
|
|
208
|
+
return this._account.getTrc20Balance(contractAddress);
|
|
209
|
+
}
|
|
210
|
+
};
|
|
211
|
+
async function createWDKTronSigner(account, rpcUrl) {
|
|
212
|
+
const adapter = new WDKTronSignerAdapter(account, rpcUrl);
|
|
213
|
+
await adapter.initialize();
|
|
214
|
+
return adapter;
|
|
215
|
+
}
|
|
216
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
217
|
+
0 && (module.exports = {
|
|
218
|
+
WDKTronSignerAdapter,
|
|
219
|
+
createWDKTronSigner
|
|
220
|
+
});
|
|
221
|
+
//# sourceMappingURL=tron-adapter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/adapters/tron-adapter.ts"],"sourcesContent":["/**\n * TRON Signer Adapter for WDK\n *\n * Wraps a Tether WDK TRON account to implement T402's ClientTronSigner interface.\n * This allows WDK-managed TRON wallets to be used for T402 payments.\n */\n\nimport type { WDKTronAccount } from '../types.js'\n\n/**\n * SignTransactionParams matching T402's @t402/tron interface\n */\nexport interface SignTransactionParams {\n /** TRC20 contract address */\n contractAddress: string\n /** Recipient address (T-prefix base58check) */\n to: string\n /** Amount to transfer (in smallest units) */\n amount: string\n /** Fee limit in SUN (optional, defaults to 100 TRX) */\n feeLimit?: number\n /** Transaction expiration time in milliseconds (optional) */\n expiration?: number\n}\n\n/**\n * Block info for transaction building\n */\nexport interface BlockInfo {\n /** Reference block bytes (hex) */\n refBlockBytes: string\n /** Reference block hash (hex) */\n refBlockHash: string\n /** Expiration timestamp in milliseconds */\n expiration: number\n}\n\n/**\n * ClientTronSigner interface matching T402's @t402/tron\n */\nexport interface ClientTronSigner {\n readonly address: string\n signTransaction(params: SignTransactionParams): Promise<string>\n getBlockInfo(): Promise<BlockInfo>\n}\n\n// TronWeb-compatible types\ninterface TronWebTransaction {\n txID: string\n raw_data: {\n contract: unknown[]\n ref_block_bytes: string\n ref_block_hash: string\n expiration: number\n timestamp: number\n }\n raw_data_hex: string\n signature?: string[]\n}\n\ninterface TronWebBlock {\n block_header: {\n raw_data: {\n number: number\n txTrieRoot: string\n witness_address: string\n parentHash: string\n version: number\n timestamp: number\n }\n witness_signature: string\n }\n blockID: string\n}\n\n/**\n * WDKTronSignerAdapter - Adapts a WDK TRON account to T402's ClientTronSigner\n *\n * @example\n * ```typescript\n * const adapter = await createWDKTronSigner(wdkTronAccount);\n * const signedTx = await adapter.signTransaction({\n * contractAddress: 'TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t',\n * to: 'TRecipientAddress...',\n * amount: '1000000', // 1 USDT\n * });\n * ```\n */\nexport class WDKTronSignerAdapter implements ClientTronSigner {\n private _account: WDKTronAccount\n private _address: string | null = null\n private _initialized = false\n private _rpcUrl: string\n\n constructor(account: WDKTronAccount, rpcUrl = 'https://api.trongrid.io') {\n if (!account) {\n throw new Error('WDK TRON account is required')\n }\n this._account = account\n this._rpcUrl = rpcUrl\n }\n\n /**\n * Get the wallet address (T-prefix base58check)\n * @throws Error if not initialized\n */\n get address(): string {\n if (!this._address) {\n throw new Error(\n 'TRON signer not initialized. Call initialize() first or use createWDKTronSigner().',\n )\n }\n return this._address\n }\n\n /**\n * Check if the adapter is initialized\n */\n get isInitialized(): boolean {\n return this._initialized\n }\n\n /**\n * Initialize the adapter by fetching the address\n * Must be called before using the signer\n */\n async initialize(): Promise<void> {\n if (this._initialized) {\n return\n }\n\n this._address = await this._account.getAddress()\n this._initialized = true\n }\n\n /**\n * Sign a TRC20 transfer transaction\n *\n * This method:\n * 1. Builds a TRC20 transfer transaction\n * 2. Signs it using the WDK account\n * 3. Returns the hex-encoded signed transaction\n *\n * @param params - Transaction parameters\n * @returns Hex-encoded signed transaction\n */\n async signTransaction(params: SignTransactionParams): Promise<string> {\n if (!params.contractAddress) {\n throw new Error('contractAddress is required')\n }\n if (!params.to) {\n throw new Error('recipient address (to) is required')\n }\n if (!params.amount || BigInt(params.amount) <= 0n) {\n throw new Error('amount must be a positive value')\n }\n\n // Get block info for transaction\n const blockInfo = await this.getBlockInfo()\n\n // Default fee limit: 100 TRX = 100_000_000 SUN\n const feeLimit = params.feeLimit ?? 100_000_000\n\n // Build the TRC20 transfer transaction\n const transaction = await this.buildTrc20Transaction({\n contractAddress: params.contractAddress,\n to: params.to,\n amount: params.amount,\n feeLimit,\n refBlockBytes: blockInfo.refBlockBytes,\n refBlockHash: blockInfo.refBlockHash,\n expiration: params.expiration ?? blockInfo.expiration,\n })\n\n // Sign the transaction using WDK account\n const signedTx = await this._account.signTransaction(transaction)\n\n // Serialize to hex format\n return this.serializeTransaction(signedTx as TronWebTransaction)\n }\n\n /**\n * Get the current reference block info for transaction building\n * This is required for TRON's replay protection mechanism\n */\n async getBlockInfo(): Promise<BlockInfo> {\n try {\n const response = await fetch(`${this._rpcUrl}/wallet/getnowblock`, {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({}),\n })\n\n if (!response.ok) {\n throw new Error(`Failed to get block info: ${response.status}`)\n }\n\n const block = (await response.json()) as TronWebBlock\n\n // Extract reference block bytes (last 4 bytes of block number)\n const blockNum = block.block_header.raw_data.number\n const refBlockBytes = blockNum.toString(16).padStart(8, '0').slice(-4)\n\n // Reference block hash (first 8 bytes of block ID)\n const refBlockHash = block.blockID.slice(16, 32)\n\n // Expiration: block timestamp + 60 seconds\n const expiration = block.block_header.raw_data.timestamp + 60000\n\n return {\n refBlockBytes,\n refBlockHash,\n expiration,\n }\n } catch (error) {\n throw new Error(\n `Failed to get TRON block info: ${error instanceof Error ? error.message : String(error)}`,\n )\n }\n }\n\n /**\n * Build a TRC20 transfer transaction\n */\n private async buildTrc20Transaction(params: {\n contractAddress: string\n to: string\n amount: string\n feeLimit: number\n refBlockBytes: string\n refBlockHash: string\n expiration: number\n }): Promise<TronWebTransaction> {\n // Build TRC20 transfer function call\n // transfer(address,uint256) = 0xa9059cbb\n const functionSelector = 'transfer(address,uint256)'\n\n // Encode parameters\n const toAddressHex = this.addressToHex(params.to).slice(2).padStart(64, '0')\n const amountHex = BigInt(params.amount).toString(16).padStart(64, '0')\n const parameter = toAddressHex + amountHex\n\n try {\n const response = await fetch(`${this._rpcUrl}/wallet/triggersmartcontract`, {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({\n owner_address: this.addressToHex(this._address!),\n contract_address: this.addressToHex(params.contractAddress),\n function_selector: functionSelector,\n parameter,\n fee_limit: params.feeLimit,\n }),\n })\n\n if (!response.ok) {\n throw new Error(`Failed to build transaction: ${response.status}`)\n }\n\n const result = await response.json()\n\n if (result.result?.code) {\n throw new Error(`Transaction build failed: ${result.result.message}`)\n }\n\n return result.transaction as TronWebTransaction\n } catch (error) {\n throw new Error(\n `Failed to build TRC20 transaction: ${error instanceof Error ? error.message : String(error)}`,\n )\n }\n }\n\n /**\n * Serialize a signed transaction to hex format\n */\n private serializeTransaction(signedTx: TronWebTransaction): string {\n // Return the raw_data_hex with signature appended\n if (signedTx.signature && signedTx.signature.length > 0) {\n return JSON.stringify(signedTx)\n }\n return signedTx.raw_data_hex\n }\n\n /**\n * Convert TRON base58 address to hex format\n */\n private addressToHex(address: string): string {\n // If already hex, return as-is\n if (address.startsWith('41') || address.startsWith('0x')) {\n return address.startsWith('0x') ? '41' + address.slice(2) : address\n }\n\n // Convert base58 to hex using simple algorithm\n const ALPHABET = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz'\n let num = BigInt(0)\n for (const char of address) {\n num = num * BigInt(58) + BigInt(ALPHABET.indexOf(char))\n }\n\n // Convert to hex and take first 42 chars (21 bytes)\n let hex = num.toString(16)\n // Handle leading zeros\n let leadingZeros = 0\n for (const char of address) {\n if (char === '1') leadingZeros++\n else break\n }\n hex = '00'.repeat(leadingZeros) + hex\n\n // TRON address is 21 bytes = 42 hex chars\n return hex.slice(0, 42)\n }\n\n /**\n * Get TRX balance in SUN\n */\n async getBalance(): Promise<bigint> {\n return this._account.getBalance()\n }\n\n /**\n * Get TRC20 token balance\n * @param contractAddress - TRC20 contract address\n */\n async getTrc20Balance(contractAddress: string): Promise<bigint> {\n return this._account.getTrc20Balance(contractAddress)\n }\n}\n\n/**\n * Create an initialized WDK TRON signer\n *\n * @param account - WDK TRON account from @tetherto/wdk-wallet-tron\n * @param rpcUrl - Optional custom RPC URL (default: https://api.trongrid.io)\n * @returns Initialized ClientTronSigner\n *\n * @example\n * ```typescript\n * import { T402WDK } from '@t402/wdk';\n *\n * const wallet = new T402WDK(seedPhrase, config);\n * const tronSigner = await wallet.getTronSigner();\n *\n * // Use with T402 client\n * const client = createT402HTTPClient({\n * signers: [{ scheme: 'exact', network: 'tron:mainnet', signer: tronSigner }]\n * });\n * ```\n */\nexport async function createWDKTronSigner(\n account: WDKTronAccount,\n rpcUrl?: string,\n): Promise<WDKTronSignerAdapter> {\n const adapter = new WDKTronSignerAdapter(account, rpcUrl)\n await adapter.initialize()\n return adapter\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAwFO,IAAM,uBAAN,MAAuD;AAAA,EACpD;AAAA,EACA,WAA0B;AAAA,EAC1B,eAAe;AAAA,EACf;AAAA,EAER,YAAY,SAAyB,SAAS,2BAA2B;AACvE,QAAI,CAAC,SAAS;AACZ,YAAM,IAAI,MAAM,8BAA8B;AAAA,IAChD;AACA,SAAK,WAAW;AAChB,SAAK,UAAU;AAAA,EACjB;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,IAAI,UAAkB;AACpB,QAAI,CAAC,KAAK,UAAU;AAClB,YAAM,IAAI;AAAA,QACR;AAAA,MACF;AAAA,IACF;AACA,WAAO,KAAK;AAAA,EACd;AAAA;AAAA;AAAA;AAAA,EAKA,IAAI,gBAAyB;AAC3B,WAAO,KAAK;AAAA,EACd;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,MAAM,aAA4B;AAChC,QAAI,KAAK,cAAc;AACrB;AAAA,IACF;AAEA,SAAK,WAAW,MAAM,KAAK,SAAS,WAAW;AAC/C,SAAK,eAAe;AAAA,EACtB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAaA,MAAM,gBAAgB,QAAgD;AACpE,QAAI,CAAC,OAAO,iBAAiB;AAC3B,YAAM,IAAI,MAAM,6BAA6B;AAAA,IAC/C;AACA,QAAI,CAAC,OAAO,IAAI;AACd,YAAM,IAAI,MAAM,oCAAoC;AAAA,IACtD;AACA,QAAI,CAAC,OAAO,UAAU,OAAO,OAAO,MAAM,KAAK,IAAI;AACjD,YAAM,IAAI,MAAM,iCAAiC;AAAA,IACnD;AAGA,UAAM,YAAY,MAAM,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