@rango-dev/signer-tron 0.1.15-next.2 → 0.1.15-next.4
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 +2 -2
- package/dist/signer.d.ts +3 -1
- package/dist/signer.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/signer.ts +3 -2
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var o=Object.defineProperty;var
|
|
1
|
+
var o=Object.defineProperty;var i=(t,r)=>o(t,"name",{value:r,configurable:!0});import{SignerError as n,SignerErrorCode as d}from"rango-types";var e=class{constructor(r){this.provider=r}async signMessage(){throw n.UnimplementedError("signMessage")}async signAndSendTx(r){try{let a=e.buildTx(r),s=await this.provider.tronWeb.trx.sign(a);return{hash:(await this.provider.tronWeb.trx.sendRawTransaction(s))?.transaction?.txID}}catch(a){throw new n(d.SEND_TX_ERROR,void 0,a)}}static buildTx(r){let a={};return r.txID&&(a={...a,txID:r.txID}),r.visible!==void 0&&(a={...a,visible:r.visible}),r.__payload__&&(a={...a,__payload__:r.__payload__}),r.raw_data&&(a={...a,raw_data:r.raw_data}),r.raw_data_hex&&(a={...a,raw_data_hex:r.raw_data_hex}),a}};i(e,"DefaultTronSigner");export{e as DefaultTronSigner};
|
|
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 {\n GenericSigner,\n SignerError,\n SignerErrorCode,\n TronTransaction,\n} 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<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
|
|
5
|
-
"mappings": "+EAAA,OAEE,eAAAA,EACA,mBAAAC,MAEK,cAMA,IAAMC,EAAN,KAAkE,CAGvE,YAAYC,EAAgC,CAC1C,KAAK,SAAWA,CAClB,CAEA,MAAM,aAA+B,CACnC,MAAMC,EAAY,mBAAmB,aAAa,CACpD,CAEA,MAAM,cAAcC,
|
|
4
|
+
"sourcesContent": ["import {\n GenericSigner,\n SignerError,\n SignerErrorCode,\n TronTransaction,\n} 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": "+EAAA,OAEE,eAAAA,EACA,mBAAAC,MAEK,cAMA,IAAMC,EAAN,KAAkE,CAGvE,YAAYC,EAAgC,CAC1C,KAAK,SAAWA,CAClB,CAEA,MAAM,aAA+B,CACnC,MAAMC,EAAY,mBAAmB,aAAa,CACpD,CAEA,MAAM,cAAcC,EAAgD,CAClE,GAAI,CACF,IAAMC,EAAcJ,EAAkB,QAAQG,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,EAAP,CACA,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,EAnCaM,EAAAT,EAAA",
|
|
6
6
|
"names": ["SignerError", "SignerErrorCode", "DefaultTronSigner", "provider", "SignerError", "tx", "transaction", "signedTxn", "error", "SignerErrorCode", "tronTx", "__name"]
|
|
7
7
|
}
|
package/dist/signer.d.ts
CHANGED
|
@@ -4,7 +4,9 @@ export declare class DefaultTronSigner implements GenericSigner<TronTransaction>
|
|
|
4
4
|
private provider;
|
|
5
5
|
constructor(provider: TronExternalProvider);
|
|
6
6
|
signMessage(): Promise<string>;
|
|
7
|
-
signAndSendTx(tx: TronTransaction): Promise<
|
|
7
|
+
signAndSendTx(tx: TronTransaction): Promise<{
|
|
8
|
+
hash: string;
|
|
9
|
+
}>;
|
|
8
10
|
static buildTx(tronTx: TronTransaction): {};
|
|
9
11
|
}
|
|
10
12
|
export {};
|
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,EACL,aAAa,EAGb,eAAe,EAChB,MAAM,aAAa,CAAC;AAIrB,KAAK,oBAAoB,GAAG,GAAG,CAAC;AAEhC,qBAAa,iBAAkB,YAAW,aAAa,CAAC,eAAe,CAAC;IACtE,OAAO,CAAC,QAAQ,CAAuB;gBAE3B,QAAQ,EAAE,oBAAoB;IAIpC,WAAW,IAAI,OAAO,CAAC,MAAM,CAAC;IAI9B,aAAa,CAAC,EAAE,EAAE,eAAe,GAAG,OAAO,CAAC,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"signer.d.ts","sourceRoot":"","sources":["../src/signer.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EAGb,eAAe,EAChB,MAAM,aAAa,CAAC;AAIrB,KAAK,oBAAoB,GAAG,GAAG,CAAC;AAEhC,qBAAa,iBAAkB,YAAW,aAAa,CAAC,eAAe,CAAC;IACtE,OAAO,CAAC,QAAQ,CAAuB;gBAE3B,QAAQ,EAAE,oBAAoB;IAIpC,WAAW,IAAI,OAAO,CAAC,MAAM,CAAC;IAI9B,aAAa,CAAC,EAAE,EAAE,eAAe,GAAG,OAAO,CAAC;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;IAcnE,MAAM,CAAC,OAAO,CAAC,MAAM,EAAE,eAAe;CAUvC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rango-dev/signer-tron",
|
|
3
|
-
"version": "0.1.15-next.
|
|
3
|
+
"version": "0.1.15-next.4",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"lint": "eslint \"**/*.{ts,tsx}\" --ignore-path ../../.eslintignore"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"rango-types": "^0.1.
|
|
20
|
+
"rango-types": "^0.1.37"
|
|
21
21
|
},
|
|
22
22
|
"publishConfig": {
|
|
23
23
|
"access": "public"
|
package/src/signer.ts
CHANGED
|
@@ -20,14 +20,15 @@ export class DefaultTronSigner implements GenericSigner<TronTransaction> {
|
|
|
20
20
|
throw SignerError.UnimplementedError('signMessage');
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
async signAndSendTx(tx: TronTransaction): Promise<string> {
|
|
23
|
+
async signAndSendTx(tx: TronTransaction): Promise<{ hash: string }> {
|
|
24
24
|
try {
|
|
25
25
|
const transaction = DefaultTronSigner.buildTx(tx);
|
|
26
26
|
const signedTxn = await this.provider.tronWeb.trx.sign(transaction);
|
|
27
27
|
const receipt = await this.provider.tronWeb.trx.sendRawTransaction(
|
|
28
28
|
signedTxn
|
|
29
29
|
);
|
|
30
|
-
|
|
30
|
+
const hash = receipt?.transaction?.txID;
|
|
31
|
+
return { hash };
|
|
31
32
|
} catch (error) {
|
|
32
33
|
throw new SignerError(SignerErrorCode.SEND_TX_ERROR, undefined, error);
|
|
33
34
|
}
|