@meshconnect/uwc-ton-connector 0.2.2 → 0.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/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/jetton-transfer.d.ts +27 -0
- package/dist/jetton-transfer.d.ts.map +1 -0
- package/dist/jetton-transfer.js +103 -0
- package/dist/jetton-transfer.js.map +1 -0
- package/dist/namespaced-storage.d.ts +2 -7
- package/dist/namespaced-storage.d.ts.map +1 -1
- package/dist/namespaced-storage.js.map +1 -1
- package/dist/ton-connect-connector.d.ts +36 -0
- package/dist/ton-connect-connector.d.ts.map +1 -0
- package/dist/ton-connect-connector.js +249 -0
- package/dist/ton-connect-connector.js.map +1 -0
- package/dist/ton-transaction-utils.d.ts +2 -14
- package/dist/ton-transaction-utils.d.ts.map +1 -1
- package/dist/ton-transaction-utils.js.map +1 -1
- package/package.json +4 -3
- package/src/index.ts +6 -1
- package/src/jetton-transfer.test.ts +199 -0
- package/src/jetton-transfer.ts +122 -0
- package/src/namespaced-storage.ts +2 -7
- package/src/ton-connect-connector.test.ts +663 -0
- package/src/ton-connect-connector.ts +347 -0
- package/src/ton-transaction-utils.ts +3 -21
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
export { NamespacedStorage
|
|
1
|
+
export { NamespacedStorage } from './namespaced-storage';
|
|
2
2
|
export { isValidBase64 } from './validation';
|
|
3
3
|
export { buildTonTransactionRequest, buildSignDataPayload, executeSignData, unwrapBoc, bocToHash, toFriendlyAddress } from './ton-transaction-utils';
|
|
4
|
+
export { buildJettonTransferPayload, buildTonNativeRequestFromJettonTransfer } from './jetton-transfer';
|
|
5
|
+
export { TonConnectConnector } from './ton-connect-connector';
|
|
4
6
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAA;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AAC5C,OAAO,EACL,0BAA0B,EAC1B,oBAAoB,EACpB,eAAe,EACf,SAAS,EACT,SAAS,EACT,iBAAiB,EAClB,MAAM,yBAAyB,CAAA;AAChC,OAAO,EACL,0BAA0B,EAC1B,uCAAuC,EACxC,MAAM,mBAAmB,CAAA;AAC1B,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
export { NamespacedStorage } from './namespaced-storage';
|
|
2
2
|
export { isValidBase64 } from './validation';
|
|
3
3
|
export { buildTonTransactionRequest, buildSignDataPayload, executeSignData, unwrapBoc, bocToHash, toFriendlyAddress } from './ton-transaction-utils';
|
|
4
|
+
export { buildJettonTransferPayload, buildTonNativeRequestFromJettonTransfer } from './jetton-transfer';
|
|
5
|
+
export { TonConnectConnector } from './ton-connect-connector';
|
|
4
6
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAA;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AAC5C,OAAO,EACL,0BAA0B,EAC1B,oBAAoB,EACpB,eAAe,EACf,SAAS,EACT,SAAS,EACT,iBAAiB,EAClB,MAAM,yBAAyB,CAAA;AAChC,OAAO,EACL,0BAA0B,EAC1B,uCAAuC,EACxC,MAAM,mBAAmB,CAAA;AAC1B,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAA"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { TonJettonTransferParams, TonNativeTransferRequest } from '@meshconnect/uwc-types';
|
|
2
|
+
/**
|
|
3
|
+
* Build the TEP-74 Jetton transfer message body as a base64 BOC.
|
|
4
|
+
*
|
|
5
|
+
* Unlike EVM/Solana/TRON where wallets know how to encode token transfers,
|
|
6
|
+
* TON Connect wallets only accept raw messages with an optional payload.
|
|
7
|
+
* We must encode the Jetton transfer Cell (opcode, amount, destination, etc.)
|
|
8
|
+
* ourselves and pass it as the payload field.
|
|
9
|
+
*
|
|
10
|
+
* @param params - Logical jetton transfer parameters (destination, amount in base units, etc.)
|
|
11
|
+
* @returns Base64-encoded BOC of the transfer cell (use as payload in TonNativeTransferRequest)
|
|
12
|
+
*/
|
|
13
|
+
export declare function buildJettonTransferPayload(params: TonJettonTransferParams): Promise<string>;
|
|
14
|
+
/**
|
|
15
|
+
* Build a TonNativeTransferRequest for a Jetton transfer.
|
|
16
|
+
*
|
|
17
|
+
* Wraps the encoded Cell into a standard TonNativeTransferRequest. The field mapping
|
|
18
|
+
* is intentionally different from a native TON transfer:
|
|
19
|
+
* - `to` = sender's Jetton wallet contract (not the recipient — the recipient is inside the Cell)
|
|
20
|
+
* - `amount` = gas in nanotons (not the token amount — that's also inside the Cell)
|
|
21
|
+
* - `payload` = the TEP-74 Cell built by buildJettonTransferPayload
|
|
22
|
+
*
|
|
23
|
+
* The caller must resolve the sender's Jetton wallet address (e.g. via get_wallet_address
|
|
24
|
+
* on the Jetton master, or computed locally from the wallet code + owner address).
|
|
25
|
+
*/
|
|
26
|
+
export declare function buildTonNativeRequestFromJettonTransfer(params: TonJettonTransferParams, senderJettonWalletAddress: string, fromAddress: string, gasNanotons: string): Promise<TonNativeTransferRequest>;
|
|
27
|
+
//# sourceMappingURL=jetton-transfer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jetton-transfer.d.ts","sourceRoot":"","sources":["../src/jetton-transfer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,uBAAuB,EACvB,wBAAwB,EACzB,MAAM,wBAAwB,CAAA;AAgB/B;;;;;;;;;;GAUG;AACH,wBAAsB,0BAA0B,CAC9C,MAAM,EAAE,uBAAuB,GAC9B,OAAO,CAAC,MAAM,CAAC,CA8DjB;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,uCAAuC,CAC3D,MAAM,EAAE,uBAAuB,EAC/B,yBAAyB,EAAE,MAAM,EACjC,WAAW,EAAE,MAAM,EACnB,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC,wBAAwB,CAAC,CAQnC"}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TEP-74 Jetton transfer op code. Identifies the message as a token transfer.
|
|
3
|
+
* This is a protocol-level constant defined in the standard — all Jetton contracts
|
|
4
|
+
* use this same value, so it's safe to hardcode.
|
|
5
|
+
* @see https://github.com/ton-blockchain/TEPs/blob/master/text/0074-jettons-standard.md
|
|
6
|
+
*/
|
|
7
|
+
const JETTON_TRANSFER_OP = 0x0f8a7ea5;
|
|
8
|
+
/** TEP-74 forward_payload comment op code (0 = text comment). */
|
|
9
|
+
const FORWARD_PAYLOAD_OP_COMMENT = 0;
|
|
10
|
+
/** Max value for a 64-bit unsigned integer (TEP-74 query_id). */
|
|
11
|
+
const MAX_UINT64 = 18446744073709551615n;
|
|
12
|
+
/**
|
|
13
|
+
* Build the TEP-74 Jetton transfer message body as a base64 BOC.
|
|
14
|
+
*
|
|
15
|
+
* Unlike EVM/Solana/TRON where wallets know how to encode token transfers,
|
|
16
|
+
* TON Connect wallets only accept raw messages with an optional payload.
|
|
17
|
+
* We must encode the Jetton transfer Cell (opcode, amount, destination, etc.)
|
|
18
|
+
* ourselves and pass it as the payload field.
|
|
19
|
+
*
|
|
20
|
+
* @param params - Logical jetton transfer parameters (destination, amount in base units, etc.)
|
|
21
|
+
* @returns Base64-encoded BOC of the transfer cell (use as payload in TonNativeTransferRequest)
|
|
22
|
+
*/
|
|
23
|
+
export async function buildJettonTransferPayload(params) {
|
|
24
|
+
const { beginCell, Address } = await import('@ton/core');
|
|
25
|
+
let queryId;
|
|
26
|
+
try {
|
|
27
|
+
queryId = BigInt(params.queryId ?? '0');
|
|
28
|
+
}
|
|
29
|
+
catch {
|
|
30
|
+
throw new Error('queryId must be a valid integer string');
|
|
31
|
+
}
|
|
32
|
+
if (queryId < 0n || queryId > MAX_UINT64) {
|
|
33
|
+
throw new Error(`queryId must be a uint64 (0 to ${MAX_UINT64})`);
|
|
34
|
+
}
|
|
35
|
+
let amount;
|
|
36
|
+
try {
|
|
37
|
+
amount = BigInt(params.amount);
|
|
38
|
+
}
|
|
39
|
+
catch {
|
|
40
|
+
throw new Error('amount must be a valid integer string');
|
|
41
|
+
}
|
|
42
|
+
if (amount < 0n) {
|
|
43
|
+
throw new Error('Jetton transfer amount must be non-negative');
|
|
44
|
+
}
|
|
45
|
+
const destination = Address.parse(params.destination);
|
|
46
|
+
const responseDestination = Address.parse(params.responseDestination);
|
|
47
|
+
let forwardTonAmount;
|
|
48
|
+
try {
|
|
49
|
+
forwardTonAmount = BigInt(params.forwardTonAmount ?? '0');
|
|
50
|
+
}
|
|
51
|
+
catch {
|
|
52
|
+
throw new Error('forwardTonAmount must be a valid integer string');
|
|
53
|
+
}
|
|
54
|
+
if (forwardTonAmount < 0n) {
|
|
55
|
+
throw new Error('forwardTonAmount must be non-negative');
|
|
56
|
+
}
|
|
57
|
+
const hasForwardComment = params.forwardComment != null &&
|
|
58
|
+
params.forwardComment.length > 0 &&
|
|
59
|
+
forwardTonAmount > 0n;
|
|
60
|
+
const body = beginCell()
|
|
61
|
+
.storeUint(JETTON_TRANSFER_OP, 32)
|
|
62
|
+
.storeUint(queryId, 64)
|
|
63
|
+
.storeCoins(amount)
|
|
64
|
+
.storeAddress(destination)
|
|
65
|
+
.storeAddress(responseDestination)
|
|
66
|
+
.storeBit(0) // no custom_payload
|
|
67
|
+
.storeCoins(forwardTonAmount);
|
|
68
|
+
if (hasForwardComment) {
|
|
69
|
+
const forwardPayload = beginCell()
|
|
70
|
+
.storeUint(FORWARD_PAYLOAD_OP_COMMENT, 32)
|
|
71
|
+
.storeStringTail(params.forwardComment)
|
|
72
|
+
.endCell();
|
|
73
|
+
body.storeBit(1);
|
|
74
|
+
body.storeRef(forwardPayload);
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
body.storeBit(0);
|
|
78
|
+
}
|
|
79
|
+
const cell = body.endCell();
|
|
80
|
+
return cell.toBoc().toString('base64');
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Build a TonNativeTransferRequest for a Jetton transfer.
|
|
84
|
+
*
|
|
85
|
+
* Wraps the encoded Cell into a standard TonNativeTransferRequest. The field mapping
|
|
86
|
+
* is intentionally different from a native TON transfer:
|
|
87
|
+
* - `to` = sender's Jetton wallet contract (not the recipient — the recipient is inside the Cell)
|
|
88
|
+
* - `amount` = gas in nanotons (not the token amount — that's also inside the Cell)
|
|
89
|
+
* - `payload` = the TEP-74 Cell built by buildJettonTransferPayload
|
|
90
|
+
*
|
|
91
|
+
* The caller must resolve the sender's Jetton wallet address (e.g. via get_wallet_address
|
|
92
|
+
* on the Jetton master, or computed locally from the wallet code + owner address).
|
|
93
|
+
*/
|
|
94
|
+
export async function buildTonNativeRequestFromJettonTransfer(params, senderJettonWalletAddress, fromAddress, gasNanotons) {
|
|
95
|
+
const payload = await buildJettonTransferPayload(params);
|
|
96
|
+
return {
|
|
97
|
+
to: senderJettonWalletAddress,
|
|
98
|
+
amount: gasNanotons,
|
|
99
|
+
from: fromAddress,
|
|
100
|
+
payload
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
//# sourceMappingURL=jetton-transfer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jetton-transfer.js","sourceRoot":"","sources":["../src/jetton-transfer.ts"],"names":[],"mappings":"AAKA;;;;;GAKG;AACH,MAAM,kBAAkB,GAAG,UAAU,CAAA;AAErC,iEAAiE;AACjE,MAAM,0BAA0B,GAAG,CAAC,CAAA;AAEpC,iEAAiE;AACjE,MAAM,UAAU,GAAG,qBAAqB,CAAA;AAExC;;;;;;;;;;GAUG;AACH,MAAM,CAAC,KAAK,UAAU,0BAA0B,CAC9C,MAA+B;IAE/B,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,GAAG,MAAM,MAAM,CAAC,WAAW,CAAC,CAAA;IAExD,IAAI,OAAe,CAAA;IACnB,IAAI,CAAC;QACH,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,OAAO,IAAI,GAAG,CAAC,CAAA;IACzC,CAAC;IAAC,MAAM,CAAC;QACP,MAAM,IAAI,KAAK,CAAC,wCAAwC,CAAC,CAAA;IAC3D,CAAC;IACD,IAAI,OAAO,GAAG,EAAE,IAAI,OAAO,GAAG,UAAU,EAAE,CAAC;QACzC,MAAM,IAAI,KAAK,CAAC,kCAAkC,UAAU,GAAG,CAAC,CAAA;IAClE,CAAC;IAED,IAAI,MAAc,CAAA;IAClB,IAAI,CAAC;QACH,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAA;IAChC,CAAC;IAAC,MAAM,CAAC;QACP,MAAM,IAAI,KAAK,CAAC,uCAAuC,CAAC,CAAA;IAC1D,CAAC;IACD,IAAI,MAAM,GAAG,EAAE,EAAE,CAAC;QAChB,MAAM,IAAI,KAAK,CAAC,6CAA6C,CAAC,CAAA;IAChE,CAAC;IAED,MAAM,WAAW,GAAG,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,WAAW,CAAC,CAAA;IACrD,MAAM,mBAAmB,GAAG,OAAO,CAAC,K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AAO,IAAI,CAAC,KAAK,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAA;AACxC,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,KAAK,UAAU,uCAAuC,CAC3D,MAA+B,EAC/B,yBAAiC,EACjC,WAAmB,EACnB,WAAmB;IAEnB,MAAM,OAAO,GAAG,MAAM,0BAA0B,CAAC,MAAM,CAAC,CAAA;IACxD,OAAO;QACL,EAAE,EAAE,yBAAyB;QAC7B,MAAM,EAAE,WAAW;QACnB,IAAI,EAAE,WAAW;QACjB,OAAO;KACR,CAAA;AACH,CAAC"}
|
|
@@ -1,16 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
export interface TonConnectStorage {
|
|
3
|
-
setItem(key: string, value: string): Promise<void>;
|
|
4
|
-
getItem(key: string): Promise<string | null>;
|
|
5
|
-
removeItem(key: string): Promise<void>;
|
|
6
|
-
}
|
|
1
|
+
import type { IStorage } from '@tonconnect/sdk';
|
|
7
2
|
/**
|
|
8
3
|
* Prefixed localStorage wrapper required by @tonconnect/sdk.
|
|
9
4
|
* The SDK requires the dApp to provide storage for persisting connection state across reloads.
|
|
10
5
|
* Keys are prefixed per wallet (e.g. "tonkeeper:session") to avoid collisions.
|
|
11
6
|
* Falls back to in-memory Map when localStorage is blocked (Safari ITP in iframes).
|
|
12
7
|
*/
|
|
13
|
-
export declare class NamespacedStorage implements
|
|
8
|
+
export declare class NamespacedStorage implements IStorage {
|
|
14
9
|
private prefix;
|
|
15
10
|
private memoryFallback;
|
|
16
11
|
constructor(prefix: string);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"namespaced-storage.d.ts","sourceRoot":"","sources":["../src/namespaced-storage.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"namespaced-storage.d.ts","sourceRoot":"","sources":["../src/namespaced-storage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAA;AAE/C;;;;;GAKG;AACH,qBAAa,iBAAkB,YAAW,QAAQ;IAGpC,OAAO,CAAC,MAAM;IAF1B,OAAO,CAAC,cAAc,CAA4B;gBAE9B,MAAM,EAAE,MAAM;IAE5B,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAYlD,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAW5C,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAY5C,OAAO,CAAC,QAAQ;CAGjB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"namespaced-storage.js","sourceRoot":"","sources":["../src/namespaced-storage.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"namespaced-storage.js","sourceRoot":"","sources":["../src/namespaced-storage.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,MAAM,OAAO,iBAAiB;IAGR;IAFZ,cAAc,GAAG,IAAI,GAAG,EAAkB,CAAA;IAElD,YAAoB,MAAc;QAAd,WAAM,GAAN,MAAM,CAAQ;IAAG,CAAC;IAEtC,KAAK,CAAC,OAAO,CAAC,GAAW,EAAE,KAAa;QACtC,IAAI,OAAO,YAAY,KAAK,WAAW,EAAE,CAAC;YACxC,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,KAAK,CAAC,CAAA;YAClD,OAAM;QACR,CAAC;QACD,IAAI,CAAC;YACH,YAAY,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,KAAK,CAAC,CAAA;QACjD,CAAC;QAAC,MAAM,CAAC;YACP,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,KAAK,CAAC,CAAA;QACpD,CAAC;IACH,CAAC;IAED,KAAK,CAAC,OAAO,CAAC,GAAW;QACvB,IAAI,OAAO,YAAY,KAAK,WAAW,EAAE,CAAC;YACxC,OAAO,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,IAAI,IAAI,CAAA;QAC5D,CAAC;QACD,IAAI,CAAC;YACH,OAAO,YAAY,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAA;QACjD,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,IAAI,IAAI,CAAA;QAC5D,CAAC;IACH,CAAC;IAED,KAAK,CAAC,UAAU,CAAC,GAAW;QAC1B,IAAI,OAAO,YAAY,KAAK,WAAW,EAAE,CAAC;YACxC,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAA;YAC9C,OAAM;QACR,CAAC;QACD,IAAI,CAAC;YACH,YAAY,CAAC,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAA;QAC7C,CAAC;QAAC,MAAM,CAAC;YACP,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAA;QAChD,CAAC;IACH,CAAC;IAEO,QAAQ,CAAC,GAAW;QAC1B,OAAO,GAAG,IAAI,CAAC,MAAM,IAAI,GAAG,EAAE,CAAA;IAChC,CAAC;CACF"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { Network, Connector, ConnectorResult, SwitchNetworkResult, TonConnectConfig, TonConnectWalletProvider, TransactionRequest, TransactionResult, SignatureType } from '@meshconnect/uwc-types';
|
|
2
|
+
export declare class TonConnectConnector implements Connector {
|
|
3
|
+
private config;
|
|
4
|
+
private sdk;
|
|
5
|
+
private connectionURI;
|
|
6
|
+
private connectedAddress;
|
|
7
|
+
private connectedNetworkId;
|
|
8
|
+
private visibilityHandler;
|
|
9
|
+
private connectTimeout;
|
|
10
|
+
private toUserFriendlyAddressFn;
|
|
11
|
+
private UserRejectsErrorClass;
|
|
12
|
+
private connectInFlight;
|
|
13
|
+
constructor(config: TonConnectConfig);
|
|
14
|
+
/** Connect to a TON wallet via HTTP Bridge (QR code / deeplink). */
|
|
15
|
+
connect(network: Network, provider?: TonConnectWalletProvider): Promise<ConnectorResult>;
|
|
16
|
+
/** Return the connection URI generated by the last connect() call. */
|
|
17
|
+
getConnectionURI(): string;
|
|
18
|
+
/** Sign a message using TON Connect signData. */
|
|
19
|
+
signMessage(message: string): Promise<SignatureType>;
|
|
20
|
+
/** Send a TON transaction via the connected wallet. */
|
|
21
|
+
sendTransaction(request: TransactionRequest): Promise<TransactionResult>;
|
|
22
|
+
/** TON is single-chain — switchNetwork returns the current state. */
|
|
23
|
+
switchNetwork(network: Network): Promise<SwitchNetworkResult>;
|
|
24
|
+
/** Disconnect from the wallet and clean up resources. */
|
|
25
|
+
disconnect(): Promise<void>;
|
|
26
|
+
/** Tear down SDK, event listeners, and pending timeouts. */
|
|
27
|
+
destroy(): Promise<void>;
|
|
28
|
+
private waitForWalletApproval;
|
|
29
|
+
private extractSdkErrorMessage;
|
|
30
|
+
private cleanupSdk;
|
|
31
|
+
private setupVisibilityHandler;
|
|
32
|
+
private removeVisibilityHandler;
|
|
33
|
+
private clearConnectTimeout;
|
|
34
|
+
private buildAvailableAddresses;
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=ton-connect-connector.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ton-connect-connector.d.ts","sourceRoot":"","sources":["../src/ton-connect-connector.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,OAAO,EACP,SAAS,EACT,eAAe,EACf,mBAAmB,EACnB,gBAAgB,EAChB,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namespaced-storage';
|
|
2
|
+
import { buildTonTransactionRequest, buildSignDataPayload, executeSignData, unwrapBoc, bocToHash, toFriendlyAddress } from './ton-transaction-utils';
|
|
3
|
+
// 5 minutes matches WalletConnect's proposal expiry. The TonConnect protocol
|
|
4
|
+
// has no built-in timeout — without this, a pending connect hangs indefinitely.
|
|
5
|
+
const CONNECT_TIMEOUT_MS = 5 * 60 * 1000;
|
|
6
|
+
export class TonConnectConnector {
|
|
7
|
+
config;
|
|
8
|
+
sdk = null;
|
|
9
|
+
connectionURI;
|
|
10
|
+
connectedAddress = null;
|
|
11
|
+
connectedNetworkId = null;
|
|
12
|
+
visibilityHandler = null;
|
|
13
|
+
connectTimeout = null;
|
|
14
|
+
toUserFriendlyAddressFn = null;
|
|
15
|
+
UserRejectsErrorClass = null;
|
|
16
|
+
connectInFlight = false;
|
|
17
|
+
constructor(config) {
|
|
18
|
+
this.config = config;
|
|
19
|
+
}
|
|
20
|
+
/** Connect to a TON wallet via HTTP Bridge (QR code / deeplink). */
|
|
21
|
+
async connect(network, provider) {
|
|
22
|
+
if (!provider) {
|
|
23
|
+
throw new Error('TonConnectWalletProvider is required for TON Connect connection');
|
|
24
|
+
}
|
|
25
|
+
if (!provider.walletListAppName) {
|
|
26
|
+
throw new Error('walletListAppName is required — set it on TonConnectWalletProvider, or ensure the wallet has a jsBridgeKey in extensionInjectedProvider.tvm');
|
|
27
|
+
}
|
|
28
|
+
if (this.connectInFlight) {
|
|
29
|
+
throw new Error('TON Connect connection already in progress');
|
|
30
|
+
}
|
|
31
|
+
this.connectInFlight = true;
|
|
32
|
+
if (this.sdk) {
|
|
33
|
+
await this.cleanupSdk(this.sdk);
|
|
34
|
+
}
|
|
35
|
+
try {
|
|
36
|
+
const { TonConnect, toUserFriendlyAddress, UserRejectsError } = await import('@tonconnect/sdk');
|
|
37
|
+
this.toUserFriendlyAddressFn = toUserFriendlyAddress;
|
|
38
|
+
this.UserRejectsErrorClass = UserRejectsError;
|
|
39
|
+
const sdkOptions = {
|
|
40
|
+
storage: new NamespacedStorage('uwc-ton-remote'),
|
|
41
|
+
manifestUrl: this.config.manifestUrl
|
|
42
|
+
};
|
|
43
|
+
if (this.config.walletsListSource) {
|
|
44
|
+
sdkOptions.walletsListSource = this.config.walletsListSource;
|
|
45
|
+
}
|
|
46
|
+
this.sdk = new TonConnect(sdkOptions);
|
|
47
|
+
// ONC-2717: The SDK supports restoreConnection() to resume a previous
|
|
48
|
+
// session from NamespacedStorage without a new QR scan. Currently we
|
|
49
|
+
// always start fresh (disconnect stale sessions below). Adding session
|
|
50
|
+
// resumption would let users stay connected across page reloads —
|
|
51
|
+
// call sdk.restoreConnection() here and skip the QR flow if it succeeds.
|
|
52
|
+
if (this.sdk.connected) {
|
|
53
|
+
// Can't reuse: the SDK binds one provider (JS or HTTP bridge) per instance.
|
|
54
|
+
// A stale HTTP session from a previous wallet would corrupt the new one.
|
|
55
|
+
try {
|
|
56
|
+
await this.sdk.disconnect();
|
|
57
|
+
}
|
|
58
|
+
catch {
|
|
59
|
+
/* best effort — clear stale session from NamespacedStorage */
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
const sdkRef = this.sdk;
|
|
63
|
+
// Resolve bridge URLs from the SDK's wallet list (built-in or custom walletsListSource)
|
|
64
|
+
const wallets = await sdkRef.getWallets();
|
|
65
|
+
const remoteWallets = wallets.filter((w) => 'bridgeUrl' in w && 'universalLink' in w);
|
|
66
|
+
const walletInfo = remoteWallets.find(w => w.appName === provider.walletListAppName);
|
|
67
|
+
if (!walletInfo) {
|
|
68
|
+
throw new Error(`Wallet '${provider.walletListAppName}' not found in TonConnect wallet list, or missing bridge/universalLink`);
|
|
69
|
+
}
|
|
70
|
+
const address = await this.waitForWalletApproval(sdkRef, walletInfo.universalLink, walletInfo.bridgeUrl);
|
|
71
|
+
this.connectionURI = undefined; // URI consumed — clear before notify fires
|
|
72
|
+
const friendlyAddress = this.toUserFriendlyAddressFn
|
|
73
|
+
? toFriendlyAddress(address, this.toUserFriendlyAddressFn)
|
|
74
|
+
: address;
|
|
75
|
+
this.connectedAddress = friendlyAddress;
|
|
76
|
+
this.connectedNetworkId = network.id;
|
|
77
|
+
this.setupVisibilityHandler(sdkRef);
|
|
78
|
+
const availableAddresses = this.buildAvailableAddresses(provider.supportedNetworkIds, friendlyAddress);
|
|
79
|
+
return {
|
|
80
|
+
networkId: network.id,
|
|
81
|
+
address: friendlyAddress,
|
|
82
|
+
availableAddresses
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
finally {
|
|
86
|
+
this.connectInFlight = false;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
/** Return the connection URI generated by the last connect() call. */
|
|
90
|
+
getConnectionURI() {
|
|
91
|
+
if (!this.connectionURI) {
|
|
92
|
+
throw new Error('No connection URI available. Call connect() first.');
|
|
93
|
+
}
|
|
94
|
+
return this.connectionURI;
|
|
95
|
+
}
|
|
96
|
+
/** Sign a message using TON Connect signData. */
|
|
97
|
+
async signMessage(message) {
|
|
98
|
+
if (!this.sdk) {
|
|
99
|
+
throw new Error('No active TON connection');
|
|
100
|
+
}
|
|
101
|
+
const payload = buildSignDataPayload(message);
|
|
102
|
+
return executeSignData(this.sdk, payload);
|
|
103
|
+
}
|
|
104
|
+
/** Send a TON transaction via the connected wallet. */
|
|
105
|
+
async sendTransaction(request) {
|
|
106
|
+
if (!this.sdk) {
|
|
107
|
+
throw new Error('No active TON connection');
|
|
108
|
+
}
|
|
109
|
+
const tonRequest = request;
|
|
110
|
+
const senderRawAddress = this.sdk.account?.address;
|
|
111
|
+
const txRequest = buildTonTransactionRequest(tonRequest, senderRawAddress);
|
|
112
|
+
try {
|
|
113
|
+
const result = await this.sdk.sendTransaction(txRequest);
|
|
114
|
+
const boc = unwrapBoc(result);
|
|
115
|
+
return bocToHash(boc);
|
|
116
|
+
}
|
|
117
|
+
catch (error) {
|
|
118
|
+
if (this.UserRejectsErrorClass &&
|
|
119
|
+
error instanceof this.UserRejectsErrorClass) {
|
|
120
|
+
throw new Error('Transaction was rejected by the user');
|
|
121
|
+
}
|
|
122
|
+
throw error;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
/** TON is single-chain — switchNetwork returns the current state. */
|
|
126
|
+
async switchNetwork(network) {
|
|
127
|
+
return {
|
|
128
|
+
networkId: this.connectedNetworkId ?? network.id,
|
|
129
|
+
address: this.connectedAddress ?? ''
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
/** Disconnect from the wallet and clean up resources. */
|
|
133
|
+
async disconnect() {
|
|
134
|
+
if (this.sdk) {
|
|
135
|
+
try {
|
|
136
|
+
await this.sdk.disconnect();
|
|
137
|
+
}
|
|
138
|
+
catch {
|
|
139
|
+
/* best effort */
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
this.sdk = null;
|
|
143
|
+
this.connectedAddress = null;
|
|
144
|
+
this.connectedNetworkId = null;
|
|
145
|
+
this.connectionURI = undefined;
|
|
146
|
+
this.connectInFlight = false;
|
|
147
|
+
this.clearConnectTimeout();
|
|
148
|
+
this.removeVisibilityHandler();
|
|
149
|
+
}
|
|
150
|
+
/** Tear down SDK, event listeners, and pending timeouts. */
|
|
151
|
+
async destroy() {
|
|
152
|
+
await this.disconnect();
|
|
153
|
+
}
|
|
154
|
+
async waitForWalletApproval(sdk, universalLink, bridgeUrl) {
|
|
155
|
+
return new Promise((resolve, reject) => {
|
|
156
|
+
let settled = false;
|
|
157
|
+
let unsubscribe;
|
|
158
|
+
const cleanup = () => {
|
|
159
|
+
this.clearConnectTimeout();
|
|
160
|
+
unsubscribe();
|
|
161
|
+
this.connectionURI = undefined;
|
|
162
|
+
this.cleanupSdk(sdk);
|
|
163
|
+
};
|
|
164
|
+
this.connectTimeout = setTimeout(() => {
|
|
165
|
+
if (settled)
|
|
166
|
+
return;
|
|
167
|
+
settled = true;
|
|
168
|
+
cleanup();
|
|
169
|
+
reject(new Error('TON wallet connection timed out'));
|
|
170
|
+
}, CONNECT_TIMEOUT_MS);
|
|
171
|
+
unsubscribe = sdk.onStatusChange(wallet => {
|
|
172
|
+
if (settled)
|
|
173
|
+
return;
|
|
174
|
+
settled = true;
|
|
175
|
+
if (wallet?.account?.address) {
|
|
176
|
+
this.clearConnectTimeout();
|
|
177
|
+
unsubscribe();
|
|
178
|
+
resolve(wallet.account.address);
|
|
179
|
+
}
|
|
180
|
+
else {
|
|
181
|
+
cleanup();
|
|
182
|
+
reject(new Error('TON wallet connection was rejected'));
|
|
183
|
+
}
|
|
184
|
+
}, error => {
|
|
185
|
+
if (settled)
|
|
186
|
+
return;
|
|
187
|
+
settled = true;
|
|
188
|
+
const errorObj = error;
|
|
189
|
+
const message = errorObj?.payload?.message ||
|
|
190
|
+
this.extractSdkErrorMessage(error) ||
|
|
191
|
+
'TON wallet connection was rejected';
|
|
192
|
+
cleanup();
|
|
193
|
+
reject(new Error(message));
|
|
194
|
+
});
|
|
195
|
+
this.connectionURI = sdk.connect({ universalLink, bridgeUrl });
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
extractSdkErrorMessage(error) {
|
|
199
|
+
if (error && typeof error === 'object' && 'message' in error) {
|
|
200
|
+
const msg = error.message;
|
|
201
|
+
const lines = msg.split('\n');
|
|
202
|
+
if (lines.length > 1) {
|
|
203
|
+
return lines[lines.length - 1];
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
return undefined;
|
|
207
|
+
}
|
|
208
|
+
async cleanupSdk(sdk) {
|
|
209
|
+
try {
|
|
210
|
+
await sdk.disconnect();
|
|
211
|
+
}
|
|
212
|
+
catch {
|
|
213
|
+
/* best effort */
|
|
214
|
+
}
|
|
215
|
+
if (this.sdk === sdk) {
|
|
216
|
+
this.sdk = null;
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
setupVisibilityHandler(sdk) {
|
|
220
|
+
this.removeVisibilityHandler();
|
|
221
|
+
this.visibilityHandler = () => {
|
|
222
|
+
if (document.visibilityState === 'visible') {
|
|
223
|
+
sdk.unPauseConnection();
|
|
224
|
+
}
|
|
225
|
+
else {
|
|
226
|
+
sdk.pauseConnection();
|
|
227
|
+
}
|
|
228
|
+
};
|
|
229
|
+
document.addEventListener('visibilitychange', this.visibilityHandler);
|
|
230
|
+
}
|
|
231
|
+
removeVisibilityHandler() {
|
|
232
|
+
if (this.visibilityHandler) {
|
|
233
|
+
document.removeEventListener('visibilitychange', this.visibilityHandler);
|
|
234
|
+
this.visibilityHandler = null;
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
clearConnectTimeout() {
|
|
238
|
+
if (this.connectTimeout) {
|
|
239
|
+
clearTimeout(this.connectTimeout);
|
|
240
|
+
this.connectTimeout = null;
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
buildAvailableAddresses(supportedNetworkIds, address) {
|
|
244
|
+
return supportedNetworkIds
|
|
245
|
+
.filter(id => id.startsWith('tvm:'))
|
|
246
|
+
.map(networkId => ({ address, networkId: networkId }));
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
//# sourceMappingURL=ton-connect-connector.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ton-connect-connector.js","sourceRoot":"","sources":["../src/ton-connect-connector.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAA;AACxD,OAAO,EACL,0BAA0B,EAC1B,oBAAoB,EACpB,eAAe,EACf,SAAS,EACT,SAAS,EACT,iBAAiB,EAClB,MAAM,yBAAyB,CAAA;AAEhC,6EAA6E;AAC7E,gFAAgF;AAChF,MAAM,kBAAkB,GAAG,CAAC,GAAG,EAAE,GAAG,IAAI,CAAA;AASxC,MAAM,OAAO,mBAAmB;IACtB,MAAM,CAAkB;IACxB,GAAG,GAAuB,IAAI,CAAA;IAC9B,aAAa,CAAoB;IACjC,gBAAgB,GAAkB,IAAI,CAAA;IACtC,kBAAkB,GAAqB,IAAI,CAAA;IAC3C,iBAAiB,GAAwB,IAAI,CAAA;I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E,CAAC;gBAC3C,GAAG,CAAC,iBAAiB,EAAE,CAAA;YACzB,CAAC;iBAAM,CAAC;gBACN,GAAG,CAAC,eAAe,EAAE,CAAA;YACvB,CAAC;QACH,CAAC,CAAA;QACD,QAAQ,CAAC,gBAAgB,CAAC,kBAAkB,EAAE,IAAI,CAAC,iBAAiB,CAAC,CAAA;IACvE,CAAC;IAEO,uBAAuB;QAC7B,IAAI,IAAI,CAAC,iBAAiB,EAAE,CAAC;YAC3B,QAAQ,CAAC,mBAAmB,CAAC,kBAAkB,EAAE,IAAI,CAAC,iBAAiB,CAAC,CAAA;YACxE,IAAI,CAAC,iBAAiB,GAAG,IAAI,CAAA;QAC/B,CAAC;IACH,CAAC;IAEO,mBAAmB;QACzB,IAAI,IAAI,CAAC,cAAc,EAAE,CAAC;YACxB,YAAY,CAAC,IAAI,CAAC,cAAc,CAAC,CAAA;YACjC,IAAI,CAAC,cAAc,GAAG,IAAI,CAAA;QAC5B,CAAC;IACH,CAAC;IAEO,uBAAuB,CAC7B,mBAA6B,EAC7B,OAAe;QAEf,OAAO,mBAAmB;aACvB,MAAM,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;aACnC,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,SAAS,EAAE,SAAsB,EAAE,CAAC,CAAC,CAAA;IACvE,CAAC;CACF"}
|
|
@@ -1,16 +1,5 @@
|
|
|
1
1
|
import type { TonNativeTransferRequest, TonSignDataPayload, SignatureType } from '@meshconnect/uwc-types';
|
|
2
|
-
|
|
3
|
-
interface TonConnectTransactionRequest {
|
|
4
|
-
validUntil: number;
|
|
5
|
-
network?: string;
|
|
6
|
-
from?: string;
|
|
7
|
-
messages: {
|
|
8
|
-
address: string;
|
|
9
|
-
amount: string;
|
|
10
|
-
stateInit?: string;
|
|
11
|
-
payload?: string;
|
|
12
|
-
}[];
|
|
13
|
-
}
|
|
2
|
+
import type { SendTransactionRequest } from '@tonconnect/sdk';
|
|
14
3
|
/**
|
|
15
4
|
* Convert raw TON address to user-friendly format.
|
|
16
5
|
* TON has two formats:
|
|
@@ -42,7 +31,7 @@ export declare function buildTonTransactionMessage(request: TonNativeTransferReq
|
|
|
42
31
|
* `sendMode` — bit flags for message handling (e.g. 128 = send entire balance).
|
|
43
32
|
* See: https://docs.ton.org/v3/documentation/smart-contracts/message-management/message-modes-cookbook
|
|
44
33
|
*/
|
|
45
|
-
export declare function buildTonTransactionRequest(request: TonNativeTransferRequest, senderRawAddress?: string):
|
|
34
|
+
export declare function buildTonTransactionRequest(request: TonNativeTransferRequest, senderRawAddress?: string): SendTransactionRequest & {
|
|
46
35
|
sendMode?: number;
|
|
47
36
|
};
|
|
48
37
|
export declare function buildSignDataPayload(message: string, override?: TonSignDataPayload): TonSignDataPayload;
|
|
@@ -73,5 +62,4 @@ export declare function unwrapBoc(result: string | {
|
|
|
73
62
|
* Subsequent calls: <0.1ms (module cached by runtime).
|
|
74
63
|
*/
|
|
75
64
|
export declare function bocToHash(boc: string): Promise<string>;
|
|
76
|
-
export {};
|
|
77
65
|
//# sourceMappingURL=ton-transaction-utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ton-transaction-utils.d.ts","sourceRoot":"","sources":["../src/ton-transaction-utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,wBAAwB,EACxB,kBAAkB,EAClB,aAAa,EACd,MAAM,wBAAwB,CAAA;
|
|
1
|
+
{"version":3,"file":"ton-transaction-utils.d.ts","sourceRoot":"","sources":["../src/ton-transaction-utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,wBAAwB,EACxB,kBAAkB,EAClB,aAAa,EACd,MAAM,wBAAwB,CAAA;AAC/B,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAA;AAO7D;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAC/B,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,CAAC,mBAAmB,EAAE,MAAM,KAAK,MAAM,GACjD,MAAM,CAKR;AAED;;;;;;;GAOG;AACH,wBAAgB,0BAA0B,CAAC,OAAO,EAAE,wBAAwB;;;;;EAkB3E;AAED;;;;;;;;;GASG;AACH,wBAAgB,0BAA0B,CACxC,OAAO,EAAE,wBAAwB,EACjC,gBAAgB,CAAC,EAAE,MAAM,GACxB,sBAAsB,GAAG;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE,CAahD;AAED,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,MAAM,EACf,QAAQ,CAAC,EAAE,kBAAkB,GAC5B,kBAAkB,CAEpB;AAED;;;GAGG;AACH,wBAAsB,eAAe,CACnC,GAAG,EAAE;IACH,QAAQ,CAAC,EAAE,CACT,OAAO,EAAE,kBAAkB,KACxB,OAAO,CAAC;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CACvE,EACD,OAAO,EAAE,kBAAkB,GAC1B,OAAO,CAAC,aAAa,CAAC,CA4BxB;AAED;;;;GAIG;AACH,wBAAgB,SAAS,CACvB,MAAM,EAAE,MAAM,GAAG;IAAE,GAAG,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,GAAG,SAAS,GAClD,MAAM,CASR;AAED;;;;;;GAMG;AACH,wBAAsB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAI5D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ton-transaction-utils.js","sourceRoot":"","sources":["../src/ton-transaction-utils.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ton-transaction-utils.js","sourceRoot":"","sources":["../src/ton-transaction-utils.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAA;AACjE,OAAO,EAA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,MAAM,EAAE,MAAM,CAAC,MAAM;QACrB,OAAO;KACR,CAAA;AACH,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,SAAS,CACvB,MAAmD;IAEnD,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAA;IAC7D,CAAC;IACD,MAAM,GAAG,GAAG,OAAO,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAA;IAC5D,IAAI,CAAC,GAAG,EAAE,CAAC;QACT,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAA;IACjD,CAAC;IACD,OAAO,GAAG,CAAA;AACZ,CAAC;AAED;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,SAAS,CAAC,GAAW;IACzC,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,MAAM,CAAC,WAAW,CAAC,CAAA;IAC1C,MAAM,IAAI,GAAG,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAA;IACjC,OAAO,IAAI,CAAC,IAAI,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAA;AACpC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@meshconnect/uwc-ton-connector",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "TON Connect connector for Universal Wallet Connector — mobile QR/URI wallet connections",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -17,8 +17,9 @@
|
|
|
17
17
|
],
|
|
18
18
|
"dependencies": {
|
|
19
19
|
"@ton/core": "^0.63.1",
|
|
20
|
-
"@
|
|
21
|
-
"@meshconnect/uwc-
|
|
20
|
+
"@tonconnect/sdk": "^3.0.5",
|
|
21
|
+
"@meshconnect/uwc-constants": "0.5.4",
|
|
22
|
+
"@meshconnect/uwc-types": "0.10.0"
|
|
22
23
|
},
|
|
23
24
|
"devDependencies": {
|
|
24
25
|
"typescript": "^5.9.3"
|
package/src/index.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { NamespacedStorage
|
|
1
|
+
export { NamespacedStorage } from './namespaced-storage'
|
|
2
2
|
export { isValidBase64 } from './validation'
|
|
3
3
|
export {
|
|
4
4
|
buildTonTransactionRequest,
|
|
@@ -8,3 +8,8 @@ export {
|
|
|
8
8
|
bocToHash,
|
|
9
9
|
toFriendlyAddress
|
|
10
10
|
} from './ton-transaction-utils'
|
|
11
|
+
export {
|
|
12
|
+
buildJettonTransferPayload,
|
|
13
|
+
buildTonNativeRequestFromJettonTransfer
|
|
14
|
+
} from './jetton-transfer'
|
|
15
|
+
export { TonConnectConnector } from './ton-connect-connector'
|