@rango-dev/signer-tron 0.27.0 → 0.27.1-next.1
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 +4 -0
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/signer-tron.build.json +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var o=Object.defineProperty;var n=(a,r)=>o(a,"name",{value:r,configurable:!0});import{SignerError as t,SignerErrorCode as d}from"rango-types";var i=class a{static{n(this,"DefaultTronSigner")}
|
|
1
|
+
var o=Object.defineProperty;var n=(a,r)=>o(a,"name",{value:r,configurable:!0});import{SignerError as t,SignerErrorCode as d}from"rango-types";var i=class a{static{n(this,"DefaultTronSigner")}constructor(r){this.provider=r}async signMessage(){throw t.UnimplementedError("signMessage")}async signAndSendTx(r){try{let e=a.buildTx(r),s=await this.provider.tronWeb.trx.sign(e);return{hash:(await this.provider.tronWeb.trx.sendRawTransaction(s))?.transaction?.txID}}catch(e){throw new t(d.SEND_TX_ERROR,void 0,e)}}static buildTx(r){let e={};return r.txID&&(e={...e,txID:r.txID}),r.visible!==void 0&&(e={...e,visible:r.visible}),r.__payload__&&(e={...e,__payload__:r.__payload__}),r.raw_data&&(e={...e,raw_data:r.raw_data}),r.raw_data_hex&&(e={...e,raw_data_hex:r.raw_data_hex}),e}};export{i as DefaultTronSigner};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/signer.ts"],
|
|
4
4
|
"sourcesContent": ["import type { GenericSigner, TronTransaction } from 'rango-types';\n\nimport { SignerError, SignerErrorCode } from 'rango-types';\n\n// TODO - replace with real type\n// tslint:disable-next-line: no-any\ntype TronExternalProvider = any;\n\nexport class DefaultTronSigner implements GenericSigner<TronTransaction> {\n private provider: TronExternalProvider;\n\n constructor(provider: TronExternalProvider) {\n this.provider = provider;\n }\n\n async signMessage(): Promise<string> {\n throw SignerError.UnimplementedError('signMessage');\n }\n\n async signAndSendTx(tx: TronTransaction): Promise<{ hash: string }> {\n try {\n const transaction = DefaultTronSigner.buildTx(tx);\n const signedTxn = await this.provider.tronWeb.trx.sign(transaction);\n const receipt = await this.provider.tronWeb.trx.sendRawTransaction(\n signedTxn\n );\n const hash = receipt?.transaction?.txID;\n return { hash };\n } catch (error) {\n throw new SignerError(SignerErrorCode.SEND_TX_ERROR, undefined, error);\n }\n }\n\n static buildTx(tronTx: TronTransaction) {\n let tx = {};\n if (!!tronTx.txID) tx = { ...tx, txID: tronTx.txID };\n if (tronTx.visible !== undefined) tx = { ...tx, visible: tronTx.visible };\n if (!!tronTx.__payload__) tx = { ...tx, __payload__: tronTx.__payload__ };\n if (!!tronTx.raw_data) tx = { ...tx, raw_data: tronTx.raw_data };\n if (!!tronTx.raw_data_hex)\n tx = { ...tx, raw_data_hex: tronTx.raw_data_hex };\n return tx;\n }\n}\n"],
|
|
5
|
-
"mappings": "+EAEA,OAAS,eAAAA,EAAa,mBAAAC,MAAuB,cAMtC,IAAMC,EAAN,MAAMC,CAA4D,CARzE,MAQyE,CAAAC,EAAA,
|
|
5
|
+
"mappings": "+EAEA,OAAS,eAAAA,EAAa,mBAAAC,MAAuB,cAMtC,IAAMC,EAAN,MAAMC,CAA4D,CARzE,MAQyE,CAAAC,EAAA,0BAGvE,YAAYC,EAAgC,CAC1C,KAAK,SAAWA,CAClB,CAEA,MAAM,aAA+B,CACnC,MAAMC,EAAY,mBAAmB,aAAa,CACpD,CAEA,MAAM,cAAcC,EAAgD,CAClE,GAAI,CACF,IAAMC,EAAcL,EAAkB,QAAQI,CAAE,EAC1CE,EAAY,MAAM,KAAK,SAAS,QAAQ,IAAI,KAAKD,CAAW,EAKlE,MAAO,CAAE,MAJO,MAAM,KAAK,SAAS,QAAQ,IAAI,mBAC9CC,CACF,IACsB,aAAa,IACrB,CAChB,OAASC,EAAO,CACd,MAAM,IAAIJ,EAAYK,EAAgB,cAAe,OAAWD,CAAK,CACvE,CACF,CAEA,OAAO,QAAQE,EAAyB,CACtC,IAAIL,EAAK,CAAC,EACV,OAAMK,EAAO,OAAML,EAAK,CAAE,GAAGA,EAAI,KAAMK,EAAO,IAAK,GAC/CA,EAAO,UAAY,SAAWL,EAAK,CAAE,GAAGA,EAAI,QAASK,EAAO,OAAQ,GAClEA,EAAO,cAAaL,EAAK,CAAE,GAAGA,EAAI,YAAaK,EAAO,WAAY,GAClEA,EAAO,WAAUL,EAAK,CAAE,GAAGA,EAAI,SAAUK,EAAO,QAAS,GACzDA,EAAO,eACXL,EAAK,CAAE,GAAGA,EAAI,aAAcK,EAAO,YAAa,GAC3CL,CACT,CACF",
|
|
6
6
|
"names": ["SignerError", "SignerErrorCode", "DefaultTronSigner", "_DefaultTronSigner", "__name", "provider", "SignerError", "tx", "transaction", "signedTxn", "error", "SignerErrorCode", "tronTx"]
|
|
7
7
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"inputs":{"src/signer.ts":{"bytes":1488,"imports":[{"path":"rango-types","kind":"import-statement","external":true},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/index.ts":{"bytes":46,"imports":[{"path":"src/signer.ts","kind":"import-statement","original":"./signer"}],"format":"esm"}},"outputs":{"dist/index.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":
|
|
1
|
+
{"inputs":{"src/signer.ts":{"bytes":1488,"imports":[{"path":"rango-types","kind":"import-statement","external":true},{"path":"<runtime>","kind":"import-statement","external":true}],"format":"esm"},"src/index.ts":{"bytes":46,"imports":[{"path":"src/signer.ts","kind":"import-statement","original":"./signer"}],"format":"esm"}},"outputs":{"dist/index.js.map":{"imports":[],"exports":[],"inputs":{},"bytes":2616},"dist/index.js":{"imports":[{"path":"rango-types","kind":"import-statement","external":true}],"exports":["DefaultTronSigner"],"entryPoint":"src/index.ts","inputs":{"src/signer.ts":{"bytesInOutput":697},"src/index.ts":{"bytesInOutput":0}},"bytes":842}}}
|