@rango-dev/signer-ton 0.17.0 → 0.18.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.17.0](https://github.com/rango-exchange/rango-client/compare/signer-ton@0.16.0...signer-ton@0.17.0) (2024-11-12)
2
+
3
+
4
+
1
5
  # [0.16.0](https://github.com/rango-exchange/rango-client/compare/signer-ton@0.15.0...signer-ton@0.16.0) (2024-10-12)
2
6
 
3
7
 
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- var o=Object.defineProperty;var s=(e,r)=>o(e,"name",{value:r,configurable:!0});import{SignerError as t}from"rango-types";var n=class{constructor(r){this.provider=r;this.provider=r}static{s(this,"DefaultTonSigner")}async signMessage(){throw t.UnimplementedError("signMessage")}async signAndSendTx(r){let{type:a,blockChain:c,...i}=r;return await this.provider.send({method:"sendTransaction",params:[JSON.stringify(i)]}),{hash:"xxxxxxxx"}}};export{n as DefaultTonSigner};
1
+ var i=Object.defineProperty;var e=(s,r)=>i(s,"name",{value:r,configurable:!0});import{Cell as a}from"@ton/core";import{SignerError as c}from"rango-types";var n=class{constructor(r){this.provider=r;this.provider=r}static{e(this,"DefaultTonSigner")}async signMessage(){throw c.UnimplementedError("signMessage")}async signAndSendTx(r){let{type:m,blockChain:g,...o}=r,{result:t}=await this.provider.send({method:"sendTransaction",params:[JSON.stringify(o)]});return{hash:a.fromBase64(t).hash().toString("hex")}}};export{n 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 { 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, ...transactionObjectForSign } = tx;\n\n await this.provider.send({\n method: 'sendTransaction',\n params: [JSON.stringify(transactionObjectForSign)],\n });\n /*\n *No hash is returned when signing a Ton transaction.\n *Returns a string for API consistency\n */\n return { hash: 'xxxxxxxx' };\n }\n}\n"],
5
- "mappings": "+EAEA,OAAS,eAAAA,MAAmB,cAErB,IAAMC,EAAN,KAAgE,CAErE,YAAoBC,EAAe,CAAf,cAAAA,EAClB,KAAK,SAAWA,CAClB,CARF,MAIuE,CAAAC,EAAA,yBAMrE,MAAM,aAA+B,CACnC,MAAMC,EAAY,mBAAmB,aAAa,CACpD,CAEA,MAAM,cAAcC,EAA+C,CACjE,GAAM,CAAE,KAAAC,EAAM,WAAAC,EAAY,GAAGC,CAAyB,EAAIH,EAE1D,aAAM,KAAK,SAAS,KAAK,CACvB,OAAQ,kBACR,OAAQ,CAAC,KAAK,UAAUG,CAAwB,CAAC,CACnD,CAAC,EAKM,CAAE,KAAM,UAAW,CAC5B,CACF",
6
- "names": ["SignerError", "DefaultTonSigner", "provider", "__name", "SignerError", "tx", "type", "blockChain", "transactionObjectForSign"]
4
+ "sourcesContent": ["import type { GenericSigner, TonTransaction } from 'rango-types';\n\nimport { 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, ...transactionObjectForSign } = tx;\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,QAAAA,MAAY,YACrB,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,GAAGC,CAAyB,EAAIH,EAEpD,CAAE,OAAAI,CAAO,EAAI,MAAM,KAAK,SAAS,KAAK,CAC1C,OAAQ,kBACR,OAAQ,CAAC,KAAK,UAAUD,CAAwB,CAAC,CACnD,CAAC,EAGD,MAAO,CAAE,KADIE,EAAK,WAAWD,CAAM,EAAE,KAAK,EAAE,SAAS,KAAK,CAC5C,CAChB,CACF",
6
+ "names": ["Cell", "SignerError", "DefaultTonSigner", "provider", "__name", "SignerError", "tx", "type", "blockChain", "transactionObjectForSign", "result", "Cell"]
7
7
  }
@@ -1 +1 @@
1
- {"inputs":{"src/signer.ts":{"bytes":849,"imports":[{"path":"rango-types","kind":"import-statement","external":true},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/index.ts":{"bytes":48,"imports":[{"path":"src/signer.ts","kind":"import-statement","original":"./signer.js"}],"format":"esm"}},"outputs":{"dist/index.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":1483},"dist/index.js":{"imports":[{"path":"rango-types","kind":"import-statement","external":true}],"exports":["DefaultTonSigner"],"entryPoint":"src/index.ts","inputs":{"src/signer.ts":{"bytesInOutput":359},"src/index.ts":{"bytesInOutput":0}},"bytes":503}}}
1
+ {"inputs":{"src/signer.ts":{"bytes":840,"imports":[{"path":"@ton/core","kind":"import-statement","external":true},{"path":"rango-types","kind":"import-statement","external":true},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/index.ts":{"bytes":48,"imports":[{"path":"src/signer.ts","kind":"import-statement","original":"./signer.js"}],"format":"esm"}},"outputs":{"dist/index.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":1590},"dist/index.js":{"imports":[{"path":"@ton/core","kind":"import-statement","external":true},{"path":"rango-types","kind":"import-statement","external":true}],"exports":["DefaultTonSigner"],"entryPoint":"src/index.ts","inputs":{"src/signer.ts":{"bytesInOutput":430},"src/index.ts":{"bytesInOutput":0}},"bytes":574}}}
@@ -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;AAIjE,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;CAanE"}
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;CAWnE"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rango-dev/signer-ton",
3
- "version": "0.17.0",
3
+ "version": "0.18.0",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "source": "./src/index.ts",
@@ -23,6 +23,10 @@
23
23
  "dependencies": {
24
24
  "rango-types": "^0.1.74"
25
25
  },
26
+ "peerDependencies": {
27
+ "@ton/core": ">=0.59.0",
28
+ "@ton/crypto": ">=3.3.0"
29
+ },
26
30
  "publishConfig": {
27
31
  "access": "public"
28
32
  }
package/src/signer.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import type { GenericSigner, TonTransaction } from 'rango-types';
2
2
 
3
+ import { Cell } from '@ton/core';
3
4
  import { SignerError } from 'rango-types';
4
5
 
5
6
  export class DefaultTonSigner implements GenericSigner<TonTransaction> {
@@ -15,14 +16,12 @@ export class DefaultTonSigner implements GenericSigner<TonTransaction> {
15
16
  async signAndSendTx(tx: TonTransaction): Promise<{ hash: string }> {
16
17
  const { type, blockChain, ...transactionObjectForSign } = tx;
17
18
 
18
- await this.provider.send({
19
+ const { result } = await this.provider.send({
19
20
  method: 'sendTransaction',
20
21
  params: [JSON.stringify(transactionObjectForSign)],
21
22
  });
22
- /*
23
- *No hash is returned when signing a Ton transaction.
24
- *Returns a string for API consistency
25
- */
26
- return { hash: 'xxxxxxxx' };
23
+
24
+ const hash = Cell.fromBase64(result).hash().toString('hex');
25
+ return { hash };
27
26
  }
28
27
  }