eosjs
Advanced tools
Comparing version 22.2.0-85-bae9af0 to 22.2.0-86-deee1f8
@@ -111,2 +111,4 @@ /** | ||
pushCompressedSignedTransaction({ signatures, serializedTransaction, serializedContextFreeData }: PushTransactionArgs, readOnlyTrx?: boolean, returnFailureTraces?: boolean): Promise<TransactResult | ReadOnlyTransactResult>; | ||
/** Broadcast a signed transaction */ | ||
sendSignedTransaction({ signatures, serializedTransaction, serializedContextFreeData }: PushTransactionArgs, returnFailureTraces?: boolean, readOnlyTrx?: boolean, compression?: boolean): Promise<TransactResult | ReadOnlyTransactResult>; | ||
private generateTapos; | ||
@@ -113,0 +115,0 @@ private hasRequiredTaposFields; |
@@ -514,6 +514,3 @@ "use strict"; | ||
if (broadcast) { | ||
if (compression) { | ||
return [2 /*return*/, this.pushCompressedSignedTransaction(pushTransactionArgs, readOnlyTrx, returnFailureTraces)]; | ||
} | ||
return [2 /*return*/, this.pushSignedTransaction(pushTransactionArgs, readOnlyTrx, returnFailureTraces)]; | ||
return [2 /*return*/, this.sendSignedTransaction(pushTransactionArgs, returnFailureTraces, readOnlyTrx, compression)]; | ||
} | ||
@@ -641,2 +638,47 @@ return [2 /*return*/, pushTransactionArgs]; | ||
}; | ||
/** Broadcast a signed transaction */ | ||
Api.prototype.sendSignedTransaction = function (_a, returnFailureTraces, readOnlyTrx, compression) { | ||
var signatures = _a.signatures, serializedTransaction = _a.serializedTransaction, serializedContextFreeData = _a.serializedContextFreeData; | ||
if (returnFailureTraces === void 0) { returnFailureTraces = false; } | ||
if (readOnlyTrx === void 0) { readOnlyTrx = false; } | ||
if (compression === void 0) { compression = false; } | ||
return __awaiter(this, void 0, void 0, function () { | ||
var apis; | ||
return __generator(this, function (_b) { | ||
switch (_b.label) { | ||
case 0: | ||
if (compression) { | ||
serializedTransaction = this.deflateSerializedArray(serializedTransaction); | ||
serializedContextFreeData = | ||
this.deflateSerializedArray(serializedContextFreeData || new Uint8Array(0)); | ||
} | ||
return [4 /*yield*/, this.rpc.get_supported_apis()]; | ||
case 1: | ||
apis = (_b.sent()).apis; | ||
if (readOnlyTrx) { | ||
return [2 /*return*/, this.rpc.send_ro_transaction({ | ||
signatures: signatures, | ||
compression: compression ? 1 : 0, | ||
serializedTransaction: serializedTransaction, | ||
serializedContextFreeData: serializedContextFreeData, | ||
}, returnFailureTraces)]; | ||
} | ||
if (apis.includes('/v2/chain/send_transaction')) { | ||
return [2 /*return*/, this.rpc.send_transaction_v2({ | ||
signatures: signatures, | ||
compression: compression ? 1 : 0, | ||
serializedTransaction: serializedTransaction, | ||
serializedContextFreeData: serializedContextFreeData, | ||
}, returnFailureTraces)]; | ||
} | ||
return [2 /*return*/, this.rpc.send_transaction({ | ||
signatures: signatures, | ||
compression: compression ? 1 : 0, | ||
serializedTransaction: serializedTransaction, | ||
serializedContextFreeData: serializedContextFreeData, | ||
})]; | ||
} | ||
}); | ||
}); | ||
}; | ||
Api.prototype.generateTapos = function (info, transaction, blocksBehind, useLastIrreversible, expireSeconds) { | ||
@@ -643,0 +685,0 @@ return __awaiter(this, void 0, void 0, function () { |
@@ -5,3 +5,3 @@ /** | ||
import { AbiProvider, AuthorityProvider, AuthorityProviderArgs, BinaryAbi, TransactResult } from './eosjs-api-interfaces'; | ||
import { AbiBinToJsonResult, AbiJsonToBinResult, GetAbiResult, GetAccountResult, GetAccountsByAuthorizersResult, GetActivatedProtocolFeaturesParams, GetActivatedProtocolFeaturesResult, GetBlockInfoResult, GetBlockResult, GetCodeResult, GetCodeHashResult, GetCurrencyStatsResult, GetInfoResult, GetProducerScheduleResult, GetProducersResult, GetRawCodeAndAbiResult, GetRawAbiResult, GetScheduledTransactionsResult, GetTableRowsResult, PushTransactionArgs, ReadOnlyTransactResult, GetBlockHeaderStateResult, GetTableByScopeResult, DBSizeGetResult, TraceApiGetBlockResult, GetActionsResult, GetTransactionResult, GetKeyAccountsResult, GetControlledAccountsResult } from './eosjs-rpc-interfaces'; | ||
import { AbiBinToJsonResult, AbiJsonToBinResult, GetAbiResult, GetAccountResult, GetAccountsByAuthorizersResult, GetActivatedProtocolFeaturesParams, GetActivatedProtocolFeaturesResult, GetBlockInfoResult, GetBlockResult, GetCodeResult, GetCodeHashResult, GetCurrencyStatsResult, GetInfoResult, GetProducerScheduleResult, GetProducersResult, GetRawCodeAndAbiResult, GetRawAbiResult, GetScheduledTransactionsResult, GetTableRowsResult, GetSupportedApisResult, PushTransactionArgs, ReadOnlyTransactResult, GetBlockHeaderStateResult, GetTableByScopeResult, DBSizeGetResult, TraceApiGetBlockResult, GetActionsResult, GetTransactionResult, GetKeyAccountsResult, GetControlledAccountsResult } from './eosjs-rpc-interfaces'; | ||
import { Authorization } from './eosjs-serialize'; | ||
@@ -69,2 +69,4 @@ /** Make RPC calls */ | ||
getRequiredKeys(args: AuthorityProviderArgs): Promise<string[]>; | ||
/** Get supported api endpoints for the node */ | ||
get_supported_apis(): Promise<GetSupportedApisResult>; | ||
/** Push a serialized transaction (replaced by send_transaction, but returned format has changed) */ | ||
@@ -77,2 +79,4 @@ push_transaction({ signatures, compression, serializedTransaction, serializedContextFreeData }: PushTransactionArgs): Promise<TransactResult>; | ||
send_transaction({ signatures, compression, serializedTransaction, serializedContextFreeData }: PushTransactionArgs): Promise<TransactResult>; | ||
/** Send a serialized transaction through /v2/chain/send_transaction */ | ||
send_transaction_v2({ signatures, compression, serializedTransaction, serializedContextFreeData }: PushTransactionArgs, returnFailureTraces?: boolean): Promise<TransactResult>; | ||
/** Raw call to `/v1/db_size/get` */ | ||
@@ -79,0 +83,0 @@ db_size_get(): Promise<DBSizeGetResult>; |
@@ -447,2 +447,13 @@ "use strict"; | ||
}; | ||
/** Get supported api endpoints for the node */ | ||
JsonRpc.prototype.get_supported_apis = function () { | ||
return __awaiter(this, void 0, void 0, function () { | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: return [4 /*yield*/, this.fetch('/v1/node/get_supported_apis', {})]; | ||
case 1: return [2 /*return*/, _a.sent()]; | ||
} | ||
}); | ||
}); | ||
}; | ||
/** Push a serialized transaction (replaced by send_transaction, but returned format has changed) */ | ||
@@ -524,2 +535,23 @@ JsonRpc.prototype.push_transaction = function (_a) { | ||
}; | ||
/** Send a serialized transaction through /v2/chain/send_transaction */ | ||
JsonRpc.prototype.send_transaction_v2 = function (_a, returnFailureTraces) { | ||
var signatures = _a.signatures, _b = _a.compression, compression = _b === void 0 ? 0 : _b, serializedTransaction = _a.serializedTransaction, serializedContextFreeData = _a.serializedContextFreeData; | ||
if (returnFailureTraces === void 0) { returnFailureTraces = false; } | ||
return __awaiter(this, void 0, void 0, function () { | ||
return __generator(this, function (_c) { | ||
switch (_c.label) { | ||
case 0: return [4 /*yield*/, this.fetch('/v2/chain/send_transaction', { | ||
transaction: { | ||
signatures: signatures, | ||
compression: compression, | ||
packed_context_free_data: arrayToHex(serializedContextFreeData || new Uint8Array(0)), | ||
packed_trx: arrayToHex(serializedTransaction), | ||
}, | ||
return_failure_traces: returnFailureTraces, | ||
})]; | ||
case 1: return [2 /*return*/, _c.sent()]; | ||
} | ||
}); | ||
}); | ||
}; | ||
/** Raw call to `/v1/db_size/get` */ | ||
@@ -526,0 +558,0 @@ JsonRpc.prototype.db_size_get = function () { |
@@ -485,2 +485,5 @@ /** | ||
} | ||
export interface GetSupportedApisResult { | ||
apis: string[]; | ||
} | ||
/** Arguments for `push_transaction` */ | ||
@@ -487,0 +490,0 @@ export interface PushTransactionArgs { |
{ | ||
"name": "eosjs", | ||
"version": "22.2.0-85-bae9af0", | ||
"version": "22.2.0-86-deee1f8", | ||
"description": "Talk to eos API", | ||
@@ -42,3 +42,3 @@ "main": "dist/index.js", | ||
"@types/jest": "^26.0.24", | ||
"@types/node": "^14.17.17", | ||
"@types/node": "^14.17.18", | ||
"@types/node-fetch": "^2.5.12", | ||
@@ -62,3 +62,3 @@ "@types/pako": "^1.0.2", | ||
"typescript": "^4.4.3", | ||
"webpack": "^5.53.0", | ||
"webpack": "^5.54.0", | ||
"webpack-cli": "^4.8.0" | ||
@@ -65,0 +65,0 @@ }, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
472787
7115