From f8154eafdc836ca0f18c217c33a21511bef612f6 Mon Sep 17 00:00:00 2001 From: Eduardo Marchena Date: Thu, 21 Dec 2023 12:57:17 -0500 Subject: [PATCH] fix --- package.json | 5 +- src/lacchain-provider.ts | 2 - src/lacchain-signer.ts | 22 +- src/lacchain-transaction-request.ts | 84 +++++-- src/lacchain-transaction.ts | 80 ++++-- src/test/e2e/deploy-and-tx.test.ts | 25 +- src/test/e2e/test-contract.ts | 228 +++++++++--------- src/test/fixtures.ts | 7 +- src/test/index.test.ts | 2 - src/test/lacchain-provider.test.ts | 2 - src/test/lacchain-signer.test.ts | 2 - src/test/lacchain-transaction-request.test.ts | 25 +- src/test/lacchain-transaction.test.ts | 10 +- 13 files changed, 291 insertions(+), 203 deletions(-) diff --git a/package.json b/package.json index c226451..4003127 100644 --- a/package.json +++ b/package.json @@ -9,9 +9,8 @@ "build": "tsc", "format": "prettier --write \"src/**/*.ts\" \"src/**/*.js\"", "prepare": "npm run build", - "prepublishOnly": "npm test && npm run lint", - "preversion": "npm run lint", - "version": "npm run format && git add -A src", + "prepublishOnly": "npm test ", + "version": "git add -A src", "postversion": "git push && git push --tags", "test:e2e": "jest --config jest.config.e2e.js", "test:watch": "jest --watch" diff --git a/src/lacchain-provider.ts b/src/lacchain-provider.ts index cac42ff..f3e5ef9 100644 --- a/src/lacchain-provider.ts +++ b/src/lacchain-provider.ts @@ -11,9 +11,7 @@ import { import { LacchainTransaction } from './lacchain-transaction'; - export class LacchainProvider extends JsonRpcProvider { - constructor( url: string | FetchRequest, network?: Networkish, diff --git a/src/lacchain-signer.ts b/src/lacchain-signer.ts index 8b93c80..759620a 100644 --- a/src/lacchain-signer.ts +++ b/src/lacchain-signer.ts @@ -8,14 +8,12 @@ import { getAddress, Transaction, TransactionLike, - TransactionRequest + TransactionRequest, } from 'ethers'; import { LacchainTransactionRequest } from './lacchain-transaction-request'; - export class LacchainSigner extends Wallet { - constructor( privateKey: string | SigningKey, provider: Provider, @@ -25,11 +23,17 @@ export class LacchainSigner extends Wallet { super(privateKey, provider); } - async signTransaction(transactionRequest: TransactionRequest): Promise { + async signTransaction( + transactionRequest: TransactionRequest, + ): Promise { // Replace any Addressable or ENS name with an address const { to, from } = await resolveProperties({ - to: transactionRequest.to ? resolveAddress(transactionRequest.to, this.provider) : undefined, - from: transactionRequest.from ? resolveAddress(transactionRequest.from, this.provider) : undefined, + to: transactionRequest.to + ? resolveAddress(transactionRequest.to, this.provider) + : undefined, + from: transactionRequest.from + ? resolveAddress(transactionRequest.from, this.provider) + : undefined, }); if (to != null) { @@ -52,7 +56,11 @@ export class LacchainSigner extends Wallet { const btx = Transaction.from( >( - new LacchainTransactionRequest(transactionRequest, this._aNodeAddress, this._aExpirationTime) + new LacchainTransactionRequest( + transactionRequest, + this._aNodeAddress, + this._aExpirationTime, + ) ), ); diff --git a/src/lacchain-transaction-request.ts b/src/lacchain-transaction-request.ts index 4cb67b3..4c08665 100644 --- a/src/lacchain-transaction-request.ts +++ b/src/lacchain-transaction-request.ts @@ -1,36 +1,72 @@ -import { AbiCoder, AccessListish, AddressLike, BigNumberish, BlockTag, TransactionRequest } -from 'ethers'; - - +import { + AbiCoder, + AccessListish, + AddressLike, + BigNumberish, + BlockTag, + TransactionRequest, +} from 'ethers'; export class LacchainTransactionRequest implements TransactionRequest { - constructor( private _aOriginalTransactionRequest: TransactionRequest, private _aNodeAddress: string, - private _aExpirationTime: number + private _aExpirationTime: number, ) {} get data(): any | string { - return this._aOriginalTransactionRequest.data + AbiCoder.defaultAbiCoder().encode( - ["address", "uint256"], - [this._aNodeAddress, this._aExpirationTime] - ).substring(2);; + return ( + this._aOriginalTransactionRequest.data + + AbiCoder.defaultAbiCoder() + .encode( + ['address', 'uint256'], + [this._aNodeAddress, this._aExpirationTime], + ) + .substring(2) + ); } - get chainId(): any | BigNumberish { return 0; } + get chainId(): any | BigNumberish { + return 0; + } - get type(): any | number { return this._aOriginalTransactionRequest.type; } - get to(): any | AddressLike { return this._aOriginalTransactionRequest.to; } - get from(): any | AddressLike { return this._aOriginalTransactionRequest.from; } - get nonce(): any | number { return this._aOriginalTransactionRequest.nonce; } - get gasLimit(): any | BigNumberish { return this._aOriginalTransactionRequest.gasLimit; } - get gasPrice(): any | BigNumberish { return this._aOriginalTransactionRequest.gasPrice; } - get maxPriorityFeePerGas(): any | BigNumberish { return this._aOriginalTransactionRequest.maxPriorityFeePerGas; } - get maxFeePerGas(): any | BigNumberish { return this._aOriginalTransactionRequest.maxFeePerGas; } - get value(): any | BigNumberish { return this._aOriginalTransactionRequest.value; } - get accessList(): any | AccessListish { return this._aOriginalTransactionRequest.accessList; } - get customData(): any { return this._aOriginalTransactionRequest.customData; } - get blockTag(): undefined | BlockTag { return this._aOriginalTransactionRequest.blockTag; } - get enableCcipRead(): undefined | boolean { return this._aOriginalTransactionRequest.enableCcipRead; } + get type(): any | number { + return this._aOriginalTransactionRequest.type; + } + get to(): any | AddressLike { + return this._aOriginalTransactionRequest.to; + } + get from(): any | AddressLike { + return this._aOriginalTransactionRequest.from; + } + get nonce(): any | number { + return this._aOriginalTransactionRequest.nonce; + } + get gasLimit(): any | BigNumberish { + return this._aOriginalTransactionRequest.gasLimit; + } + get gasPrice(): any | BigNumberish { + return this._aOriginalTransactionRequest.gasPrice; + } + get maxPriorityFeePerGas(): any | BigNumberish { + return this._aOriginalTransactionRequest.maxPriorityFeePerGas; + } + get maxFeePerGas(): any | BigNumberish { + return this._aOriginalTransactionRequest.maxFeePerGas; + } + get value(): any | BigNumberish { + return this._aOriginalTransactionRequest.value; + } + get accessList(): any | AccessListish { + return this._aOriginalTransactionRequest.accessList; + } + get customData(): any { + return this._aOriginalTransactionRequest.customData; + } + get blockTag(): undefined | BlockTag { + return this._aOriginalTransactionRequest.blockTag; + } + get enableCcipRead(): undefined | boolean { + return this._aOriginalTransactionRequest.enableCcipRead; + } } diff --git a/src/lacchain-transaction.ts b/src/lacchain-transaction.ts index 7dc7b76..96ead6b 100644 --- a/src/lacchain-transaction.ts +++ b/src/lacchain-transaction.ts @@ -1,31 +1,67 @@ import { AccessList, Signature, Transaction, TransactionLike } from 'ethers'; - - export class LacchainTransaction implements TransactionLike { - - constructor(private _aOriginalTx: Transaction, private _aHashTx: string) {} + constructor( + private _aOriginalTx: Transaction, + private _aHashTx: string, + ) {} get hash(): null | string { return this._aHashTx; } - get type(): null | number { return this._aOriginalTx.type; } - get typeName(): null | string { return this._aOriginalTx.typeName; } - get to(): null | string { return this._aOriginalTx.to; } - get nonce(): number { return this._aOriginalTx.nonce; } - get gasLimit(): bigint { return this._aOriginalTx.gasLimit; } - get gasPrice(): null | bigint { return this._aOriginalTx.gasPrice; } - get maxPriorityFeePerGas(): null | bigint { return this._aOriginalTx.maxPriorityFeePerGas; } - get maxFeePerGas(): null | bigint { return this._aOriginalTx.maxFeePerGas; } - get data(): string { return this._aOriginalTx.data; } - get value(): bigint { return this._aOriginalTx.value; } - get chainId(): bigint { return this._aOriginalTx.chainId; } - get signature(): null | Signature { return this._aOriginalTx.signature || null; } - get accessList(): null | AccessList { return this._aOriginalTx.accessList } - get unsignedHash(): string { return this._aOriginalTx.unsignedHash; } - get from(): null | string { return this._aOriginalTx.from; } - get fromPublicKey(): null | string { return this._aOriginalTx.fromPublicKey; } - get serialized(): string { return this._aOriginalTx.serialized; } - get unsignedSerialized(): string { return this._aOriginalTx.unsignedSerialized; } + get type(): null | number { + return this._aOriginalTx.type; + } + get typeName(): null | string { + return this._aOriginalTx.typeName; + } + get to(): null | string { + return this._aOriginalTx.to; + } + get nonce(): number { + return this._aOriginalTx.nonce; + } + get gasLimit(): bigint { + return this._aOriginalTx.gasLimit; + } + get gasPrice(): null | bigint { + return this._aOriginalTx.gasPrice; + } + get maxPriorityFeePerGas(): null | bigint { + return this._aOriginalTx.maxPriorityFeePerGas; + } + get maxFeePerGas(): null | bigint { + return this._aOriginalTx.maxFeePerGas; + } + get data(): string { + return this._aOriginalTx.data; + } + get value(): bigint { + return this._aOriginalTx.value; + } + get chainId(): bigint { + return this._aOriginalTx.chainId; + } + get signature(): null | Signature { + return this._aOriginalTx.signature || null; + } + get accessList(): null | AccessList { + return this._aOriginalTx.accessList; + } + get unsignedHash(): string { + return this._aOriginalTx.unsignedHash; + } + get from(): null | string { + return this._aOriginalTx.from; + } + get fromPublicKey(): null | string { + return this._aOriginalTx.fromPublicKey; + } + get serialized(): string { + return this._aOriginalTx.serialized; + } + get unsignedSerialized(): string { + return this._aOriginalTx.unsignedSerialized; + } } diff --git a/src/test/e2e/deploy-and-tx.test.ts b/src/test/e2e/deploy-and-tx.test.ts index 42a07cd..d2e62cb 100644 --- a/src/test/e2e/deploy-and-tx.test.ts +++ b/src/test/e2e/deploy-and-tx.test.ts @@ -6,44 +6,45 @@ import { LacchainProvider } from '../../lacchain-provider'; import { LacchainSigner } from '../../lacchain-signer'; import { aPrivateKey, anExpirationTime, testAddresses } from '../fixtures'; - - describe('e2e Provider & Signer re', () => { - dotenv.config(); const { RPC_URL, NODE_ADDRESS, TRUSTED_FORWARDER } = env; - const signer: LacchainSigner = new LacchainSigner( aPrivateKey, new LacchainProvider(RPC_URL!), NODE_ADDRESS!, - anExpirationTime + anExpirationTime, ); -console.log("set network") + console.log('set network'); const _deployContract = async () => { const contractFactory = new ContractFactory( aTestContract.abi, aTestContract.bytecode, - signer + signer, ); - - const contract = await contractFactory.deploy(signer.address, TRUSTED_FORWARDER!); - + + const contract = await contractFactory.deploy( + signer.address, + TRUSTED_FORWARDER!, + ); + return await contract.deploymentTransaction()?.wait(); }; test('Deploy & Transaction re', async () => { const txReceipt = await _deployContract(); const contractAddress = txReceipt?.contractAddress || ''; - console.log(contractAddress) + console.log(contractAddress); expect(contractAddress).toBeTruthy(); const contract = new Contract(contractAddress, aTestContract.abi, signer); await (await contract.add(testAddresses[0], testAddresses[1])).wait(); - expect(await contract.exists(testAddresses[0], testAddresses[1])).toEqual(true); + expect(await contract.exists(testAddresses[0], testAddresses[1])).toEqual( + true, + ); }, 100000000); }); diff --git a/src/test/e2e/test-contract.ts b/src/test/e2e/test-contract.ts index cf825cd..025ba7b 100644 --- a/src/test/e2e/test-contract.ts +++ b/src/test/e2e/test-contract.ts @@ -1,166 +1,168 @@ export const aTestContract = { - "_format": "hh-sol-artifact-1", - "contractName": "Whitelist", - "sourceName": "contracts/Whitelist.sol", - "abi": [ + _format: 'hh-sol-artifact-1', + contractName: 'Whitelist', + sourceName: 'contracts/Whitelist.sol', + abi: [ { - "inputs": [ + inputs: [ { - "internalType": "address", - "name": "owner_", - "type": "address" + internalType: 'address', + name: 'owner_', + type: 'address', }, { - "internalType": "address", - "name": "trustedForwarder_", - "type": "address" - } + internalType: 'address', + name: 'trustedForwarder_', + type: 'address', + }, ], - "stateMutability": "nonpayable", - "type": "constructor" + stateMutability: 'nonpayable', + type: 'constructor', }, { - "inputs": [], - "name": "AddressZero", - "type": "error" + inputs: [], + name: 'AddressZero', + type: 'error', }, { - "inputs": [ + inputs: [ { - "internalType": "address", - "name": "owner", - "type": "address" - } + internalType: 'address', + name: 'owner', + type: 'address', + }, ], - "name": "OwnableInvalidOwner", - "type": "error" + name: 'OwnableInvalidOwner', + type: 'error', }, { - "inputs": [ + inputs: [ { - "internalType": "address", - "name": "account", - "type": "address" - } + internalType: 'address', + name: 'account', + type: 'address', + }, ], - "name": "OwnableUnauthorizedAccount", - "type": "error" + name: 'OwnableUnauthorizedAccount', + type: 'error', }, { - "anonymous": false, - "inputs": [ + anonymous: false, + inputs: [ { - "indexed": true, - "internalType": "address", - "name": "previousOwner", - "type": "address" + indexed: true, + internalType: 'address', + name: 'previousOwner', + type: 'address', }, { - "indexed": true, - "internalType": "address", - "name": "newOwner", - "type": "address" - } + indexed: true, + internalType: 'address', + name: 'newOwner', + type: 'address', + }, ], - "name": "OwnershipTransferred", - "type": "event" + name: 'OwnershipTransferred', + type: 'event', }, { - "inputs": [ + inputs: [ { - "internalType": "address", - "name": "anUser", - "type": "address" + internalType: 'address', + name: 'anUser', + type: 'address', }, { - "internalType": "address", - "name": "aToken", - "type": "address" - } + internalType: 'address', + name: 'aToken', + type: 'address', + }, ], - "name": "add", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" + name: 'add', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', }, { - "inputs": [ + inputs: [ { - "internalType": "address", - "name": "anUser", - "type": "address" + internalType: 'address', + name: 'anUser', + type: 'address', }, { - "internalType": "address", - "name": "aToken", - "type": "address" - } + internalType: 'address', + name: 'aToken', + type: 'address', + }, ], - "name": "exists", - "outputs": [ + name: 'exists', + outputs: [ { - "internalType": "bool", - "name": "", - "type": "bool" - } + internalType: 'bool', + name: '', + type: 'bool', + }, ], - "stateMutability": "view", - "type": "function" + stateMutability: 'view', + type: 'function', }, { - "inputs": [], - "name": "owner", - "outputs": [ + inputs: [], + name: 'owner', + outputs: [ { - "internalType": "address", - "name": "", - "type": "address" - } + internalType: 'address', + name: '', + type: 'address', + }, ], - "stateMutability": "view", - "type": "function" + stateMutability: 'view', + type: 'function', }, { - "inputs": [ + inputs: [ { - "internalType": "address", - "name": "anUser", - "type": "address" + internalType: 'address', + name: 'anUser', + type: 'address', }, { - "internalType": "address", - "name": "aToken", - "type": "address" - } + internalType: 'address', + name: 'aToken', + type: 'address', + }, ], - "name": "remove", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" + name: 'remove', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', }, { - "inputs": [], - "name": "renounceOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" + inputs: [], + name: 'renounceOwnership', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', }, { - "inputs": [ + inputs: [ { - "internalType": "address", - "name": "newOwner", - "type": "address" - } + internalType: 'address', + name: 'newOwner', + type: 'address', + }, ], - "name": "transferOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - } + name: 'transferOwnership', + outputs: [], + stateMutability: 'nonpayable', + type: 'function', + }, ], - "bytecode": "0x608060405234801561001057600080fd5b5060405161078c38038061078c83398101604081905261002f916100fd565b80826001600160a01b03811661005f57604051631e4fbdf760e01b81526000600482015260240160405180910390fd5b61006881610091565b50600180546001600160a01b0319166001600160a01b0392909216919091179055506101309050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b80516001600160a01b03811681146100f857600080fd5b919050565b6000806040838503121561011057600080fd5b610119836100e1565b9150610127602084016100e1565b90509250929050565b61064d8061013f6000396000f3fe608060405234801561001057600080fd5b50600436106100725760003560e01c80637f7c1491116100505780637f7c1491146100e65780638da5cb5b146100f9578063f2fde38b1461011457600080fd5b806352c28fab14610077578063715018a61461008c5780637663f82214610094575b600080fd5b61008a61008536600461056e565b610127565b005b61008a6101b6565b6100d16100a236600461056e565b6001600160a01b0380821660009081526002602090815260408083209386168352929052205460ff1692915050565b60405190151581526020015b60405180910390f35b61008a6100f436600461056e565b6101ca565b6000546040516001600160a01b0390911681526020016100dd565b61008a6101223660046105a7565b610256565b61012f6102b2565b816001600160a01b03811661015757604051639fabe1c160e01b815260040160405180910390fd5b816001600160a01b03811661017f57604051639fabe1c160e01b815260040160405180910390fd5b50506001600160a01b039081166000908152600260209081526040808320949093168252929092529020805460ff19166001179055565b6101be6102b2565b6101c86000610329565b565b6101d26102b2565b816001600160a01b0381166101fa57604051639fabe1c160e01b815260040160405180910390fd5b816001600160a01b03811661022257604051639fabe1c160e01b815260040160405180910390fd5b50506001600160a01b039081166000908152600260209081526040808320949093168252929092529020805460ff19169055565b61025e6102b2565b6001600160a01b0381166102a6576040517f1e4fbdf7000000000000000000000000000000000000000000000000000000008152600060048201526024015b60405180910390fd5b6102af81610329565b50565b6102ba610391565b6001600160a01b03166102d56000546001600160a01b031690565b6001600160a01b0316146101c8576102eb610391565b6040517f118cdaa70000000000000000000000000000000000000000000000000000000081526001600160a01b03909116600482015260240161029d565b600080546001600160a01b038381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600061039b6103a0565b905090565b60015460408051600481526024810182526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f7bdf2ec70000000000000000000000000000000000000000000000000000000017905290516000926060926001600160a01b039091169161041791906105cb565b600060405180830381855afa9150503d8060008114610452576040519150601f19603f3d011682016040523d82523d6000602084013e610457565b606091505b5080519092506104719150820160209081019083016105fa565b6001600160a01b031633036105525760015460408051600481526024810182526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f7a6ce2e10000000000000000000000000000000000000000000000000000000017905290516060926001600160a01b0316916104f1916105cb565b600060405180830381855afa9150503d806000811461052c576040519150601f19603f3d011682016040523d82523d6000602084013e610531565b606091505b50805190925061054b9150820160209081019083016105fa565b9250505090565b3391505090565b6001600160a01b03811681146102af57600080fd5b6000806040838503121561058157600080fd5b823561058c81610559565b9150602083013561059c81610559565b809150509250929050565b6000602082840312156105b957600080fd5b81356105c481610559565b9392505050565b6000825160005b818110156105ec57602081860181015185830152016105d2565b506000920191825250919050565b60006020828403121561060c57600080fd5b81516105c48161055956fea2646970667358221220877b455148ea5c2247a6126ff72c91e58f8132d3b9b84edaa8cdc621e2daa35464736f6c63430008140033", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100725760003560e01c80637f7c1491116100505780637f7c1491146100e65780638da5cb5b146100f9578063f2fde38b1461011457600080fd5b806352c28fab14610077578063715018a61461008c5780637663f82214610094575b600080fd5b61008a61008536600461056e565b610127565b005b61008a6101b6565b6100d16100a236600461056e565b6001600160a01b0380821660009081526002602090815260408083209386168352929052205460ff1692915050565b60405190151581526020015b60405180910390f35b61008a6100f436600461056e565b6101ca565b6000546040516001600160a01b0390911681526020016100dd565b61008a6101223660046105a7565b610256565b61012f6102b2565b816001600160a01b03811661015757604051639fabe1c160e01b815260040160405180910390fd5b816001600160a01b03811661017f57604051639fabe1c160e01b815260040160405180910390fd5b50506001600160a01b039081166000908152600260209081526040808320949093168252929092529020805460ff19166001179055565b6101be6102b2565b6101c86000610329565b565b6101d26102b2565b816001600160a01b0381166101fa57604051639fabe1c160e01b815260040160405180910390fd5b816001600160a01b03811661022257604051639fabe1c160e01b815260040160405180910390fd5b50506001600160a01b039081166000908152600260209081526040808320949093168252929092529020805460ff19169055565b61025e6102b2565b6001600160a01b0381166102a6576040517f1e4fbdf7000000000000000000000000000000000000000000000000000000008152600060048201526024015b60405180910390fd5b6102af81610329565b50565b6102ba610391565b6001600160a01b03166102d56000546001600160a01b031690565b6001600160a01b0316146101c8576102eb610391565b6040517f118cdaa70000000000000000000000000000000000000000000000000000000081526001600160a01b03909116600482015260240161029d565b600080546001600160a01b038381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600061039b6103a0565b905090565b60015460408051600481526024810182526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f7bdf2ec70000000000000000000000000000000000000000000000000000000017905290516000926060926001600160a01b039091169161041791906105cb565b600060405180830381855afa9150503d8060008114610452576040519150601f19603f3d011682016040523d82523d6000602084013e610457565b606091505b5080519092506104719150820160209081019083016105fa565b6001600160a01b031633036105525760015460408051600481526024810182526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f7a6ce2e10000000000000000000000000000000000000000000000000000000017905290516060926001600160a01b0316916104f1916105cb565b600060405180830381855afa9150503d806000811461052c576040519150601f19603f3d011682016040523d82523d6000602084013e610531565b606091505b50805190925061054b9150820160209081019083016105fa565b9250505090565b3391505090565b6001600160a01b03811681146102af57600080fd5b6000806040838503121561058157600080fd5b823561058c81610559565b9150602083013561059c81610559565b809150509250929050565b6000602082840312156105b957600080fd5b81356105c481610559565b9392505050565b6000825160005b818110156105ec57602081860181015185830152016105d2565b506000920191825250919050565b60006020828403121561060c57600080fd5b81516105c48161055956fea2646970667358221220877b455148ea5c2247a6126ff72c91e58f8132d3b9b84edaa8cdc621e2daa35464736f6c63430008140033", - "linkReferences": {}, - "deployedLinkReferences": {} -} \ No newline at end of file + bytecode: + '0x608060405234801561001057600080fd5b5060405161078c38038061078c83398101604081905261002f916100fd565b80826001600160a01b03811661005f57604051631e4fbdf760e01b81526000600482015260240160405180910390fd5b61006881610091565b50600180546001600160a01b0319166001600160a01b0392909216919091179055506101309050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b80516001600160a01b03811681146100f857600080fd5b919050565b6000806040838503121561011057600080fd5b610119836100e1565b9150610127602084016100e1565b90509250929050565b61064d8061013f6000396000f3fe608060405234801561001057600080fd5b50600436106100725760003560e01c80637f7c1491116100505780637f7c1491146100e65780638da5cb5b146100f9578063f2fde38b1461011457600080fd5b806352c28fab14610077578063715018a61461008c5780637663f82214610094575b600080fd5b61008a61008536600461056e565b610127565b005b61008a6101b6565b6100d16100a236600461056e565b6001600160a01b0380821660009081526002602090815260408083209386168352929052205460ff1692915050565b60405190151581526020015b60405180910390f35b61008a6100f436600461056e565b6101ca565b6000546040516001600160a01b0390911681526020016100dd565b61008a6101223660046105a7565b610256565b61012f6102b2565b816001600160a01b03811661015757604051639fabe1c160e01b815260040160405180910390fd5b816001600160a01b03811661017f57604051639fabe1c160e01b815260040160405180910390fd5b50506001600160a01b039081166000908152600260209081526040808320949093168252929092529020805460ff19166001179055565b6101be6102b2565b6101c86000610329565b565b6101d26102b2565b816001600160a01b0381166101fa57604051639fabe1c160e01b815260040160405180910390fd5b816001600160a01b03811661022257604051639fabe1c160e01b815260040160405180910390fd5b50506001600160a01b039081166000908152600260209081526040808320949093168252929092529020805460ff19169055565b61025e6102b2565b6001600160a01b0381166102a6576040517f1e4fbdf7000000000000000000000000000000000000000000000000000000008152600060048201526024015b60405180910390fd5b6102af81610329565b50565b6102ba610391565b6001600160a01b03166102d56000546001600160a01b031690565b6001600160a01b0316146101c8576102eb610391565b6040517f118cdaa70000000000000000000000000000000000000000000000000000000081526001600160a01b03909116600482015260240161029d565b600080546001600160a01b038381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600061039b6103a0565b905090565b60015460408051600481526024810182526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f7bdf2ec70000000000000000000000000000000000000000000000000000000017905290516000926060926001600160a01b039091169161041791906105cb565b600060405180830381855afa9150503d8060008114610452576040519150601f19603f3d011682016040523d82523d6000602084013e610457565b606091505b5080519092506104719150820160209081019083016105fa565b6001600160a01b031633036105525760015460408051600481526024810182526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f7a6ce2e10000000000000000000000000000000000000000000000000000000017905290516060926001600160a01b0316916104f1916105cb565b600060405180830381855afa9150503d806000811461052c576040519150601f19603f3d011682016040523d82523d6000602084013e610531565b606091505b50805190925061054b9150820160209081019083016105fa565b9250505090565b3391505090565b6001600160a01b03811681146102af57600080fd5b6000806040838503121561058157600080fd5b823561058c81610559565b9150602083013561059c81610559565b809150509250929050565b6000602082840312156105b957600080fd5b81356105c481610559565b9392505050565b6000825160005b818110156105ec57602081860181015185830152016105d2565b506000920191825250919050565b60006020828403121561060c57600080fd5b81516105c48161055956fea2646970667358221220877b455148ea5c2247a6126ff72c91e58f8132d3b9b84edaa8cdc621e2daa35464736f6c63430008140033', + deployedBytecode: + '0x608060405234801561001057600080fd5b50600436106100725760003560e01c80637f7c1491116100505780637f7c1491146100e65780638da5cb5b146100f9578063f2fde38b1461011457600080fd5b806352c28fab14610077578063715018a61461008c5780637663f82214610094575b600080fd5b61008a61008536600461056e565b610127565b005b61008a6101b6565b6100d16100a236600461056e565b6001600160a01b0380821660009081526002602090815260408083209386168352929052205460ff1692915050565b60405190151581526020015b60405180910390f35b61008a6100f436600461056e565b6101ca565b6000546040516001600160a01b0390911681526020016100dd565b61008a6101223660046105a7565b610256565b61012f6102b2565b816001600160a01b03811661015757604051639fabe1c160e01b815260040160405180910390fd5b816001600160a01b03811661017f57604051639fabe1c160e01b815260040160405180910390fd5b50506001600160a01b039081166000908152600260209081526040808320949093168252929092529020805460ff19166001179055565b6101be6102b2565b6101c86000610329565b565b6101d26102b2565b816001600160a01b0381166101fa57604051639fabe1c160e01b815260040160405180910390fd5b816001600160a01b03811661022257604051639fabe1c160e01b815260040160405180910390fd5b50506001600160a01b039081166000908152600260209081526040808320949093168252929092529020805460ff19169055565b61025e6102b2565b6001600160a01b0381166102a6576040517f1e4fbdf7000000000000000000000000000000000000000000000000000000008152600060048201526024015b60405180910390fd5b6102af81610329565b50565b6102ba610391565b6001600160a01b03166102d56000546001600160a01b031690565b6001600160a01b0316146101c8576102eb610391565b6040517f118cdaa70000000000000000000000000000000000000000000000000000000081526001600160a01b03909116600482015260240161029d565b600080546001600160a01b038381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600061039b6103a0565b905090565b60015460408051600481526024810182526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f7bdf2ec70000000000000000000000000000000000000000000000000000000017905290516000926060926001600160a01b039091169161041791906105cb565b600060405180830381855afa9150503d8060008114610452576040519150601f19603f3d011682016040523d82523d6000602084013e610457565b606091505b5080519092506104719150820160209081019083016105fa565b6001600160a01b031633036105525760015460408051600481526024810182526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f7a6ce2e10000000000000000000000000000000000000000000000000000000017905290516060926001600160a01b0316916104f1916105cb565b600060405180830381855afa9150503d806000811461052c576040519150601f19603f3d011682016040523d82523d6000602084013e610531565b606091505b50805190925061054b9150820160209081019083016105fa565b9250505090565b3391505090565b6001600160a01b03811681146102af57600080fd5b6000806040838503121561058157600080fd5b823561058c81610559565b9150602083013561059c81610559565b809150509250929050565b6000602082840312156105b957600080fd5b81356105c481610559565b9392505050565b6000825160005b818110156105ec57602081860181015185830152016105d2565b506000920191825250919050565b60006020828403121561060c57600080fd5b81516105c48161055956fea2646970667358221220877b455148ea5c2247a6126ff72c91e58f8132d3b9b84edaa8cdc621e2daa35464736f6c63430008140033', + linkReferences: {}, + deployedLinkReferences: {}, +}; diff --git a/src/test/fixtures.ts b/src/test/fixtures.ts index 59a7a09..c117e5a 100644 --- a/src/test/fixtures.ts +++ b/src/test/fixtures.ts @@ -1,7 +1,5 @@ - import { TransactionRequest } from 'ethers'; - export const aPrivateKey = '9ea92b45be8c30b18da6857cf60cfec534c0d612af34b291fd022ac4573e617c'; export const anExpirationTime = 1836394529; @@ -25,4 +23,7 @@ export const anOriginalTxRequest: TransactionRequest = { }; export const aSignedTxRequest = '0xf8e447808204d2944f3f9061c42b396746bb9a232089703e4f9dbf7680b88452c28fab000000000000000000000000e81d7e5cd979be0a7f6b6c98957a66fdf6240273000000000000000000000000410bd47227a5ea8af81995fa3d66b770af6f85e2000000000000000000000000c6e2459991bfe27cca6d86722f35da23a1e4cb97000000000000000000000000000000000000000000000000000000006d7528211ba0c82f7051ffec883df1a1ce7fbe735cbd61900b8957362709b3614bd3c3309418a03f6b1897320a809a93c17ccc26130a0918a995cfb14fcd7c4108b35778003ab7'; -export const testAddresses = ['0xE81D7E5Cd979be0a7F6B6c98957A66fdF6240273', '0x410bd47227a5EA8AF81995Fa3d66B770aF6F85e2']; +export const testAddresses = [ + '0xE81D7E5Cd979be0a7F6B6c98957A66fdF6240273', + '0x410bd47227a5EA8AF81995Fa3d66B770aF6F85e2', +]; diff --git a/src/test/index.test.ts b/src/test/index.test.ts index a529392..e484cff 100644 --- a/src/test/index.test.ts +++ b/src/test/index.test.ts @@ -5,9 +5,7 @@ import { LacchainTransactionRequest, } from '../index'; - describe('index.ts', () => { - test('exports', () => { expect(LacchainSigner).toBeTruthy(); expect(LacchainProvider).toBeTruthy(); diff --git a/src/test/lacchain-provider.test.ts b/src/test/lacchain-provider.test.ts index 23b7443..7de9d89 100644 --- a/src/test/lacchain-provider.test.ts +++ b/src/test/lacchain-provider.test.ts @@ -1,8 +1,6 @@ import { LacchainProvider } from '../lacchain-provider'; - describe('LacchainProvider', () => { - test('new', () => { expect(new LacchainProvider('http://test.test')).toBeTruthy(); }); diff --git a/src/test/lacchain-signer.test.ts b/src/test/lacchain-signer.test.ts index 533f1ff..0f0ab23 100644 --- a/src/test/lacchain-signer.test.ts +++ b/src/test/lacchain-signer.test.ts @@ -8,9 +8,7 @@ import { aSignedTxRequest, } from './fixtures'; - describe('LacchainSigner', () => { - let signer: LacchainSigner; const aProvider = {} as Provider; diff --git a/src/test/lacchain-transaction-request.test.ts b/src/test/lacchain-transaction-request.test.ts index 1542c7c..8d9bbd6 100644 --- a/src/test/lacchain-transaction-request.test.ts +++ b/src/test/lacchain-transaction-request.test.ts @@ -1,15 +1,22 @@ import { LacchainTransactionRequest } from '../lacchain-transaction-request'; -import { anOriginalTxRequest, aNodeAddress, anExpirationTime } from './fixtures'; - +import { + anOriginalTxRequest, + aNodeAddress, + anExpirationTime, +} from './fixtures'; describe('LacchainTransactionRequest', () => { - let lacchainTxRequest: LacchainTransactionRequest; - const lacchainDataExpected = '0x52c28fab000000000000000000000000e81d7e5cd979be0a7f6b6c98957a66fdf6240273000000000000000000000000410bd47227a5ea8af81995fa3d66b770af6f85e2000000000000000000000000c6e2459991bfe27cca6d86722f35da23a1e4cb97000000000000000000000000000000000000000000000000000000006d752821'; + const lacchainDataExpected = + '0x52c28fab000000000000000000000000e81d7e5cd979be0a7f6b6c98957a66fdf6240273000000000000000000000000410bd47227a5ea8af81995fa3d66b770af6f85e2000000000000000000000000c6e2459991bfe27cca6d86722f35da23a1e4cb97000000000000000000000000000000000000000000000000000000006d752821'; beforeEach(() => { - lacchainTxRequest = new LacchainTransactionRequest(anOriginalTxRequest, aNodeAddress, anExpirationTime); + lacchainTxRequest = new LacchainTransactionRequest( + anOriginalTxRequest, + aNodeAddress, + anExpirationTime, + ); }); test('new', () => { @@ -65,11 +72,15 @@ describe('LacchainTransactionRequest', () => { }); test('accessList', () => { - expect(lacchainTxRequest.accessList).toEqual(anOriginalTxRequest.accessList); + expect(lacchainTxRequest.accessList).toEqual( + anOriginalTxRequest.accessList, + ); }); test('customData', () => { - expect(lacchainTxRequest.customData).toEqual(anOriginalTxRequest.customData); + expect(lacchainTxRequest.customData).toEqual( + anOriginalTxRequest.customData, + ); }); test('blockTag', () => { diff --git a/src/test/lacchain-transaction.test.ts b/src/test/lacchain-transaction.test.ts index 94391df..c188b49 100644 --- a/src/test/lacchain-transaction.test.ts +++ b/src/test/lacchain-transaction.test.ts @@ -1,9 +1,7 @@ import { Transaction } from 'ethers'; import { LacchainTransaction } from '../lacchain-transaction'; - describe('LacchainTransaction ', () => { - let transaction: LacchainTransaction; const aTestHash = @@ -53,7 +51,9 @@ describe('LacchainTransaction ', () => { }); test('maxPriorityFeePerGas', () => { - expect(transaction.maxPriorityFeePerGas).toEqual(anOriginalTx.maxPriorityFeePerGas); + expect(transaction.maxPriorityFeePerGas).toEqual( + anOriginalTx.maxPriorityFeePerGas, + ); }); test('maxFeePerGas', () => { @@ -97,6 +97,8 @@ describe('LacchainTransaction ', () => { }); test('unsignedSerialized', () => { - expect(transaction.unsignedSerialized).toEqual(anOriginalTx.unsignedSerialized); + expect(transaction.unsignedSerialized).toEqual( + anOriginalTx.unsignedSerialized, + ); }); });