Comparing version 2.3.1 to 2.4.0
@@ -102,2 +102,19 @@ import fs from 'fs'; | ||
}); | ||
test('execute with custom nonce', async () => { | ||
const { result } = await signer.callContract({ | ||
contract_address: signer.address, | ||
entry_point_selector: stark.getSelectorFromName('get_nonce'), | ||
}); | ||
const nonce = parseInt(result[0], 10); | ||
const { code, transaction_hash } = await signer.addTransaction({ | ||
type: 'INVOKE_FUNCTION', | ||
contract_address: erc20Address, | ||
entry_point_selector: stark.getSelectorFromName('transfer'), | ||
calldata: [erc20Address, '10'], | ||
nonce, | ||
}); | ||
expect(code).toBe('TRANSACTION_RECEIVED'); | ||
await defaultProvider.waitForTx(transaction_hash); | ||
}); | ||
}); |
@@ -0,1 +1,7 @@ | ||
# [2.4.0](https://github.com/seanjameshan/starknet.js/compare/v2.3.1...v2.4.0) (2021-12-09) | ||
### Features | ||
- allow custom nonce ([17666de](https://github.com/seanjameshan/starknet.js/commit/17666de94db6875bbf8e88555773b8862a4a32cf)) | ||
## [2.3.1](https://github.com/seanjameshan/starknet.js/compare/v2.3.0...v2.3.1) (2021-12-01) | ||
@@ -2,0 +8,0 @@ |
@@ -28,7 +28,7 @@ import { AddTransactionResponse, CallContractResponse, CallContractTransaction, CompiledContract, GetBlockResponse, GetCodeResponse, GetContractAddressesResponse, GetTransactionResponse, GetTransactionStatusResponse, Transaction } from '../types'; | ||
* | ||
* @param invokeTx - transaction to be invoked | ||
* @param invokeTransaction - transaction to be invoked | ||
* @param blockId | ||
* @returns the result of the function on the smart contract. | ||
*/ | ||
callContract(invokeTx: CallContractTransaction, blockId?: number): Promise<CallContractResponse>; | ||
callContract(invokeTransaction: CallContractTransaction, blockId?: number): Promise<CallContractResponse>; | ||
/** | ||
@@ -87,6 +87,6 @@ * Gets the block information from a block ID. | ||
* | ||
* @param tx - transaction to be invoked | ||
* @param transaction - transaction to be invoked | ||
* @returns a confirmation of invoking a function on the starknet contract | ||
*/ | ||
addTransaction(tx: Transaction): Promise<AddTransactionResponse>; | ||
addTransaction(transaction: Transaction): Promise<AddTransactionResponse>; | ||
/** | ||
@@ -93,0 +93,0 @@ * Deploys a given compiled contract (json) to starknet |
@@ -112,7 +112,7 @@ "use strict"; | ||
* | ||
* @param invokeTx - transaction to be invoked | ||
* @param invokeTransaction - transaction to be invoked | ||
* @param blockId | ||
* @returns the result of the function on the smart contract. | ||
*/ | ||
Provider.prototype.callContract = function (invokeTx, blockId) { | ||
Provider.prototype.callContract = function (invokeTransaction, blockId) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
@@ -122,3 +122,3 @@ var data; | ||
switch (_a.label) { | ||
case 0: return [4 /*yield*/, axios_1.default.post((0, url_join_1.default)(this.feederGatewayUrl, 'call_contract', "?blockId=" + (blockId !== null && blockId !== void 0 ? blockId : 'null')), __assign({ signature: [], calldata: [] }, invokeTx))]; | ||
case 0: return [4 /*yield*/, axios_1.default.post((0, url_join_1.default)(this.feederGatewayUrl, 'call_contract', "?blockId=" + (blockId !== null && blockId !== void 0 ? blockId : 'null')), __assign({ signature: [], calldata: [] }, invokeTransaction))]; | ||
case 1: | ||
@@ -249,6 +249,6 @@ data = (_a.sent()).data; | ||
* | ||
* @param tx - transaction to be invoked | ||
* @param transaction - transaction to be invoked | ||
* @returns a confirmation of invoking a function on the starknet contract | ||
*/ | ||
Provider.prototype.addTransaction = function (tx) { | ||
Provider.prototype.addTransaction = function (transaction) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
@@ -259,5 +259,5 @@ var signature, contract_address_salt, data; | ||
case 0: | ||
signature = tx.type === 'INVOKE_FUNCTION' && (0, stark_1.formatSignature)(tx.signature); | ||
contract_address_salt = tx.type === 'DEPLOY' && (0, number_1.toHex)((0, number_1.toBN)(tx.contract_address_salt)); | ||
return [4 /*yield*/, axios_1.default.post((0, url_join_1.default)(this.gatewayUrl, 'add_transaction'), (0, json_1.stringify)(__assign(__assign(__assign({}, tx), (Array.isArray(signature) && { signature: signature })), (contract_address_salt && { contract_address_salt: contract_address_salt }))), { headers: { 'Content-Type': 'application/json' } })]; | ||
signature = transaction.type === 'INVOKE_FUNCTION' && (0, stark_1.formatSignature)(transaction.signature); | ||
contract_address_salt = transaction.type === 'DEPLOY' && (0, number_1.toHex)((0, number_1.toBN)(transaction.contract_address_salt)); | ||
return [4 /*yield*/, axios_1.default.post((0, url_join_1.default)(this.gatewayUrl, 'add_transaction'), (0, json_1.stringify)(__assign(__assign(__assign({}, transaction), (Array.isArray(signature) && { signature: signature })), (contract_address_salt && { contract_address_salt: contract_address_salt }))), { headers: { 'Content-Type': 'application/json' } })]; | ||
case 1: | ||
@@ -264,0 +264,0 @@ data = (_a.sent()).data; |
@@ -19,7 +19,7 @@ import type { AddTransactionResponse, CallContractResponse, CallContractTransaction, CompiledContract, GetBlockResponse, GetCodeResponse, GetContractAddressesResponse, GetTransactionResponse, GetTransactionStatusResponse, Transaction } from '../types'; | ||
* | ||
* @param invokeTx - transaction to be invoked | ||
* @param invokeTransaction - transaction to be invoked | ||
* @param blockId | ||
* @returns the result of the function on the smart contract. | ||
*/ | ||
abstract callContract(invokeTx: CallContractTransaction, blockId?: number): Promise<CallContractResponse>; | ||
abstract callContract(invokeTransaction: CallContractTransaction, blockId?: number): Promise<CallContractResponse>; | ||
/** | ||
@@ -78,6 +78,6 @@ * Gets the block information from a block ID. | ||
* | ||
* @param tx - transaction to be invoked | ||
* @param transaction - transaction to be invoked | ||
* @returns a confirmation of invoking a function on the starknet contract | ||
*/ | ||
abstract addTransaction(tx: Transaction): Promise<AddTransactionResponse>; | ||
abstract addTransaction(transaction: Transaction): Promise<AddTransactionResponse>; | ||
/** | ||
@@ -84,0 +84,0 @@ * Deploys a given compiled contract (json) to starknet |
@@ -13,6 +13,6 @@ import { Provider } from '../provider'; | ||
* | ||
* @param tx - transaction to be invoked | ||
* @param transaction - transaction to be invoked | ||
* @returns a confirmation of invoking a function on the starknet contract | ||
*/ | ||
addTransaction(tx: Transaction): Promise<AddTransactionResponse>; | ||
addTransaction(transaction: Transaction): Promise<AddTransactionResponse>; | ||
} |
@@ -103,23 +103,28 @@ "use strict"; | ||
* | ||
* @param tx - transaction to be invoked | ||
* @param transaction - transaction to be invoked | ||
* @returns a confirmation of invoking a function on the starknet contract | ||
*/ | ||
Signer.prototype.addTransaction = function (tx) { | ||
Signer.prototype.addTransaction = function (transaction) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
var result, nonceBn, calldataDecimal, msgHash, _a, r, s; | ||
var nonceBn, result, calldataDecimal, msgHash, _a, r, s; | ||
return __generator(this, function (_b) { | ||
switch (_b.label) { | ||
case 0: | ||
if (tx.type === 'DEPLOY') | ||
return [2 /*return*/, _super.prototype.addTransaction.call(this, tx)]; | ||
(0, minimalistic_assert_1.default)(!tx.signature, "Adding signatures to a signer tx currently isn't supported"); | ||
return [4 /*yield*/, this.callContract({ | ||
contract_address: this.address, | ||
entry_point_selector: (0, stark_1.getSelectorFromName)('get_nonce'), | ||
})]; | ||
case 1: | ||
if (transaction.type === 'DEPLOY') | ||
return [2 /*return*/, _super.prototype.addTransaction.call(this, transaction)]; | ||
(0, minimalistic_assert_1.default)(!transaction.signature, "Adding signatures to a signer transaction currently isn't supported"); | ||
if (!transaction.nonce) return [3 /*break*/, 1]; | ||
nonceBn = (0, number_1.toBN)(transaction.nonce); | ||
return [3 /*break*/, 3]; | ||
case 1: return [4 /*yield*/, this.callContract({ | ||
contract_address: this.address, | ||
entry_point_selector: (0, stark_1.getSelectorFromName)('get_nonce'), | ||
})]; | ||
case 2: | ||
result = (_b.sent()).result; | ||
nonceBn = (0, number_1.toBN)(result[0]); | ||
calldataDecimal = (tx.calldata || []).map(function (x) { return (0, number_1.toBN)(x).toString(); }); | ||
msgHash = (0, encode_1.addHexPrefix)((0, hash_1.hashMessage)(this.address, tx.contract_address, tx.entry_point_selector, calldataDecimal, nonceBn.toString())); | ||
_b.label = 3; | ||
case 3: | ||
calldataDecimal = (transaction.calldata || []).map(function (x) { return (0, number_1.toBN)(x).toString(); }); | ||
msgHash = (0, encode_1.addHexPrefix)((0, hash_1.hashMessage)(this.address, transaction.contract_address, transaction.entry_point_selector, calldataDecimal, nonceBn.toString())); | ||
_a = (0, ellipticCurve_1.sign)(this.keyPair, msgHash), r = _a.r, s = _a.s; | ||
@@ -130,4 +135,4 @@ return [2 /*return*/, _super.prototype.addTransaction.call(this, { | ||
calldata: __spreadArray(__spreadArray([ | ||
tx.contract_address, | ||
tx.entry_point_selector, | ||
transaction.contract_address, | ||
transaction.entry_point_selector, | ||
calldataDecimal.length.toString() | ||
@@ -134,0 +139,0 @@ ], __read(calldataDecimal), false), [ |
@@ -10,6 +10,6 @@ import { Provider } from '../provider'; | ||
* | ||
* @param tx - transaction to be invoked | ||
* @param transaction - transaction to be invoked | ||
* @returns a confirmation of invoking a function on the starknet contract | ||
*/ | ||
abstract addTransaction(tx: Transaction): Promise<AddTransactionResponse>; | ||
abstract addTransaction(transaction: Transaction): Promise<AddTransactionResponse>; | ||
} |
@@ -10,3 +10,3 @@ import type { ec as EC } from 'elliptic'; | ||
export declare type Status = 'NOT_RECEIVED' | 'RECEIVED' | 'PENDING' | 'REJECTED' | 'ACCEPTED_ONCHAIN'; | ||
export declare type TxStatus = 'TRANSACTION_RECEIVED'; | ||
export declare type TransactionStatus = 'TRANSACTION_RECEIVED'; | ||
export declare type Type = 'DEPLOY' | 'INVOKE_FUNCTION'; | ||
@@ -48,2 +48,3 @@ export declare type EntryPointType = 'EXTERNAL'; | ||
constructor_calldata: string[]; | ||
nonce?: BigNumberish; | ||
}; | ||
@@ -57,2 +58,3 @@ export declare type InvokeFunctionTransaction = { | ||
calldata?: string[]; | ||
nonce?: BigNumberish; | ||
}; | ||
@@ -106,5 +108,5 @@ export declare type CallContractTransaction = Omit<InvokeFunctionTransaction, 'type'>; | ||
export declare type AddTransactionResponse = { | ||
code: TxStatus; | ||
code: TransactionStatus; | ||
transaction_hash: string; | ||
address?: string; | ||
}; |
{ | ||
"name": "starknet", | ||
"version": "2.3.1", | ||
"version": "2.4.0", | ||
"description": "JavaScript library for StarkNet", | ||
@@ -26,2 +26,3 @@ "main": "dist/index.js", | ||
], | ||
"repository": "github:seanjameshan/starknet.js", | ||
"author": "Sean Han", | ||
@@ -28,0 +29,0 @@ "license": "MIT", |
@@ -43,7 +43,10 @@ import { | ||
* | ||
* @param invokeTx - transaction to be invoked | ||
* @param invokeTransaction - transaction to be invoked | ||
* @param blockId | ||
* @returns the result of the function on the smart contract. | ||
*/ | ||
callContract(invokeTx: CallContractTransaction, blockId?: number): Promise<CallContractResponse>; | ||
callContract( | ||
invokeTransaction: CallContractTransaction, | ||
blockId?: number | ||
): Promise<CallContractResponse>; | ||
/** | ||
@@ -102,6 +105,6 @@ * Gets the block information from a block ID. | ||
* | ||
* @param tx - transaction to be invoked | ||
* @param transaction - transaction to be invoked | ||
* @returns a confirmation of invoking a function on the starknet contract | ||
*/ | ||
addTransaction(tx: Transaction): Promise<AddTransactionResponse>; | ||
addTransaction(transaction: Transaction): Promise<AddTransactionResponse>; | ||
/** | ||
@@ -108,0 +111,0 @@ * Deploys a given compiled contract (json) to starknet |
@@ -222,7 +222,7 @@ 'use strict'; | ||
* | ||
* @param invokeTx - transaction to be invoked | ||
* @param invokeTransaction - transaction to be invoked | ||
* @param blockId | ||
* @returns the result of the function on the smart contract. | ||
*/ | ||
Provider.prototype.callContract = function (invokeTx, blockId) { | ||
Provider.prototype.callContract = function (invokeTransaction, blockId) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
@@ -241,3 +241,3 @@ var data; | ||
), | ||
__assign({ signature: [], calldata: [] }, invokeTx) | ||
__assign({ signature: [], calldata: [] }, invokeTransaction) | ||
), | ||
@@ -426,6 +426,6 @@ ]; | ||
* | ||
* @param tx - transaction to be invoked | ||
* @param transaction - transaction to be invoked | ||
* @returns a confirmation of invoking a function on the starknet contract | ||
*/ | ||
Provider.prototype.addTransaction = function (tx) { | ||
Provider.prototype.addTransaction = function (transaction) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
@@ -436,6 +436,8 @@ var signature, contract_address_salt, data; | ||
case 0: | ||
signature = tx.type === 'INVOKE_FUNCTION' && (0, stark_1.formatSignature)(tx.signature); | ||
signature = | ||
transaction.type === 'INVOKE_FUNCTION' && | ||
(0, stark_1.formatSignature)(transaction.signature); | ||
contract_address_salt = | ||
tx.type === 'DEPLOY' && | ||
(0, number_1.toHex)((0, number_1.toBN)(tx.contract_address_salt)); | ||
transaction.type === 'DEPLOY' && | ||
(0, number_1.toHex)((0, number_1.toBN)(transaction.contract_address_salt)); | ||
return [ | ||
@@ -448,3 +450,3 @@ 4 /*yield*/, | ||
__assign( | ||
__assign({}, tx), | ||
__assign({}, transaction), | ||
Array.isArray(signature) && { signature: signature } | ||
@@ -451,0 +453,0 @@ ), |
@@ -30,3 +30,3 @@ import type { | ||
* | ||
* @param invokeTx - transaction to be invoked | ||
* @param invokeTransaction - transaction to be invoked | ||
* @param blockId | ||
@@ -36,3 +36,3 @@ * @returns the result of the function on the smart contract. | ||
abstract callContract( | ||
invokeTx: CallContractTransaction, | ||
invokeTransaction: CallContractTransaction, | ||
blockId?: number | ||
@@ -93,6 +93,6 @@ ): Promise<CallContractResponse>; | ||
* | ||
* @param tx - transaction to be invoked | ||
* @param transaction - transaction to be invoked | ||
* @returns a confirmation of invoking a function on the starknet contract | ||
*/ | ||
abstract addTransaction(tx: Transaction): Promise<AddTransactionResponse>; | ||
abstract addTransaction(transaction: Transaction): Promise<AddTransactionResponse>; | ||
/** | ||
@@ -99,0 +99,0 @@ * Deploys a given compiled contract (json) to starknet |
@@ -13,6 +13,6 @@ import { Provider } from '../provider'; | ||
* | ||
* @param tx - transaction to be invoked | ||
* @param transaction - transaction to be invoked | ||
* @returns a confirmation of invoking a function on the starknet contract | ||
*/ | ||
addTransaction(tx: Transaction): Promise<AddTransactionResponse>; | ||
addTransaction(transaction: Transaction): Promise<AddTransactionResponse>; | ||
} |
@@ -219,15 +219,19 @@ 'use strict'; | ||
* | ||
* @param tx - transaction to be invoked | ||
* @param transaction - transaction to be invoked | ||
* @returns a confirmation of invoking a function on the starknet contract | ||
*/ | ||
Signer.prototype.addTransaction = function (tx) { | ||
Signer.prototype.addTransaction = function (transaction) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
var result, nonceBn, calldataDecimal, msgHash, _a, r, s; | ||
var nonceBn, result, calldataDecimal, msgHash, _a, r, s; | ||
return __generator(this, function (_b) { | ||
switch (_b.label) { | ||
case 0: | ||
if (tx.type === 'DEPLOY') | ||
return [2 /*return*/, _super.prototype.addTransaction.call(this, tx)]; | ||
if (transaction.type === 'DEPLOY') | ||
return [2 /*return*/, _super.prototype.addTransaction.call(this, transaction)]; | ||
(0, | ||
minimalistic_assert_1.default)(!tx.signature, "Adding signatures to a signer tx currently isn't supported"); | ||
minimalistic_assert_1.default)(!transaction.signature, "Adding signatures to a signer transaction currently isn't supported"); | ||
if (!transaction.nonce) return [3 /*break*/, 1]; | ||
nonceBn = (0, number_1.toBN)(transaction.nonce); | ||
return [3 /*break*/, 3]; | ||
case 1: | ||
return [ | ||
@@ -240,6 +244,8 @@ 4 /*yield*/, | ||
]; | ||
case 1: | ||
case 2: | ||
result = _b.sent().result; | ||
nonceBn = (0, number_1.toBN)(result[0]); | ||
calldataDecimal = (tx.calldata || []).map(function (x) { | ||
_b.label = 3; | ||
case 3: | ||
calldataDecimal = (transaction.calldata || []).map(function (x) { | ||
return (0, number_1.toBN)(x).toString(); | ||
@@ -250,4 +256,4 @@ }); | ||
this.address, | ||
tx.contract_address, | ||
tx.entry_point_selector, | ||
transaction.contract_address, | ||
transaction.entry_point_selector, | ||
calldataDecimal, | ||
@@ -266,4 +272,4 @@ nonceBn.toString() | ||
[ | ||
tx.contract_address, | ||
tx.entry_point_selector, | ||
transaction.contract_address, | ||
transaction.entry_point_selector, | ||
calldataDecimal.length.toString(), | ||
@@ -270,0 +276,0 @@ ], |
@@ -10,6 +10,6 @@ import { Provider } from '../provider'; | ||
* | ||
* @param tx - transaction to be invoked | ||
* @param transaction - transaction to be invoked | ||
* @returns a confirmation of invoking a function on the starknet contract | ||
*/ | ||
abstract addTransaction(tx: Transaction): Promise<AddTransactionResponse>; | ||
abstract addTransaction(transaction: Transaction): Promise<AddTransactionResponse>; | ||
} |
@@ -86,3 +86,3 @@ import axios from 'axios'; | ||
* | ||
* @param invokeTx - transaction to be invoked | ||
* @param invokeTransaction - transaction to be invoked | ||
* @param blockId | ||
@@ -92,3 +92,3 @@ * @returns the result of the function on the smart contract. | ||
public async callContract( | ||
invokeTx: CallContractTransaction, | ||
invokeTransaction: CallContractTransaction, | ||
blockId?: number | ||
@@ -101,3 +101,3 @@ ): Promise<CallContractResponse> { | ||
calldata: [], | ||
...invokeTx, | ||
...invokeTransaction, | ||
} | ||
@@ -210,8 +210,10 @@ ); | ||
* | ||
* @param tx - transaction to be invoked | ||
* @param transaction - transaction to be invoked | ||
* @returns a confirmation of invoking a function on the starknet contract | ||
*/ | ||
public async addTransaction(tx: Transaction): Promise<AddTransactionResponse> { | ||
const signature = tx.type === 'INVOKE_FUNCTION' && formatSignature(tx.signature); | ||
const contract_address_salt = tx.type === 'DEPLOY' && toHex(toBN(tx.contract_address_salt)); | ||
public async addTransaction(transaction: Transaction): Promise<AddTransactionResponse> { | ||
const signature = | ||
transaction.type === 'INVOKE_FUNCTION' && formatSignature(transaction.signature); | ||
const contract_address_salt = | ||
transaction.type === 'DEPLOY' && toHex(toBN(transaction.contract_address_salt)); | ||
@@ -221,3 +223,3 @@ const { data } = await axios.post<AddTransactionResponse>( | ||
stringify({ | ||
...tx, // the tx can contain BigInts, so we use our own `stringify` | ||
...transaction, // the tx can contain BigInts, so we use our own `stringify` | ||
...(Array.isArray(signature) && { signature }), // not needed on deploy tx | ||
@@ -224,0 +226,0 @@ ...(contract_address_salt && { contract_address_salt }), // not needed on invoke tx |
@@ -35,3 +35,3 @@ import type { | ||
* | ||
* @param invokeTx - transaction to be invoked | ||
* @param invokeTransaction - transaction to be invoked | ||
* @param blockId | ||
@@ -41,3 +41,3 @@ * @returns the result of the function on the smart contract. | ||
public abstract callContract( | ||
invokeTx: CallContractTransaction, | ||
invokeTransaction: CallContractTransaction, | ||
blockId?: number | ||
@@ -109,6 +109,6 @@ ): Promise<CallContractResponse>; | ||
* | ||
* @param tx - transaction to be invoked | ||
* @param transaction - transaction to be invoked | ||
* @returns a confirmation of invoking a function on the starknet contract | ||
*/ | ||
public abstract addTransaction(tx: Transaction): Promise<AddTransactionResponse>; | ||
public abstract addTransaction(transaction: Transaction): Promise<AddTransactionResponse>; | ||
@@ -115,0 +115,0 @@ /** |
@@ -28,22 +28,31 @@ import assert from 'minimalistic-assert'; | ||
* | ||
* @param tx - transaction to be invoked | ||
* @param transaction - transaction to be invoked | ||
* @returns a confirmation of invoking a function on the starknet contract | ||
*/ | ||
public override async addTransaction(tx: Transaction): Promise<AddTransactionResponse> { | ||
if (tx.type === 'DEPLOY') return super.addTransaction(tx); | ||
public override async addTransaction(transaction: Transaction): Promise<AddTransactionResponse> { | ||
if (transaction.type === 'DEPLOY') return super.addTransaction(transaction); | ||
assert(!tx.signature, "Adding signatures to a signer tx currently isn't supported"); | ||
assert( | ||
!transaction.signature, | ||
"Adding signatures to a signer transaction currently isn't supported" | ||
); | ||
const { result } = await this.callContract({ | ||
contract_address: this.address, | ||
entry_point_selector: getSelectorFromName('get_nonce'), | ||
}); | ||
const nonceBn = toBN(result[0]); | ||
const calldataDecimal = (tx.calldata || []).map((x) => toBN(x).toString()); | ||
let nonceBn; | ||
if (transaction.nonce) { | ||
nonceBn = toBN(transaction.nonce); | ||
} else { | ||
const { result } = await this.callContract({ | ||
contract_address: this.address, | ||
entry_point_selector: getSelectorFromName('get_nonce'), | ||
}); | ||
nonceBn = toBN(result[0]); | ||
} | ||
const calldataDecimal = (transaction.calldata || []).map((x) => toBN(x).toString()); | ||
const msgHash = addHexPrefix( | ||
hashMessage( | ||
this.address, | ||
tx.contract_address, | ||
tx.entry_point_selector, | ||
transaction.contract_address, | ||
transaction.entry_point_selector, | ||
calldataDecimal, | ||
@@ -60,4 +69,4 @@ nonceBn.toString() | ||
calldata: [ | ||
tx.contract_address, | ||
tx.entry_point_selector, | ||
transaction.contract_address, | ||
transaction.entry_point_selector, | ||
calldataDecimal.length.toString(), | ||
@@ -64,0 +73,0 @@ ...calldataDecimal, |
@@ -11,6 +11,8 @@ import { Provider } from '../provider'; | ||
* | ||
* @param tx - transaction to be invoked | ||
* @param transaction - transaction to be invoked | ||
* @returns a confirmation of invoking a function on the starknet contract | ||
*/ | ||
public abstract override addTransaction(tx: Transaction): Promise<AddTransactionResponse>; | ||
public abstract override addTransaction( | ||
transaction: Transaction | ||
): Promise<AddTransactionResponse>; | ||
} |
@@ -14,3 +14,3 @@ import type { ec as EC } from 'elliptic'; | ||
export type Status = 'NOT_RECEIVED' | 'RECEIVED' | 'PENDING' | 'REJECTED' | 'ACCEPTED_ONCHAIN'; | ||
export type TxStatus = 'TRANSACTION_RECEIVED'; | ||
export type TransactionStatus = 'TRANSACTION_RECEIVED'; | ||
export type Type = 'DEPLOY' | 'INVOKE_FUNCTION'; | ||
@@ -55,2 +55,3 @@ export type EntryPointType = 'EXTERNAL'; | ||
constructor_calldata: string[]; | ||
nonce?: BigNumberish; | ||
}; | ||
@@ -65,2 +66,3 @@ | ||
calldata?: string[]; | ||
nonce?: BigNumberish; | ||
}; | ||
@@ -122,5 +124,5 @@ | ||
export type AddTransactionResponse = { | ||
code: TxStatus; | ||
code: TransactionStatus; | ||
transaction_hash: string; | ||
address?: string; | ||
}; |
@@ -16,3 +16,3 @@ import type { ec as EC } from 'elliptic'; | ||
| 'ACCEPTED_ONCHAIN'; | ||
export declare type TxStatus = 'TRANSACTION_RECEIVED'; | ||
export declare type TransactionStatus = 'TRANSACTION_RECEIVED'; | ||
export declare type Type = 'DEPLOY' | 'INVOKE_FUNCTION'; | ||
@@ -54,2 +54,3 @@ export declare type EntryPointType = 'EXTERNAL'; | ||
constructor_calldata: string[]; | ||
nonce?: BigNumberish; | ||
}; | ||
@@ -63,2 +64,3 @@ export declare type InvokeFunctionTransaction = { | ||
calldata?: string[]; | ||
nonce?: BigNumberish; | ||
}; | ||
@@ -112,5 +114,5 @@ export declare type CallContractTransaction = Omit<InvokeFunctionTransaction, 'type'>; | ||
export declare type AddTransactionResponse = { | ||
code: TxStatus; | ||
code: TransactionStatus; | ||
transaction_hash: string; | ||
address?: string; | ||
}; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
5373876
139481