@rango-dev/signer-ton 0.29.0 → 0.30.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.js +1 -1
- package/dist/index.js.map +3 -3
- package/dist/signer.d.ts +9 -1
- package/dist/signer.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/signer.ts +28 -14
- package/CHANGELOG.md +0 -111
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var
|
|
1
|
+
var d=Object.defineProperty;var T=(r,n)=>d(r,"name",{value:n,configurable:!0});import{Address as p,Cell as h}from"@ton/core";import{SignerError as u,TonChainID as f}from"rango-types";var e=class r{constructor(n){this.provider=n;this.provider=n}static{T(this,"DefaultTonSigner")}static buildTx(n){let{validUntil:s,network:a,from:t,messages:l}=n,o={valid_until:s,network:a??f.MAINNET,messages:l.map(({address:g,amount:c,stateInit:i,payload:m})=>({address:g,amount:c,...i!=null&&{stateInit:i},...m!=null&&{payload:m}}))};return t&&(o={...o,from:p.parse(t).toRawString()}),o}async signMessage(){throw u.UnimplementedError("signMessage")}async signAndSendTx(n){let{result:s}=await this.provider.send({method:"sendTransaction",params:[JSON.stringify(r.buildTx(n))]});return{hash:h.fromBase64(s).hash().toString("hex")}}};export{e as DefaultTonSigner};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/signer.ts"],
|
|
4
|
-
"sourcesContent": ["import type { GenericSigner, TonTransaction } from 'rango-types';\n\nimport { Address, Cell } from '@ton/core';\nimport { SignerError } from 'rango-types';\n\nexport class DefaultTonSigner implements GenericSigner<TonTransaction> {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n constructor(private provider: any) {\n this.provider = provider;\n }\n\n
|
|
5
|
-
"mappings": "+EAEA,OAAS,WAAAA,EAAS,QAAAC,MAAY,YAC9B,OAAS,eAAAC,
|
|
6
|
-
"names": ["Address", "Cell", "SignerError", "DefaultTonSigner", "
|
|
4
|
+
"sourcesContent": ["import type { GenericSigner, TonMessage, TonTransaction } from 'rango-types';\n\nimport { Address, Cell } from '@ton/core';\nimport { SignerError, TonChainID } from 'rango-types';\n\nexport type TonTransactionPayload = {\n valid_until: number;\n network: TonChainID;\n from?: string;\n messages: TonMessage[];\n};\n\nexport class DefaultTonSigner implements GenericSigner<TonTransaction> {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n constructor(private provider: any) {\n this.provider = provider;\n }\n\n static buildTx(tonTx: TonTransaction): TonTransactionPayload {\n const { validUntil, network, from, messages } = tonTx;\n\n let tx: TonTransactionPayload = {\n valid_until: validUntil,\n network: network ?? TonChainID.MAINNET,\n messages: messages.map(({ address, amount, stateInit, payload }) => ({\n address,\n amount,\n ...(stateInit != null && { stateInit }),\n ...(payload != null && { payload }),\n })),\n };\n if (from) {\n tx = { ...tx, from: Address.parse(from).toRawString() };\n }\n return tx;\n }\n\n async signMessage(): Promise<string> {\n throw SignerError.UnimplementedError('signMessage');\n }\n\n async signAndSendTx(tx: TonTransaction): Promise<{ hash: string }> {\n const { result } = await this.provider.send({\n method: 'sendTransaction',\n params: [JSON.stringify(DefaultTonSigner.buildTx(tx))],\n });\n\n const hash = Cell.fromBase64(result).hash().toString('hex');\n return { hash };\n }\n}\n"],
|
|
5
|
+
"mappings": "+EAEA,OAAS,WAAAA,EAAS,QAAAC,MAAY,YAC9B,OAAS,eAAAC,EAAa,cAAAC,MAAkB,cASjC,IAAMC,EAAN,MAAMC,CAA0D,CAErE,YAAoBC,EAAe,CAAf,cAAAA,EAClB,KAAK,SAAWA,CAClB,CAhBF,MAYuE,CAAAC,EAAA,yBAMrE,OAAO,QAAQC,EAA8C,CAC3D,GAAM,CAAE,WAAAC,EAAY,QAAAC,EAAS,KAAAC,EAAM,SAAAC,CAAS,EAAIJ,EAE5CK,EAA4B,CAC9B,YAAaJ,EACb,QAASC,GAAWI,EAAW,QAC/B,SAAUF,EAAS,IAAI,CAAC,CAAE,QAAAG,EAAS,OAAAC,EAAQ,UAAAC,EAAW,QAAAC,CAAQ,KAAO,CACnE,QAAAH,EACA,OAAAC,EACA,GAAIC,GAAa,MAAQ,CAAE,UAAAA,CAAU,EACrC,GAAIC,GAAW,MAAQ,CAAE,QAAAA,CAAQ,CACnC,EAAE,CACJ,EACA,OAAIP,IACFE,EAAK,CAAE,GAAGA,EAAI,KAAMM,EAAQ,MAAMR,CAAI,EAAE,YAAY,CAAE,GAEjDE,CACT,CAEA,MAAM,aAA+B,CACnC,MAAMO,EAAY,mBAAmB,aAAa,CACpD,CAEA,MAAM,cAAcP,EAA+C,CACjE,GAAM,CAAE,OAAAQ,CAAO,EAAI,MAAM,KAAK,SAAS,KAAK,CAC1C,OAAQ,kBACR,OAAQ,CAAC,KAAK,UAAUhB,EAAiB,QAAQQ,CAAE,CAAC,CAAC,CACvD,CAAC,EAGD,MAAO,CAAE,KADIS,EAAK,WAAWD,CAAM,EAAE,KAAK,EAAE,SAAS,KAAK,CAC5C,CAChB,CACF",
|
|
6
|
+
"names": ["Address", "Cell", "SignerError", "TonChainID", "DefaultTonSigner", "_DefaultTonSigner", "provider", "__name", "tonTx", "validUntil", "network", "from", "messages", "tx", "TonChainID", "address", "amount", "stateInit", "payload", "Address", "SignerError", "result", "Cell"]
|
|
7
7
|
}
|
package/dist/signer.d.ts
CHANGED
|
@@ -1,7 +1,15 @@
|
|
|
1
|
-
import type { GenericSigner, TonTransaction } from 'rango-types';
|
|
1
|
+
import type { GenericSigner, TonMessage, TonTransaction } from 'rango-types';
|
|
2
|
+
import { TonChainID } from 'rango-types';
|
|
3
|
+
export type TonTransactionPayload = {
|
|
4
|
+
valid_until: number;
|
|
5
|
+
network: TonChainID;
|
|
6
|
+
from?: string;
|
|
7
|
+
messages: TonMessage[];
|
|
8
|
+
};
|
|
2
9
|
export declare class DefaultTonSigner implements GenericSigner<TonTransaction> {
|
|
3
10
|
private provider;
|
|
4
11
|
constructor(provider: any);
|
|
12
|
+
static buildTx(tonTx: TonTransaction): TonTransactionPayload;
|
|
5
13
|
signMessage(): Promise<string>;
|
|
6
14
|
signAndSendTx(tx: TonTransaction): Promise<{
|
|
7
15
|
hash: string;
|
package/dist/signer.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signer.d.ts","sourceRoot":"","sources":["../src/signer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"signer.d.ts","sourceRoot":"","sources":["../src/signer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAG7E,OAAO,EAAe,UAAU,EAAE,MAAM,aAAa,CAAC;AAEtD,MAAM,MAAM,qBAAqB,GAAG;IAClC,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,UAAU,CAAC;IACpB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,UAAU,EAAE,CAAC;CACxB,CAAC;AAEF,qBAAa,gBAAiB,YAAW,aAAa,CAAC,cAAc,CAAC;IAExD,OAAO,CAAC,QAAQ;gBAAR,QAAQ,EAAE,GAAG;IAIjC,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,cAAc,GAAG,qBAAqB;IAmBtD,WAAW,IAAI,OAAO,CAAC,MAAM,CAAC;IAI9B,aAAa,CAAC,EAAE,EAAE,cAAc,GAAG,OAAO,CAAC;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;CASnE"}
|
package/package.json
CHANGED
package/src/signer.ts
CHANGED
|
@@ -1,7 +1,14 @@
|
|
|
1
|
-
import type { GenericSigner, TonTransaction } from 'rango-types';
|
|
1
|
+
import type { GenericSigner, TonMessage, TonTransaction } from 'rango-types';
|
|
2
2
|
|
|
3
3
|
import { Address, Cell } from '@ton/core';
|
|
4
|
-
import { SignerError } from 'rango-types';
|
|
4
|
+
import { SignerError, TonChainID } from 'rango-types';
|
|
5
|
+
|
|
6
|
+
export type TonTransactionPayload = {
|
|
7
|
+
valid_until: number;
|
|
8
|
+
network: TonChainID;
|
|
9
|
+
from?: string;
|
|
10
|
+
messages: TonMessage[];
|
|
11
|
+
};
|
|
5
12
|
|
|
6
13
|
export class DefaultTonSigner implements GenericSigner<TonTransaction> {
|
|
7
14
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -9,26 +16,33 @@ export class DefaultTonSigner implements GenericSigner<TonTransaction> {
|
|
|
9
16
|
this.provider = provider;
|
|
10
17
|
}
|
|
11
18
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
async signAndSendTx(tx: TonTransaction): Promise<{ hash: string }> {
|
|
17
|
-
const { type, blockChain, from, messages, ...rest } = tx;
|
|
19
|
+
static buildTx(tonTx: TonTransaction): TonTransactionPayload {
|
|
20
|
+
const { validUntil, network, from, messages } = tonTx;
|
|
18
21
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
messages: messages.map(({ stateInit, payload
|
|
23
|
-
|
|
22
|
+
let tx: TonTransactionPayload = {
|
|
23
|
+
valid_until: validUntil,
|
|
24
|
+
network: network ?? TonChainID.MAINNET,
|
|
25
|
+
messages: messages.map(({ address, amount, stateInit, payload }) => ({
|
|
26
|
+
address,
|
|
27
|
+
amount,
|
|
24
28
|
...(stateInit != null && { stateInit }),
|
|
25
29
|
...(payload != null && { payload }),
|
|
26
30
|
})),
|
|
27
31
|
};
|
|
32
|
+
if (from) {
|
|
33
|
+
tx = { ...tx, from: Address.parse(from).toRawString() };
|
|
34
|
+
}
|
|
35
|
+
return tx;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
async signMessage(): Promise<string> {
|
|
39
|
+
throw SignerError.UnimplementedError('signMessage');
|
|
40
|
+
}
|
|
28
41
|
|
|
42
|
+
async signAndSendTx(tx: TonTransaction): Promise<{ hash: string }> {
|
|
29
43
|
const { result } = await this.provider.send({
|
|
30
44
|
method: 'sendTransaction',
|
|
31
|
-
params: [JSON.stringify(
|
|
45
|
+
params: [JSON.stringify(DefaultTonSigner.buildTx(tx))],
|
|
32
46
|
});
|
|
33
47
|
|
|
34
48
|
const hash = Cell.fromBase64(result).hash().toString('hex');
|
package/CHANGELOG.md
DELETED
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
## [0.28.1](https://github.com/rango-exchange/rango-client/compare/signer-ton@0.28.0...signer-ton@0.28.1) (2026-06-02)
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
### Bug Fixes
|
|
5
|
-
|
|
6
|
-
* remove null values from ton signer data and use raw address format ([9ca3f69](https://github.com/rango-exchange/rango-client/commit/9ca3f691e2a6bfe83d2377a565fd69f5c2b8ae45))
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
# [0.28.0](https://github.com/rango-exchange/rango-client/compare/signer-ton@0.27.1...signer-ton@0.28.0) (2026-05-31)
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
## [0.27.1](https://github.com/rango-exchange/rango-client/compare/signer-ton@0.27.0...signer-ton@0.27.1) (2026-05-02)
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
# [0.27.0](https://github.com/rango-exchange/rango-client/compare/signer-ton@0.26.0...signer-ton@0.27.0) (2026-04-29)
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
# [0.26.0](https://github.com/rango-exchange/rango-client/compare/signer-ton@0.25.0...signer-ton@0.26.0) (2025-08-19)
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
# [0.25.0](https://github.com/rango-exchange/rango-client/compare/signer-ton@0.24.0...signer-ton@0.25.0) (2025-08-05)
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
# [0.24.0](https://github.com/rango-exchange/rango-client/compare/signer-ton@0.23.0...signer-ton@0.24.0) (2025-07-22)
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
### Reverts
|
|
34
|
-
|
|
35
|
-
* Revert "chore(release): publish" ([064ce15](https://github.com/rango-exchange/rango-client/commit/064ce157a2f819856f647f83aeb1c0410542e8d7))
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
# [0.22.0](https://github.com/rango-exchange/rango-client/compare/signer-ton@0.21.0...signer-ton@0.22.0) (2025-06-09)
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
# [0.21.0](https://github.com/rango-exchange/rango-client/compare/signer-ton@0.20.0...signer-ton@0.21.0) (2025-04-30)
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
### Bug Fixes
|
|
47
|
-
|
|
48
|
-
* rename pbt to ptb for sui ([3d6d89f](https://github.com/rango-exchange/rango-client/commit/3d6d89f2265766607a15d61e0df92643fb33072b))
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
### Features
|
|
52
|
-
|
|
53
|
-
* update sui to consider recent api changes ([d764b25](https://github.com/rango-exchange/rango-client/commit/d764b2501df9bb295f63cdbc0b05acd4a3abb4b9))
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
# [0.20.0](https://github.com/rango-exchange/rango-client/compare/signer-ton@0.19.0...signer-ton@0.20.0) (2025-03-11)
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
# [0.19.0](https://github.com/rango-exchange/rango-client/compare/signer-ton@0.18.0...signer-ton@0.19.0) (2025-02-23)
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
# [0.18.0](https://github.com/rango-exchange/rango-client/compare/signer-ton@0.17.0...signer-ton@0.18.0) (2024-11-27)
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
### Bug Fixes
|
|
69
|
-
|
|
70
|
-
* improve ton signer and mytonwallet provider ([7027755](https://github.com/rango-exchange/rango-client/commit/7027755740426359f42b088b842dfd01590df5c3))
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
# [0.17.0](https://github.com/rango-exchange/rango-client/compare/signer-ton@0.16.0...signer-ton@0.17.0) (2024-11-12)
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
# [0.16.0](https://github.com/rango-exchange/rango-client/compare/signer-ton@0.15.0...signer-ton@0.16.0) (2024-10-12)
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
### Bug Fixes
|
|
82
|
-
|
|
83
|
-
* bump sdk and fix type issues ([d442208](https://github.com/rango-exchange/rango-client/commit/d4422083bf5dd27d5f509ce1db7f9560d05428c8))
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
# [0.15.0](https://github.com/rango-exchange/rango-client/compare/signer-ton@0.14.0...signer-ton@0.15.0) (2024-09-10)
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
# [0.14.0](https://github.com/rango-exchange/rango-client/compare/signer-ton@0.13.0...signer-ton@0.14.0) (2024-08-11)
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
# [0.13.0](https://github.com/rango-exchange/rango-client/compare/signer-ton@0.12.0...signer-ton@0.13.0) (2024-07-09)
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
# [0.12.0](https://github.com/rango-exchange/rango-client/compare/signer-ton@0.11.0...signer-ton@0.12.0) (2024-02-20)
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
# [0.11.0](https://github.com/rango-exchange/rango-client/compare/signer-ton@0.9.0...signer-ton@0.11.0) (2023-12-24)
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
### Bug Fixes
|
|
107
|
-
|
|
108
|
-
* fix HMR for widget and playground ([8524820](https://github.com/rango-exchange/rango-client/commit/8524820f10cf0b8921f3db0c4f620ff98daa4103))
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|