@rango-dev/signer-ton 0.29.0 → 0.29.1-next.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/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ # [0.29.0](https://github.com/rango-exchange/rango-client/compare/signer-ton@0.28.1...signer-ton@0.29.0) (2026-08-18)
2
+
3
+
4
+
1
5
  ## [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
6
 
3
7
 
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- var h=Object.defineProperty;var i=(n,r)=>h(n,"name",{value:r,configurable:!0});import{Address as l,Cell as d}from"@ton/core";import{SignerError as f}from"rango-types";var s=class{constructor(r){this.provider=r;this.provider=r}static{i(this,"DefaultTonSigner")}async signMessage(){throw f.UnimplementedError("signMessage")}async signAndSendTx(r){let{type:S,blockChain:T,from:e,messages:a,...m}=r,c={...m,...e&&{from:l.parse(e).toRawString()},messages:a.map(({stateInit:o,payload:t,...p})=>({...p,...o!=null&&{stateInit:o},...t!=null&&{payload:t}}))},{result:g}=await this.provider.send({method:"sendTransaction",params:[JSON.stringify(c)]});return{hash:d.fromBase64(g).hash().toString("hex")}}};export{s as DefaultTonSigner};
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 async signMessage(): Promise<string> {\n throw SignerError.UnimplementedError('signMessage');\n }\n\n async signAndSendTx(tx: TonTransaction): Promise<{ hash: string }> {\n const { type, blockChain, from, messages, ...rest } = tx;\n\n const transactionObjectForSign = {\n ...rest,\n ...(from && { from: Address.parse(from).toRawString() }),\n messages: messages.map(({ stateInit, payload, ...msg }) => ({\n ...msg,\n ...(stateInit != null && { stateInit }),\n ...(payload != null && { payload }),\n })),\n };\n\n const { result } = await this.provider.send({\n method: 'sendTransaction',\n params: [JSON.stringify(transactionObjectForSign)],\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,MAAmB,cAErB,IAAMC,EAAN,KAAgE,CAErE,YAAoBC,EAAe,CAAf,cAAAA,EAClB,KAAK,SAAWA,CAClB,CATF,MAKuE,CAAAC,EAAA,yBAMrE,MAAM,aAA+B,CACnC,MAAMC,EAAY,mBAAmB,aAAa,CACpD,CAEA,MAAM,cAAcC,EAA+C,CACjE,GAAM,CAAE,KAAAC,EAAM,WAAAC,EAAY,KAAAC,EAAM,SAAAC,EAAU,GAAGC,CAAK,EAAIL,EAEhDM,EAA2B,CAC/B,GAAGD,EACH,GAAIF,GAAQ,CAAE,KAAMI,EAAQ,MAAMJ,CAAI,EAAE,YAAY,CAAE,EACtD,SAAUC,EAAS,IAAI,CAAC,CAAE,UAAAI,EAAW,QAAAC,EAAS,GAAGC,CAAI,KAAO,CAC1D,GAAGA,EACH,GAAIF,GAAa,MAAQ,CAAE,UAAAA,CAAU,EACrC,GAAIC,GAAW,MAAQ,CAAE,QAAAA,CAAQ,CACnC,EAAE,CACJ,EAEM,CAAE,OAAAE,CAAO,EAAI,MAAM,KAAK,SAAS,KAAK,CAC1C,OAAQ,kBACR,OAAQ,CAAC,KAAK,UAAUL,CAAwB,CAAC,CACnD,CAAC,EAGD,MAAO,CAAE,KADIM,EAAK,WAAWD,CAAM,EAAE,KAAK,EAAE,SAAS,KAAK,CAC5C,CAChB,CACF",
6
- "names": ["Address", "Cell", "SignerError", "DefaultTonSigner", "provider", "__name", "SignerError", "tx", "type", "blockChain", "from", "messages", "rest", "transactionObjectForSign", "Address", "stateInit", "payload", "msg", "result", "Cell"]
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;
@@ -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;AAKjE,qBAAa,gBAAiB,YAAW,aAAa,CAAC,cAAc,CAAC;IAExD,OAAO,CAAC,QAAQ;gBAAR,QAAQ,EAAE,GAAG;IAI3B,WAAW,IAAI,OAAO,CAAC,MAAM,CAAC;IAI9B,aAAa,CAAC,EAAE,EAAE,cAAc,GAAG,OAAO,CAAC;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;CAqBnE"}
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rango-dev/signer-ton",
3
- "version": "0.29.0",
3
+ "version": "0.29.1-next.0",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "source": "./src/index.ts",
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
- async signMessage(): Promise<string> {
13
- throw SignerError.UnimplementedError('signMessage');
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
- const transactionObjectForSign = {
20
- ...rest,
21
- ...(from && { from: Address.parse(from).toRawString() }),
22
- messages: messages.map(({ stateInit, payload, ...msg }) => ({
23
- ...msg,
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(transactionObjectForSign)],
45
+ params: [JSON.stringify(DefaultTonSigner.buildTx(tx))],
32
46
  });
33
47
 
34
48
  const hash = Cell.fromBase64(result).hash().toString('hex');