@kynesyslabs/demosdk 2.5.12 → 2.6.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/build/abstraction/Identities.d.ts +21 -5
- package/build/abstraction/Identities.js +21 -20
- package/build/abstraction/Identities.js.map +1 -1
- package/build/abstraction/index.d.ts +2 -2
- package/build/abstraction/index.js.map +1 -1
- package/build/multichain/core/aptos.js.map +1 -1
- package/build/multichain/core/btc.d.ts +26 -2
- package/build/multichain/core/btc.js +106 -37
- package/build/multichain/core/btc.js.map +1 -1
- package/build/multichain/core/ibc.d.ts +1 -1
- package/build/multichain/core/ibc.js +29 -14
- package/build/multichain/core/ibc.js.map +1 -1
- package/build/multichain/core/index.d.ts +1 -0
- package/build/multichain/core/index.js +3 -1
- package/build/multichain/core/index.js.map +1 -1
- package/build/multichain/core/multiversx.d.ts +2 -2
- package/build/multichain/core/multiversx.js +9 -1
- package/build/multichain/core/multiversx.js.map +1 -1
- package/build/multichain/core/near.js +6 -2
- package/build/multichain/core/near.js.map +1 -1
- package/build/multichain/core/ton.d.ts +11 -3
- package/build/multichain/core/ton.js +61 -7
- package/build/multichain/core/ton.js.map +1 -1
- package/build/multichain/core/tron.d.ts +77 -0
- package/build/multichain/core/tron.js +255 -0
- package/build/multichain/core/tron.js.map +1 -0
- package/build/multichain/core/types/defaultChain.d.ts +5 -0
- package/build/multichain/core/types/defaultChain.js +7 -0
- package/build/multichain/core/types/defaultChain.js.map +1 -1
- package/build/multichain/localsdk/ibc.js +2 -2
- package/build/multichain/localsdk/ibc.js.map +1 -1
- package/build/multichain/localsdk/index.d.ts +1 -0
- package/build/multichain/localsdk/index.js +3 -1
- package/build/multichain/localsdk/index.js.map +1 -1
- package/build/multichain/localsdk/multiversx.d.ts +1 -1
- package/build/multichain/localsdk/multiversx.js +27 -7
- package/build/multichain/localsdk/multiversx.js.map +1 -1
- package/build/multichain/localsdk/tron.d.ts +3 -0
- package/build/multichain/localsdk/tron.js +8 -0
- package/build/multichain/localsdk/tron.js.map +1 -0
- package/build/types/abstraction/index.d.ts +4 -8
- package/build/types/blockchain/Transaction.d.ts +3 -2
- package/build/types/blockchain/Transaction.js.map +1 -1
- package/build/types/blockchain/TransactionSubtypes/IPFSTransaction.d.ts +92 -0
- package/build/types/blockchain/TransactionSubtypes/IPFSTransaction.js +49 -0
- package/build/types/blockchain/TransactionSubtypes/IPFSTransaction.js.map +1 -0
- package/build/types/blockchain/TransactionSubtypes/index.d.ts +3 -1
- package/build/types/blockchain/TransactionSubtypes/index.js +1 -0
- package/build/types/blockchain/TransactionSubtypes/index.js.map +1 -1
- package/build/types/index.d.ts +1 -1
- package/build/types/index.js +7 -1
- package/build/types/index.js.map +1 -1
- package/build/websdk/examples/tryWeb2.js +1 -1
- package/package.json +6 -3
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.TRON = void 0;
|
|
7
|
+
const _1 = require(".");
|
|
8
|
+
const tronweb_1 = require("tronweb");
|
|
9
|
+
const bignumber_js_1 = __importDefault(require("bignumber.js"));
|
|
10
|
+
const defaultChain_1 = require("./types/defaultChain");
|
|
11
|
+
const interfaces_1 = require("./types/interfaces");
|
|
12
|
+
class TRON extends defaultChain_1.DefaultChain {
|
|
13
|
+
constructor(rpc_url) {
|
|
14
|
+
super(rpc_url);
|
|
15
|
+
this.name = "tron";
|
|
16
|
+
}
|
|
17
|
+
setRpc(rpc_url) {
|
|
18
|
+
this.rpc_url = rpc_url;
|
|
19
|
+
this.provider = new tronweb_1.TronWeb({
|
|
20
|
+
fullHost: this.rpc_url,
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
async connect() {
|
|
24
|
+
try {
|
|
25
|
+
(0, _1.required)(this.provider, "Provider not initialized. Call setRpc first.");
|
|
26
|
+
// Test connection by getting latest block
|
|
27
|
+
const block = await this.provider.trx.getCurrentBlock();
|
|
28
|
+
this.connected = !!block?.block_header;
|
|
29
|
+
return this.connected;
|
|
30
|
+
}
|
|
31
|
+
catch (error) {
|
|
32
|
+
console.error("[TRON] Connection failed:", error);
|
|
33
|
+
this.connected = false;
|
|
34
|
+
return false;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
async connectWallet(privateKey) {
|
|
38
|
+
(0, _1.required)(this.provider, "Provider not initialized. Call setRpc first.");
|
|
39
|
+
// Trim whitespace from private key before processing
|
|
40
|
+
const trimmedKey = privateKey.trim();
|
|
41
|
+
const cleanPrivateKey = trimmedKey.startsWith("0x")
|
|
42
|
+
? trimmedKey.slice(2)
|
|
43
|
+
: trimmedKey;
|
|
44
|
+
this.wallet = new tronweb_1.TronWeb({
|
|
45
|
+
fullHost: this.rpc_url,
|
|
46
|
+
privateKey: cleanPrivateKey,
|
|
47
|
+
});
|
|
48
|
+
return this.wallet;
|
|
49
|
+
}
|
|
50
|
+
getAddress() {
|
|
51
|
+
(0, _1.required)(this.wallet, "Wallet not connected");
|
|
52
|
+
const address = this.wallet.defaultAddress.base58;
|
|
53
|
+
if (!address) {
|
|
54
|
+
throw new Error("Wallet address not available");
|
|
55
|
+
}
|
|
56
|
+
const addressStr = String(address);
|
|
57
|
+
// Validate the address format
|
|
58
|
+
if (!tronweb_1.TronWeb.isAddress(addressStr)) {
|
|
59
|
+
throw new Error(`Invalid TRON address: ${addressStr}`);
|
|
60
|
+
}
|
|
61
|
+
return addressStr;
|
|
62
|
+
}
|
|
63
|
+
async getBalance(address) {
|
|
64
|
+
(0, _1.required)(this.provider, "Provider not initialized");
|
|
65
|
+
try {
|
|
66
|
+
// Returns balance in SUN (1 TRX = 1,000,000 SUN)
|
|
67
|
+
const balanceSun = await this.provider.trx.getBalance(address);
|
|
68
|
+
return new bignumber_js_1.default(balanceSun).toString();
|
|
69
|
+
}
|
|
70
|
+
catch (error) {
|
|
71
|
+
console.error("[TRON] Failed to get balance:", error);
|
|
72
|
+
throw error;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
async getInfo() {
|
|
76
|
+
(0, _1.required)(this.provider, "Provider not initialized");
|
|
77
|
+
return await this.provider.trx.getCurrentBlock();
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Creates a new TRON wallet
|
|
81
|
+
* @param _password Password parameter (reserved for future encryption support)
|
|
82
|
+
* @returns Object containing the wallet address and private key
|
|
83
|
+
* @note Currently returns unencrypted private key. Password parameter is accepted
|
|
84
|
+
* for interface compatibility but not yet used for encryption.
|
|
85
|
+
*/
|
|
86
|
+
async createWallet(_password) {
|
|
87
|
+
const account = await tronweb_1.TronWeb.createAccount();
|
|
88
|
+
// TODO: Implement password-based encryption of privateKey
|
|
89
|
+
// For now, return unencrypted to match other chain implementations
|
|
90
|
+
return {
|
|
91
|
+
address: account.address.base58,
|
|
92
|
+
privateKey: account.privateKey,
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
async signMessage(message, options) {
|
|
96
|
+
(0, _1.required)(this.wallet || options?.privateKey, "Wallet not connected");
|
|
97
|
+
const wallet = options?.privateKey
|
|
98
|
+
? new tronweb_1.TronWeb({ fullHost: this.rpc_url, privateKey: options.privateKey })
|
|
99
|
+
: this.wallet;
|
|
100
|
+
const hexMessage = tronweb_1.TronWeb.toHex(message);
|
|
101
|
+
const signedMessage = await wallet.trx.signMessageV2(hexMessage);
|
|
102
|
+
return signedMessage;
|
|
103
|
+
}
|
|
104
|
+
async verifyMessage(message, signature, publicKey) {
|
|
105
|
+
try {
|
|
106
|
+
const hexMessage = tronweb_1.TronWeb.toHex(message);
|
|
107
|
+
const tronWeb = this.provider || new tronweb_1.TronWeb({
|
|
108
|
+
fullHost: this.rpc_url
|
|
109
|
+
});
|
|
110
|
+
const recoveredAddress = await tronWeb.trx.verifyMessageV2(hexMessage, signature);
|
|
111
|
+
return recoveredAddress.toLowerCase() === publicKey.toLowerCase();
|
|
112
|
+
}
|
|
113
|
+
catch (error) {
|
|
114
|
+
console.error("[TRON] Message verification failed:", error);
|
|
115
|
+
return false;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
async signTransaction(tx) {
|
|
119
|
+
(0, _1.required)(this.wallet, "Wallet not connected");
|
|
120
|
+
return await this.wallet.trx.sign(tx);
|
|
121
|
+
}
|
|
122
|
+
async signTransactions(transactions, options) {
|
|
123
|
+
const wallet = options?.privateKey
|
|
124
|
+
? new tronweb_1.TronWeb({ fullHost: this.rpc_url, privateKey: options.privateKey })
|
|
125
|
+
: this.wallet;
|
|
126
|
+
(0, _1.required)(wallet, "Wallet not connected");
|
|
127
|
+
const signedTxs = [];
|
|
128
|
+
for (const tx of transactions) {
|
|
129
|
+
const signedTx = await wallet.trx.sign(tx);
|
|
130
|
+
signedTxs.push(signedTx);
|
|
131
|
+
}
|
|
132
|
+
return signedTxs;
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Prepare a TRX transfer transaction
|
|
136
|
+
* @param receiver Recipient address (base58 format)
|
|
137
|
+
* @param amount Amount in SUN (1 TRX = 1,000,000 SUN)
|
|
138
|
+
* @param options Options including optional privateKey
|
|
139
|
+
* @returns Signed transaction ready to broadcast
|
|
140
|
+
*/
|
|
141
|
+
async preparePay(receiver, amount, options) {
|
|
142
|
+
const txs = await this.preparePays([{ address: receiver, amount }], options);
|
|
143
|
+
return txs[0];
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Prepare multiple TRX transfer transactions
|
|
147
|
+
* @param payments Array of payments with address and amount (in SUN)
|
|
148
|
+
* @param options Options including optional privateKey
|
|
149
|
+
* @returns Array of signed transactions
|
|
150
|
+
*/
|
|
151
|
+
async preparePays(payments, options) {
|
|
152
|
+
const wallet = options?.privateKey
|
|
153
|
+
? new tronweb_1.TronWeb({ fullHost: this.rpc_url, privateKey: options.privateKey })
|
|
154
|
+
: this.wallet;
|
|
155
|
+
(0, _1.required)(wallet, "Wallet not connected");
|
|
156
|
+
const signedTxs = [];
|
|
157
|
+
for (const payment of payments) {
|
|
158
|
+
const amountBN = new bignumber_js_1.default(payment.amount);
|
|
159
|
+
if (!amountBN.isFinite() || amountBN.isNegative()) {
|
|
160
|
+
throw new Error(`Invalid payment amount: ${payment.amount}`);
|
|
161
|
+
}
|
|
162
|
+
// Convert to integer (SUN should be whole numbers)
|
|
163
|
+
const amountIntBN = amountBN.integerValue(bignumber_js_1.default.ROUND_FLOOR);
|
|
164
|
+
// Validate amount doesn't exceed JavaScript's safe integer limit
|
|
165
|
+
// TronWeb API requires a JavaScript Number, so we must ensure precision is preserved
|
|
166
|
+
if (amountIntBN.isGreaterThan(Number.MAX_SAFE_INTEGER)) {
|
|
167
|
+
const maxTrx = Math.floor(Number.MAX_SAFE_INTEGER / TRON.SUN_PER_TRX);
|
|
168
|
+
throw new Error(`Payment amount ${payment.amount} SUN exceeds maximum safe integer (${Number.MAX_SAFE_INTEGER}). ` +
|
|
169
|
+
`Maximum supported amount is ~${maxTrx.toLocaleString()} TRX.`);
|
|
170
|
+
}
|
|
171
|
+
const amountInSun = amountIntBN.toNumber();
|
|
172
|
+
const fromAddress = wallet.defaultAddress.base58;
|
|
173
|
+
if (!fromAddress) {
|
|
174
|
+
throw new Error("Wallet address not available");
|
|
175
|
+
}
|
|
176
|
+
const unsignedTx = await wallet.transactionBuilder.sendTrx(payment.address, amountInSun, String(fromAddress));
|
|
177
|
+
const signedTx = await wallet.trx.sign(unsignedTx);
|
|
178
|
+
signedTxs.push(signedTx);
|
|
179
|
+
}
|
|
180
|
+
return signedTxs;
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Broadcast a signed transaction to the network
|
|
184
|
+
* @param signedTx The signed transaction
|
|
185
|
+
* @returns Transaction response with result and hash
|
|
186
|
+
*/
|
|
187
|
+
async sendTransaction(signedTx) {
|
|
188
|
+
(0, _1.required)(this.provider, "Provider not initialized");
|
|
189
|
+
try {
|
|
190
|
+
const result = await this.provider.trx.sendRawTransaction(signedTx);
|
|
191
|
+
if (result.result === true) {
|
|
192
|
+
return {
|
|
193
|
+
result: interfaces_1.XmTransactionResult.success,
|
|
194
|
+
hash: result.txid || result.transaction?.txID,
|
|
195
|
+
};
|
|
196
|
+
}
|
|
197
|
+
return {
|
|
198
|
+
result: interfaces_1.XmTransactionResult.error,
|
|
199
|
+
error: result.message || String(result.code) || "Transaction failed",
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
catch (error) {
|
|
203
|
+
console.error("[TRON] Send transaction failed:", error);
|
|
204
|
+
return {
|
|
205
|
+
result: interfaces_1.XmTransactionResult.error,
|
|
206
|
+
error: error.message || error.toString(),
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
getEmptyTransaction() {
|
|
211
|
+
return {};
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* Convert TRX to SUN
|
|
215
|
+
* @param trx Amount in TRX
|
|
216
|
+
* @returns Amount in SUN as bigint
|
|
217
|
+
*/
|
|
218
|
+
static trxToSun(trx) {
|
|
219
|
+
if (typeof trx === "string") {
|
|
220
|
+
trx = trx.trim() || "0";
|
|
221
|
+
}
|
|
222
|
+
const trxAmount = new bignumber_js_1.default(trx);
|
|
223
|
+
if (!trxAmount.isFinite()) {
|
|
224
|
+
throw new Error(`Invalid TRX amount: ${trx}`);
|
|
225
|
+
}
|
|
226
|
+
const sun = trxAmount.times(TRON.SUN_PER_TRX).integerValue(bignumber_js_1.default.ROUND_FLOOR);
|
|
227
|
+
return BigInt(sun.toString());
|
|
228
|
+
}
|
|
229
|
+
/**
|
|
230
|
+
* Convert SUN to TRX with full precision preservation
|
|
231
|
+
* @param sun Amount in SUN as bigint
|
|
232
|
+
* @returns Amount in TRX as a decimal string (e.g., "123.456789")
|
|
233
|
+
* @note This method returns a string to preserve precision for large values.
|
|
234
|
+
* For display purposes, you may want to parse this with a BigNumber library.
|
|
235
|
+
*/
|
|
236
|
+
static sunToTrx(sun) {
|
|
237
|
+
const sunPerTrx = BigInt(TRON.SUN_PER_TRX);
|
|
238
|
+
const isNegative = sun < 0n;
|
|
239
|
+
const absSun = isNegative ? -sun : sun;
|
|
240
|
+
const integerPart = absSun / sunPerTrx;
|
|
241
|
+
const remainder = absSun % sunPerTrx;
|
|
242
|
+
// Pad remainder to 6 decimal places (TRON has 6 decimals)
|
|
243
|
+
const fractionalStr = remainder.toString().padStart(6, "0");
|
|
244
|
+
// Remove trailing zeros for cleaner output
|
|
245
|
+
const trimmedFractional = fractionalStr.replace(/0+$/, "") || "0";
|
|
246
|
+
const base = trimmedFractional === "0"
|
|
247
|
+
? integerPart.toString()
|
|
248
|
+
: `${integerPart}.${trimmedFractional}`;
|
|
249
|
+
return isNegative ? `-${base}` : base;
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
exports.TRON = TRON;
|
|
253
|
+
// TRX has 6 decimal places (1 TRX = 1,000,000 SUN)
|
|
254
|
+
TRON.SUN_PER_TRX = 1000000;
|
|
255
|
+
//# sourceMappingURL=tron.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tron.js","sourceRoot":"","sources":["../../../../src/multichain/core/tron.ts"],"names":[],"mappings":";;;;;;AAAA,wBAAyC;AACzC,qCAAiC;AACjC,gEAAoC;AACpC,uDAAuE;AACvE,mDAA+E;AAK/E,MAAa,IAAK,SAAQ,2BAAY;IAOlC,YAAY,OAAe;QACvB,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,IAAI,CAAC,IAAI,GAAG,MAAM,CAAA;IACtB,CAAC;IAEQ,MAAM,CAAC,OAAe;QAC3B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;QACtB,IAAI,CAAC,QAAQ,GAAG,IAAI,iBAAO,CAAC;YACxB,QAAQ,EAAE,IAAI,CAAC,OAAO;SACzB,CAAC,CAAA;IACN,CAAC;IAED,KAAK,CAAC,OAAO;QAC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@@ export declare abstract class DefaultChain {
|
|
|
88
88
|
* Returns the address of the connected wallet
|
|
89
89
|
*/
|
|
90
90
|
abstract getAddress(): string;
|
|
91
|
+
/**
|
|
92
|
+
* Returns the public key of the connected wallet (if available).
|
|
93
|
+
* @returns The public key as a hex string, or undefined if not available
|
|
94
|
+
*/
|
|
95
|
+
getPublicKey(): string | undefined;
|
|
91
96
|
/**
|
|
92
97
|
* Signs a message using the connected wallet
|
|
93
98
|
* @param message The message to sign
|
|
@@ -78,6 +78,13 @@ class DefaultChain {
|
|
|
78
78
|
this.resetInstance();
|
|
79
79
|
return !this.connected;
|
|
80
80
|
}
|
|
81
|
+
/**
|
|
82
|
+
* Returns the public key of the connected wallet (if available).
|
|
83
|
+
* @returns The public key as a hex string, or undefined if not available
|
|
84
|
+
*/
|
|
85
|
+
getPublicKey() {
|
|
86
|
+
return undefined;
|
|
87
|
+
}
|
|
81
88
|
}
|
|
82
89
|
exports.DefaultChain = DefaultChain;
|
|
83
90
|
//# sourceMappingURL=defaultChain.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defaultChain.js","sourceRoot":"","sources":["../../../../../src/multichain/core/types/defaultChain.ts"],"names":[],"mappings":";;;AASA,MAAsB,YAAY;IAQ9B,sDAAsD;IACtD,6DAA6D;IAC7D,wDAAwD;IACxD,4CAA4C;IAC5C,YAAY,OAAe;QAX3B,aAAQ,GAAQ,IAAI,CAAA;QACpB,SAAI,GAAW,EAAE,CAAA;QACjB,WAAM,GAAQ,IAAI,CAAA;QAClB,WAAM,GAAQ,IAAI,CAAA;QAClB,YAAO,GAAW,EAAE,CAAA;QACpB,cAAS,GAAY,KAAK,CAAA;QAOtB,IAAI,OAAO,EAAE,CAAC;YACV,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAA;QACxB,CAAC;IACL,CAAC;IAED,0BAA0B;IAE1B;;;OAGG;IACH,MAAM,CAAC,OAAe;QAClB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;IAC1B,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAC,KAAK,CAAC,MAAM,CAEf,UAAkB,EAAE;QAEpB,MAAM,QAAQ,GAAG,IAAI,IAAI,CAAC,OAAO,CAAC,CAAA;QAElC,IAAI,OAAO,EAAE,CAAC;YACV,OAAO,CAAC,GAAG,CAAC,iBAAiB,EAAE,OAAO,CAAC,CAAA;YACvC,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC,CAAA;YACxB,MAAM,QAAQ,CAAC,OAAO,EAAE,CAAA;QAC5B,CAAC;QAED,OAAO,QAAQ,CAAA;IACnB,CAAC;IAED;;OAEG;IACO,aAAa;QACnB,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAA;QACpB,IAAI,CAAC,MAAM,GAAG,IAAI,CAAA;QAClB,IAAI,CAAC,MAAM,GAAG,IAAI,CAAA;QAClB,IAAI,CAAC,SAAS,GAAG,KAAK,CAAA;IAC1B,CAAC;IAED;;;;;;OAMG;IACH,eAAe,CAKX,QAAgB,EAChB,MAAc,EACd,OAAiB;QAEjB,OAAO,IAAI,CAAC,UAAU,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,CAAA;IACrD,CAAC;IAED;;;;;OAKG;IACH,gBAAgB,CAKZ,QAAsB,EACtB,OAAiB;QAEjB,mBAAmB;QACnB,uFAAuF;QACvF,OAAO,IAAI,CAAC,WAAW,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAA;IAC9C,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,UAAU;QACZ,mDAAmD;QACnD,IAAI,CAAC,aAAa,EAAE,CAAA;QACpB,OAAO,CAAC,IAAI,CAAC,SAAS,CAAA;IAC1B,CAAC;
|
|
1
|
+
{"version":3,"file":"defaultChain.js","sourceRoot":"","sources":["../../../../../src/multichain/core/types/defaultChain.ts"],"names":[],"mappings":";;;AASA,MAAsB,YAAY;IAQ9B,sDAAsD;IACtD,6DAA6D;IAC7D,wDAAwD;IACxD,4CAA4C;IA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OAAO,IAAI,CAAC,WAAW,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAA;IAC9C,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,UAAU;QACZ,mDAAmD;QACnD,IAAI,CAAC,aAAa,EAAE,CAAA;QACpB,OAAO,CAAC,IAAI,CAAC,SAAS,CAAA;IAC1B,CAAC;IAmED;;;OAGG;IACH,YAAY;QACR,OAAO,SAAS,CAAA;IACpB,CAAC;CAmDJ;AApOD,oCAoOC"}
|
|
@@ -8,8 +8,8 @@ class IBC extends core_1.IBC {
|
|
|
8
8
|
super(rpc_url);
|
|
9
9
|
}
|
|
10
10
|
async sendTransaction(signed_tx) {
|
|
11
|
-
(0, core_1.required)(this.
|
|
12
|
-
const hash = await this.
|
|
11
|
+
(0, core_1.required)(this.provider, 'Provider not connected');
|
|
12
|
+
const hash = await this.provider.broadcastTxSync(signed_tx);
|
|
13
13
|
return {
|
|
14
14
|
hash,
|
|
15
15
|
result: interfaces_1.XmTransactionResult.success,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ibc.js","sourceRoot":"","sources":["../../../../src/multichain/localsdk/ibc.ts"],"names":[],"mappings":";;;AAAA,4CAAqG;AACrG,yDAA8D;AAE9D,MAAa,GAAI,SAAQ,UAAO;IAC5B,YAAY,OAAe;QACvB,KAAK,CAAC,OAAO,CAAC,CAAA;IAClB,CAAC;IAED,KAAK,CAAC,eAAe,CAAC,SAAqB;QACvC,IAAA,eAAQ,EAAC,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"ibc.js","sourceRoot":"","sources":["../../../../src/multichain/localsdk/ibc.ts"],"names":[],"mappings":";;;AAAA,4CAAqG;AACrG,yDAA8D;AAE9D,MAAa,GAAI,SAAQ,UAAO;IAC5B,YAAY,OAAe;QACvB,KAAK,CAAC,OAAO,CAAC,CAAA;IAClB,CAAC;IAED,KAAK,CAAC,eAAe,CAAC,SAAqB;QACvC,IAAA,eAAQ,EAAC,IAAI,CAAC,QAAQ,EAAE,wBAAwB,CAAC,CAAA;QAEjD,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,eAAe,CAAC,SAAS,CAAC,CAAA;QAC3D,OAAO;YACH,IAAI;YACJ,MAAM,EAAE,gCAAmB,CAAC,OAAO;SACtC,CAAA;IACL,CAAC;IAED,KAAK,CAAC,OAAO;QACT,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAA;IAC9C,CAAC;IAED,KAAK,CAAC,YAAY,CAAC,QAAiB;QAChC,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAA;IAC9C,CAAC;CACJ;AAtBD,kBAsBC"}
|
|
@@ -2,6 +2,7 @@ export { XRPL } from "./xrp";
|
|
|
2
2
|
export { EVM } from "./evm";
|
|
3
3
|
export { IBC } from "./ibc";
|
|
4
4
|
export { TON } from "./ton";
|
|
5
|
+
export { TRON } from "./tron";
|
|
5
6
|
export { SOLANA } from "./solana";
|
|
6
7
|
export { MULTIVERSX } from "./multiversx";
|
|
7
8
|
export { NEAR } from "./near";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.APTOS = exports.BTC = exports.NEAR = exports.MULTIVERSX = exports.SOLANA = exports.TON = exports.IBC = exports.EVM = exports.XRPL = void 0;
|
|
3
|
+
exports.APTOS = exports.BTC = exports.NEAR = exports.MULTIVERSX = exports.SOLANA = exports.TRON = exports.TON = exports.IBC = exports.EVM = exports.XRPL = void 0;
|
|
4
4
|
var xrp_1 = require("./xrp");
|
|
5
5
|
Object.defineProperty(exports, "XRPL", { enumerable: true, get: function () { return xrp_1.XRPL; } });
|
|
6
6
|
var evm_1 = require("./evm");
|
|
@@ -9,6 +9,8 @@ var ibc_1 = require("./ibc");
|
|
|
9
9
|
Object.defineProperty(exports, "IBC", { enumerable: true, get: function () { return ibc_1.IBC; } });
|
|
10
10
|
var ton_1 = require("./ton");
|
|
11
11
|
Object.defineProperty(exports, "TON", { enumerable: true, get: function () { return ton_1.TON; } });
|
|
12
|
+
var tron_1 = require("./tron");
|
|
13
|
+
Object.defineProperty(exports, "TRON", { enumerable: true, get: function () { return tron_1.TRON; } });
|
|
12
14
|
var solana_1 = require("./solana");
|
|
13
15
|
Object.defineProperty(exports, "SOLANA", { enumerable: true, get: function () { return solana_1.SOLANA; } });
|
|
14
16
|
var multiversx_1 = require("./multiversx");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/multichain/localsdk/index.ts"],"names":[],"mappings":";;;AAAA,6BAA4B;AAAnB,2FAAA,IAAI,OAAA;AACb,6BAA2B;AAAlB,0FAAA,GAAG,OAAA;AACZ,6BAA2B;AAAlB,0FAAA,GAAG,OAAA;AACZ,6BAA2B;AAAlB,0FAAA,GAAG,OAAA;AACZ,mCAAiC;AAAxB,gGAAA,MAAM,OAAA;AACf,2CAAyC;AAAhC,wGAAA,UAAU,OAAA;AACnB,+BAA6B;AAApB,4FAAA,IAAI,OAAA;AACb,6BAA2B;AAAlB,0FAAA,GAAG,OAAA;AACZ,iCAA+B;AAAtB,8FAAA,KAAK,OAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/multichain/localsdk/index.ts"],"names":[],"mappings":";;;AAAA,6BAA4B;AAAnB,2FAAA,IAAI,OAAA;AACb,6BAA2B;AAAlB,0FAAA,GAAG,OAAA;AACZ,6BAA2B;AAAlB,0FAAA,GAAG,OAAA;AACZ,6BAA2B;AAAlB,0FAAA,GAAG,OAAA;AACZ,+BAA6B;AAApB,4FAAA,IAAI,OAAA;AACb,mCAAiC;AAAxB,gGAAA,MAAM,OAAA;AACf,2CAAyC;AAAhC,wGAAA,UAAU,OAAA;AACnB,+BAA6B;AAApB,4FAAA,IAAI,OAAA;AACb,6BAA2B;AAAlB,0FAAA,GAAG,OAAA;AACZ,iCAA+B;AAAtB,8FAAA,KAAK,OAAA"}
|
|
@@ -9,5 +9,5 @@ export declare class MULTIVERSX extends EGLDCore implements IDefaultChainLocal {
|
|
|
9
9
|
mnemonics_txt: string;
|
|
10
10
|
wallet_keyfile: string;
|
|
11
11
|
}>;
|
|
12
|
-
sendTransaction(raw_tx: Transaction | IPlainTransactionObject): Promise<TransactionResponse>;
|
|
12
|
+
sendTransaction(raw_tx: Transaction | IPlainTransactionObject | string): Promise<TransactionResponse>;
|
|
13
13
|
}
|
|
@@ -32,16 +32,36 @@ class MULTIVERSX extends core_1.MULTIVERSX {
|
|
|
32
32
|
}
|
|
33
33
|
async sendTransaction(raw_tx) {
|
|
34
34
|
(0, core_1.required)(this.provider, 'Provider not connected');
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
35
|
+
if (raw_tx instanceof sdk_core_1.Transaction) {
|
|
36
|
+
const tx_hash = await this.provider.sendTransaction(raw_tx);
|
|
37
|
+
return {
|
|
38
|
+
result: interfaces_1.XmTransactionResult.success,
|
|
39
|
+
hash: tx_hash,
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
// Handle hex-encoded JSON string
|
|
43
|
+
let plainTx;
|
|
44
|
+
if (typeof raw_tx === 'string') {
|
|
45
|
+
try {
|
|
46
|
+
let jsonString = raw_tx;
|
|
47
|
+
if (raw_tx.startsWith('0x')) {
|
|
48
|
+
jsonString = Buffer.from(raw_tx.slice(2), 'hex').toString('utf-8');
|
|
49
|
+
}
|
|
50
|
+
plainTx = JSON.parse(jsonString);
|
|
51
|
+
}
|
|
52
|
+
catch (error) {
|
|
53
|
+
throw new Error('Failed to parse transaction string. Invalid JSON format.');
|
|
54
|
+
}
|
|
39
55
|
}
|
|
40
56
|
else {
|
|
41
|
-
|
|
57
|
+
plainTx = raw_tx;
|
|
58
|
+
}
|
|
59
|
+
// The plain object format from toPlainObject()/toSendable() is already API-compatible.
|
|
60
|
+
const response = await this.provider.doPostGeneric('transactions', plainTx);
|
|
61
|
+
const tx_hash = response.txHash;
|
|
62
|
+
if (!tx_hash || typeof tx_hash !== 'string') {
|
|
63
|
+
throw new Error(`Failed to send transaction. API response: ${JSON.stringify(response)}`);
|
|
42
64
|
}
|
|
43
|
-
// INFO: The provider can also send a list of transactions
|
|
44
|
-
const tx_hash = await this.provider.sendTransaction(signed_tx);
|
|
45
65
|
return {
|
|
46
66
|
result: interfaces_1.XmTransactionResult.success,
|
|
47
67
|
hash: tx_hash,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"multiversx.js","sourceRoot":"","sources":["../../../../src/multichain/localsdk/multiversx.ts"],"names":[],"mappings":";;;AAAA,4CAK0B;AAE1B,mDAA2E;AAC3E,uDAA6D;AAC7D,yDAA8D;AAE9D,MAAa,UAAW,SAAQ,iBAAQ;IACpC,YAAY,OAAe;QACvB,KAAK,CAAC,OAAO,CAAC,CAAA;IAClB,CAAC;IAED,KAAK,CAAC,OAAO;QACT,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAA;IAC9C,CAAC;IAED,KAAK,CAAC,YAAY,CAAC,QAAgB,EAAE,YAAqB;QACtD,IAAA,eAAQ,EAAC,QAAQ,EAAE,8CAA8C,CAAC,CAAA;QAElE,MAAM,SAAS,GAAG,qBAAQ,CAAC,QAAQ,EAAE,CAAA;QAErC,MAAM,KAAK,GAAG,SAAS,CAAC,QAAQ,EAAE,CAAA;QAClC,MAAM,gBAAgB,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,KAAK,GAAG,IAAI,GAAG,IAAI,CAAC,CAAA;QAExE,MAAM,SAAS,GAAG,SAAS,CAAC,SAAS,CAAC,YAAY,EAAE,QAAQ,CAAC,CAAA;QAC7D,MAAM,MAAM,GAAG,uBAAU,CAAC,aAAa,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC,CAAA;QAEhE,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,CAAA;QAElC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ED,uFAAuF;QACvF,MAAM,QAAQ,GAAG,MAAO,IAAI,CAAC,QAAgB,CAAC,aAAa,CAAC,cAAc,EAAE,OAAO,CAAC,CAAA;QACpF,MAAM,OAAO,GAAG,QAAQ,CAAC,MAAM,CAAA;QAE/B,IAAI,CAAC,OAAO,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE,CAAC;YAC1C,MAAM,IAAI,KAAK,CAAC,6CAA6C,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;QAC7F,CAAC;QAED,OAAO;YACH,MAAM,EAAE,gCAAmB,CAAC,OAAO;YACnC,IAAI,EAAE,OAAO;SAChB,CAAA;IACL,CAAC;CACJ;AA3ED,gCA2EC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tron.js","sourceRoot":"","sources":["../../../../src/multichain/localsdk/tron.ts"],"names":[],"mappings":";;;AAAA,iDAAyD;AAEzD,MAAa,IAAK,SAAQ,WAAQ;CAAI;AAAtC,oBAAsC"}
|
|
@@ -14,6 +14,7 @@ export interface InferFromSignatureTargetIdentityPayload extends XMCoreTargetIde
|
|
|
14
14
|
targetAddress: string;
|
|
15
15
|
signedData: string;
|
|
16
16
|
publicKey?: string;
|
|
17
|
+
displayAddress?: string;
|
|
17
18
|
}
|
|
18
19
|
/**
|
|
19
20
|
* The identity of the target address to bind to the Demos identity
|
|
@@ -68,13 +69,9 @@ export interface Web2CoreTargetIdentityPayload {
|
|
|
68
69
|
userId: string;
|
|
69
70
|
referralCode?: string;
|
|
70
71
|
}
|
|
71
|
-
|
|
72
|
-
type RawGistProofUrl = `https://gist.githubusercontent.com/${string}/${string}`;
|
|
73
|
-
type RawGithubProofUrl = `https://raw.githubusercontent.com/${string}/${string}`;
|
|
74
|
-
export type GithubProof = RawGistProofUrl | GistProofUrl | RawGithubProofUrl;
|
|
75
|
-
export interface InferFromGithubPayload extends Web2CoreTargetIdentityPayload {
|
|
72
|
+
export interface InferFromGithubOAuthPayload extends Web2CoreTargetIdentityPayload {
|
|
76
73
|
context: "github";
|
|
77
|
-
proof:
|
|
74
|
+
proof: string;
|
|
78
75
|
}
|
|
79
76
|
export type XProof = `https://x.com/${string}/${string}`;
|
|
80
77
|
export type TwitterProof = XProof;
|
|
@@ -129,7 +126,7 @@ export interface BaseWeb2IdentityPayload {
|
|
|
129
126
|
}
|
|
130
127
|
export interface Web2IdentityAssignPayload extends BaseWeb2IdentityPayload {
|
|
131
128
|
method: "web2_identity_assign";
|
|
132
|
-
payload:
|
|
129
|
+
payload: InferFromGithubOAuthPayload | InferFromTwitterPayload | InferFromTelegramPayload | InferFromDiscordPayload;
|
|
133
130
|
}
|
|
134
131
|
export interface Web2IdentityRemovePayload extends BaseWeb2IdentityPayload {
|
|
135
132
|
method: "web2_identity_remove";
|
|
@@ -236,4 +233,3 @@ export interface FindDemosIdByWeb3IdentityQuery {
|
|
|
236
233
|
chain: string;
|
|
237
234
|
address: string;
|
|
238
235
|
}
|
|
239
|
-
export {};
|
|
@@ -16,9 +16,10 @@ import { ContractDeployPayload } from "./TransactionSubtypes/ContractDeployTrans
|
|
|
16
16
|
import { ContractCallPayload } from "./TransactionSubtypes/ContractCallTransaction";
|
|
17
17
|
import { D402PaymentPayload } from "./TransactionSubtypes/D402PaymentTransaction";
|
|
18
18
|
import { EscrowPayload } from "./TransactionSubtypes/EscrowTransaction";
|
|
19
|
-
|
|
19
|
+
import { IPFSPayload } from "./TransactionSubtypes/IPFSTransaction";
|
|
20
|
+
export type TransactionContentData = ["web2Request", IWeb2Payload] | ["crosschainOperation", XMScript] | ["native", INativePayload] | ["demoswork", DemoScript] | ["l2psEncryptedTx", L2PSEncryptedPayload] | ["identity", IdentityPayload] | ["instantMessaging", InstantMessagingPayload] | ["nativeBridge", NativeBridgeTxPayload] | ["storage", StoragePayload] | ["storageProgram", StorageProgramPayload] | ["l2ps_hash_update", L2PSHashPayload] | ["contractDeploy", ContractDeployPayload] | ["contractCall", ContractCallPayload] | ["d402_payment", D402PaymentPayload] | ["escrow", EscrowPayload] | ["ipfs", IPFSPayload];
|
|
20
21
|
export interface TransactionContent {
|
|
21
|
-
type: "web2Request" | "crosschainOperation" | "subnet" | "native" | "demoswork" | "genesis" | "NODE_ONLINE" | "identity" | "instantMessaging" | "nativeBridge" | "l2psEncryptedTx" | "storage" | "storageProgram" | "l2ps_hash_update" | "contractDeploy" | "contractCall" | "d402_payment" | "escrow";
|
|
22
|
+
type: "web2Request" | "crosschainOperation" | "subnet" | "native" | "demoswork" | "genesis" | "NODE_ONLINE" | "identity" | "instantMessaging" | "nativeBridge" | "l2psEncryptedTx" | "storage" | "storageProgram" | "l2ps_hash_update" | "contractDeploy" | "contractCall" | "d402_payment" | "escrow" | "ipfs";
|
|
22
23
|
from: string;
|
|
23
24
|
from_ed25519_address: string;
|
|
24
25
|
to: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Transaction.js","sourceRoot":"","sources":["../../../../src/types/blockchain/Transaction.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"Transaction.js","sourceRoot":"","sources":["../../../../src/types/blockchain/Transaction.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAiGA,uCAAuC;AACvC,wDAAqC"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* IPFS Transaction Types
|
|
3
|
+
*
|
|
4
|
+
* Defines transaction types for IPFS operations on the Demos Network.
|
|
5
|
+
* - IPFS_ADD: Upload content and auto-pin
|
|
6
|
+
* - IPFS_PIN: Pin existing CID
|
|
7
|
+
* - IPFS_UNPIN: Remove pin from account
|
|
8
|
+
*
|
|
9
|
+
* @fileoverview IPFS transaction type definitions for SDK
|
|
10
|
+
*/
|
|
11
|
+
import { Transaction, TransactionContent } from "../Transaction";
|
|
12
|
+
/**
|
|
13
|
+
* IPFS operation type constants
|
|
14
|
+
*/
|
|
15
|
+
export type IPFSOperationType = "IPFS_ADD" | "IPFS_PIN" | "IPFS_UNPIN";
|
|
16
|
+
/**
|
|
17
|
+
* Payload for IPFS_ADD operation
|
|
18
|
+
*
|
|
19
|
+
* Uploads content to IPFS and automatically pins it to the sender's account.
|
|
20
|
+
* Content is base64 encoded for JSON compatibility.
|
|
21
|
+
*/
|
|
22
|
+
export interface IPFSAddPayload {
|
|
23
|
+
/** The IPFS operation type */
|
|
24
|
+
operation: "IPFS_ADD";
|
|
25
|
+
/** Base64-encoded content to upload */
|
|
26
|
+
content: string;
|
|
27
|
+
/** Optional filename for the content */
|
|
28
|
+
filename?: string;
|
|
29
|
+
/** Optional metadata to associate with the pin */
|
|
30
|
+
metadata?: Record<string, unknown>;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Payload for IPFS_PIN operation
|
|
34
|
+
*
|
|
35
|
+
* Pins an existing CID to the sender's account.
|
|
36
|
+
* Used when content already exists on IPFS and user wants to ensure availability.
|
|
37
|
+
*/
|
|
38
|
+
export interface IPFSPinPayload {
|
|
39
|
+
/** The IPFS operation type */
|
|
40
|
+
operation: "IPFS_PIN";
|
|
41
|
+
/** Content Identifier to pin */
|
|
42
|
+
cid: string;
|
|
43
|
+
/** Optional duration in blocks (0 = indefinite) */
|
|
44
|
+
duration?: number;
|
|
45
|
+
/** Optional metadata to associate with the pin */
|
|
46
|
+
metadata?: Record<string, unknown>;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Payload for IPFS_UNPIN operation
|
|
50
|
+
*
|
|
51
|
+
* Removes a pin from the sender's account.
|
|
52
|
+
* Content may still exist on IPFS but sender no longer pays for hosting.
|
|
53
|
+
*/
|
|
54
|
+
export interface IPFSUnpinPayload {
|
|
55
|
+
/** The IPFS operation type */
|
|
56
|
+
operation: "IPFS_UNPIN";
|
|
57
|
+
/** Content Identifier to unpin */
|
|
58
|
+
cid: string;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Union type for all IPFS payloads
|
|
62
|
+
*/
|
|
63
|
+
export type IPFSPayload = IPFSAddPayload | IPFSPinPayload | IPFSUnpinPayload;
|
|
64
|
+
/**
|
|
65
|
+
* Transaction content type for IPFS operations
|
|
66
|
+
*/
|
|
67
|
+
export type IPFSTransactionContent = Omit<TransactionContent, "type" | "data"> & {
|
|
68
|
+
type: "ipfs";
|
|
69
|
+
data: ["ipfs", IPFSPayload];
|
|
70
|
+
};
|
|
71
|
+
/**
|
|
72
|
+
* Complete IPFS transaction interface
|
|
73
|
+
*/
|
|
74
|
+
export interface IPFSTransaction extends Omit<Transaction, "content"> {
|
|
75
|
+
content: IPFSTransactionContent;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Check if a payload is an IPFS_ADD operation
|
|
79
|
+
*/
|
|
80
|
+
export declare function isIPFSAddPayload(payload: IPFSPayload): payload is IPFSAddPayload;
|
|
81
|
+
/**
|
|
82
|
+
* Check if a payload is an IPFS_PIN operation
|
|
83
|
+
*/
|
|
84
|
+
export declare function isIPFSPinPayload(payload: IPFSPayload): payload is IPFSPinPayload;
|
|
85
|
+
/**
|
|
86
|
+
* Check if a payload is an IPFS_UNPIN operation
|
|
87
|
+
*/
|
|
88
|
+
export declare function isIPFSUnpinPayload(payload: IPFSPayload): payload is IPFSUnpinPayload;
|
|
89
|
+
/**
|
|
90
|
+
* Check if any payload is an IPFS payload
|
|
91
|
+
*/
|
|
92
|
+
export declare function isIPFSPayload(payload: unknown): payload is IPFSPayload;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* IPFS Transaction Types
|
|
4
|
+
*
|
|
5
|
+
* Defines transaction types for IPFS operations on the Demos Network.
|
|
6
|
+
* - IPFS_ADD: Upload content and auto-pin
|
|
7
|
+
* - IPFS_PIN: Pin existing CID
|
|
8
|
+
* - IPFS_UNPIN: Remove pin from account
|
|
9
|
+
*
|
|
10
|
+
* @fileoverview IPFS transaction type definitions for SDK
|
|
11
|
+
*/
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
exports.isIPFSAddPayload = isIPFSAddPayload;
|
|
14
|
+
exports.isIPFSPinPayload = isIPFSPinPayload;
|
|
15
|
+
exports.isIPFSUnpinPayload = isIPFSUnpinPayload;
|
|
16
|
+
exports.isIPFSPayload = isIPFSPayload;
|
|
17
|
+
// ============================================================================
|
|
18
|
+
// Type Guards
|
|
19
|
+
// ============================================================================
|
|
20
|
+
/**
|
|
21
|
+
* Check if a payload is an IPFS_ADD operation
|
|
22
|
+
*/
|
|
23
|
+
function isIPFSAddPayload(payload) {
|
|
24
|
+
return payload.operation === "IPFS_ADD";
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Check if a payload is an IPFS_PIN operation
|
|
28
|
+
*/
|
|
29
|
+
function isIPFSPinPayload(payload) {
|
|
30
|
+
return payload.operation === "IPFS_PIN";
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Check if a payload is an IPFS_UNPIN operation
|
|
34
|
+
*/
|
|
35
|
+
function isIPFSUnpinPayload(payload) {
|
|
36
|
+
return payload.operation === "IPFS_UNPIN";
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Check if any payload is an IPFS payload
|
|
40
|
+
*/
|
|
41
|
+
function isIPFSPayload(payload) {
|
|
42
|
+
if (!payload || typeof payload !== "object")
|
|
43
|
+
return false;
|
|
44
|
+
const p = payload;
|
|
45
|
+
return (p.operation === "IPFS_ADD" ||
|
|
46
|
+
p.operation === "IPFS_PIN" ||
|
|
47
|
+
p.operation === "IPFS_UNPIN");
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=IPFSTransaction.js.map
|