diff --git a/.env.dist b/.env.dist new file mode 100644 index 00000000..244ea692 --- /dev/null +++ b/.env.dist @@ -0,0 +1,6 @@ +#This is only for running tests + +CHAIN_ID= +FAUCET_PRIVATEKEY= +RPC_URL= + diff --git a/.gitignore b/.gitignore index 1d109b37..328cd40d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,6 @@ node_modules/** output/** - +.env **/*.swp **/*.tgz dist/*.gz diff --git a/package-lock.json b/package-lock.json index 0c0cae72..e82c90d7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { - "name": "quais", - "version": "6.8.1", + "name": "quais6", + "version": "0.0.1", "lockfileVersion": 3, "requires": true, "packages": { "": { - "name": "quais", - "version": "6.8.1", + "name": "quais6", + "version": "0.0.1", "license": "MIT", "dependencies": { "@adraffy/ens-normalize": "1.10.0", @@ -14,6 +14,7 @@ "@noble/hashes": "1.3.2", "@types/node": "18.15.13", "aes-js": "4.0.0-beta.5", + "dotenv": "^16.4.1", "tslib": "2.4.0", "ws": "8.5.0" }, @@ -68,9 +69,9 @@ "dev": true }, "node_modules/@jridgewell/trace-mapping": { - "version": "0.3.21", - "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.21.tgz", - "integrity": "sha512-SRfKmRe1KvYnxjEMtxEr+J4HIeMX5YBg/qhRHpxEIGjhX1rshcHlnFUE9K0GazhVKWM7B+nARSkV8LuvJdJ5/g==", + "version": "0.3.22", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.22.tgz", + "integrity": "sha512-Wf963MzWtA2sjrNt+g18IAln9lKnlRp+K2eH4jjIoF1wYeq3aMREpG09xhlhdzS0EjwU7qmUJYangWa+151vZw==", "dev": true, "dependencies": { "@jridgewell/resolve-uri": "^3.1.0", @@ -487,6 +488,17 @@ "node": ">=0.3.1" } }, + "node_modules/dotenv": { + "version": "16.4.1", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.4.1.tgz", + "integrity": "sha512-CjA3y+Dr3FyFDOAMnxZEGtnW9KBR2M0JvvUtXNW+dYJL5ROWxP9DUHCwgFqpMk0OXCc0ljhaNTr2w/kutYIcHQ==", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/motdotla/dotenv?sponsor=1" + } + }, "node_modules/emoji-regex": { "version": "8.0.0", "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", diff --git a/package.json b/package.json index 4c2dcb1f..964be71e 100644 --- a/package.json +++ b/package.json @@ -14,6 +14,7 @@ "@noble/hashes": "1.3.2", "@types/node": "18.15.13", "aes-js": "4.0.0-beta.5", + "dotenv": "^16.4.1", "tslib": "2.4.0", "ws": "8.5.0" }, diff --git a/src.ts/_tests/contracts/QRC20.ts b/src.ts/_tests/contracts/QRC20.ts new file mode 100644 index 00000000..936c3338 --- /dev/null +++ b/src.ts/_tests/contracts/QRC20.ts @@ -0,0 +1,480 @@ +const QRC20 = { + "_format": "hh-sol-artifact-1", + "contractName": "QRC20", + "sourceName": "contracts/QRC20.sol", + "abi": [ + { + "inputs": [ + { + "internalType": "string", + "name": "name_", + "type": "string" + }, + { + "internalType": "string", + "name": "symbol_", + "type": "string" + }, + { + "internalType": "uint256", + "name": "initialSupply_", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "ExternalTransfer", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "Transfer", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "uint8[]", + "name": "chain", + "type": "uint8[]" + }, + { + "internalType": "address[]", + "name": "addr", + "type": "address[]" + } + ], + "name": "AddApprovedAddresses", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "ApprovedAddresses", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "Ranges", + "outputs": [ + { + "internalType": "uint8", + "name": "low", + "type": "uint8" + }, + { + "internalType": "uint8", + "name": "high", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "spender", + "type": "address" + } + ], + "name": "allowance", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "approve", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "gasLimit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minerTip", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "baseFee", + "type": "uint256" + } + ], + "name": "crossChainTransfer", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [], + "name": "decimals", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "subtractedValue", + "type": "uint256" + } + ], + "name": "decreaseAllowance", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "addr", + "type": "address" + } + ], + "name": "getAddressLocation", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "incomingTransfer", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "addedValue", + "type": "uint256" + } + ], + "name": "increaseAllowance", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "name", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "symbol", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "a", + "type": "address" + } + ], + "name": "toBytes", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [], + "name": "totalSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "transfer", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "transferFrom", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "bytecode": "0x60806040523480156200001157600080fd5b5060405162001f7238038062001f72833981016040819052620000349162000325565b600f62000042848262000426565b50601062000051838262000426565b50601180546001600160a01b03191633908117909155819062000075908262000195565b505060408051808201825260008152601d60209182015260128054611d0061ffff199182161790915582518084018452601e8152603a90830152601380548216613a1e17905582518084018452603b815260579083015260148054821661573b17905582518084018452605881526073908301526015805482166173581790558251808401845260748152608f90830152601680548216618f74179055825180840184526090815260ab9083015260178054821661ab901790558251808401845260ac815260c79083015260188054821661c7ac1790558251808401845260c8815260e39083015260198054821661e3c8179055825180840190935260e4835260ff9290910191909152601a805490911661ffe4179055506200051a9050565b6001600160a01b038216620001f05760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015260640160405180910390fd5b80600e6000828254620002049190620004f2565b90915550506001600160a01b038216600081815260208181526040808320805486019055518481527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a35050565b505050565b634e487b7160e01b600052604160045260246000fd5b600082601f8301126200028857600080fd5b81516001600160401b0380821115620002a557620002a562000260565b604051601f8301601f19908116603f01168101908282118183101715620002d057620002d062000260565b81604052838152602092508683858801011115620002ed57600080fd5b600091505b83821015620003115785820183015181830184015290820190620002f2565b600093810190920192909252949350505050565b6000806000606084860312156200033b57600080fd5b83516001600160401b03808211156200035357600080fd5b620003618783880162000276565b945060208601519150808211156200037857600080fd5b50620003878682870162000276565b925050604084015190509250925092565b600181811c90821680620003ad57607f821691505b602082108103620003ce57634e487b7160e01b600052602260045260246000fd5b50919050565b601f8211156200025b57600081815260208120601f850160051c81016020861015620003fd5750805b601f850160051c820191505b818110156200041e5782815560010162000409565b505050505050565b81516001600160401b0381111562000442576200044262000260565b6200045a8162000453845462000398565b84620003d4565b602080601f831160018114620004925760008415620004795750858301515b600019600386901b1c1916600185901b1785556200041e565b600085815260208120601f198616915b82811015620004c357888601518255948401946001909101908401620004a2565b5085821015620004e25787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b808201808211156200051457634e487b7160e01b600052601160045260246000fd5b92915050565b611a48806200052a6000396000f3fe6080604052600436106101295760003560e01c8063593b79fe116100a5578063a457c2d711610074578063a9059cbb11610059578063a9059cbb14610375578063bc472aa314610395578063dd62ed3e146103cd57600080fd5b8063a457c2d714610335578063a534d9de1461035557600080fd5b8063593b79fe1461028657806370a08231146102d757806373cddab21461030d57806395d89b411461032057600080fd5b806323b872dd116100fc57806339509351116100e1578063395093511461020c578063399444bc1461022c578063429437bf1461024c57600080fd5b806323b872dd146101ca578063313ce567146101ea57600080fd5b806306fdde031461012e578063095ea7b31461015957806318160ddd1461018957806320e8dd93146101a8575b600080fd5b34801561013a57600080fd5b50610143610413565b60405161015091906115a8565b60405180910390f35b34801561016557600080fd5b506101796101743660046115de565b6104a5565b6040519015158152602001610150565b34801561019557600080fd5b50600e545b604051908152602001610150565b3480156101b457600080fd5b506101c86101c33660046115de565b6104bc565b005b3480156101d657600080fd5b506101796101e5366004611608565b61056d565b3480156101f657600080fd5b5060125b60405160ff9091168152602001610150565b34801561021857600080fd5b506101796102273660046115de565b61058f565b34801561023857600080fd5b506101fa610247366004611644565b6105ce565b34801561025857600080fd5b5061026c61026736600461165f565b6106e5565b6040805160ff938416815292909116602083015201610150565b34801561029257600080fd5b506101436102a1366004611644565b604051606082811b6bffffffffffffffffffffffff19166020830152906034016040516020818303038152906040529050919050565b3480156102e357600080fd5b5061019a6102f2366004611644565b6001600160a01b031660009081526020819052604090205490565b6101c861031b366004611678565b610708565b34801561032c57600080fd5b5061014361094c565b34801561034157600080fd5b506101796103503660046115de565b61095b565b34801561036157600080fd5b506101c8610370366004611706565b610a10565b34801561038157600080fd5b506101796103903660046115de565b610ce1565b3480156103a157600080fd5b506103b56103b036600461165f565b610cee565b6040516001600160a01b039091168152602001610150565b3480156103d957600080fd5b5061019a6103e8366004611772565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b6060600f8054610422906117a5565b80601f016020809104026020016040519081016040528092919081815260200182805461044e906117a5565b801561049b5780601f106104705761010080835404028352916020019161049b565b820191906000526020600020905b81548152906001019060200180831161047e57829003601f168201915b5050505050905090565b60006104b2338484610d0e565b5060015b92915050565b3360026104c8826105ce565b60ff16600c81106104db576104db6117df565b01546040516bffffffffffffffffffffffff193360601b1660208201526001600160a01b03909116919091149060340160408051601f1981840301815290829052610528916020016117f5565b6040516020818303038152906040529061055e5760405162461bcd60e51b815260040161055591906115a8565b60405180910390fd5b506105698282610edc565b5050565b600061057a843384610f9b565b61058584848461102d565b5060019392505050565b3360008181526001602090815260408083206001600160a01b038716845290915281205490919061058590829086906105c9908790611877565b610d0e565b604080516bffffffffffffffffffffffff19606084901b1660208201528151601481830301815260349091019091526000908190600081518110610614576106146117df565b016020015160f81c905060005b60098160ff16101561069c5760128160ff16600d8110610643576106436117df565b015460ff9081169083161080159061067e575060128160ff16600d811061066c5761066c6117df565b015460ff610100909104811690831611155b1561068a579392505050565b806106948161188a565b915050610621565b5060405162461bcd60e51b815260206004820152601060248201527f496e76616c6964204c6f636174696f6e000000000000000000000000000000006044820152606401610555565b601281600d81106106f557600080fd5b015460ff80821692506101009091041682565b84f780156107585760405162461bcd60e51b815260206004820152601760248201527f41646472657373206973206e6f742065787465726e616c0000000000000000006044820152606401610555565b610762338661128f565b6000600261076f886105ce565b60ff16600c8110610782576107826117df565b01546001600160a01b03169050806108025760405162461bcd60e51b815260206004820152602f60248201527f546f6b656e206973206e6f7420617661696c61626c65206f6e2074686520646560448201527f7374696e6174696f6e20636861696e00000000000000000000000000000000006064820152608401610555565b60008561080f8686611877565b61081991906118a9565b905080341015610828826113f8565b60405160200161083891906118c0565b604051602081830303815290604052906108655760405162461bcd60e51b815260040161055591906115a8565b506040516001600160a01b03891660248201526044810188905260009060640160408051601f198184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f20e8dd930000000000000000000000000000000000000000000000000000000017815281519192506000918291829190898b8d858b81f69050896001600160a01b0316336001600160a01b03167fcf0ee562475620bbcd2f1b0675c8163317513271e4fdbbe9722436f247bd6d998b60405161093891815260200190565b60405180910390a350505050505050505050565b606060108054610422906117a5565b3360008181526001602090815260408083206001600160a01b0387168452909152812054909190838110156109f85760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760448201527f207a65726f0000000000000000000000000000000000000000000000000000006064820152608401610555565b610a058286868403610d0e565b506001949350505050565b6011546001600160a01b03163314610a6a5760405162461bcd60e51b815260206004820152601660248201527f53656e646572206973206e6f74206465706c6f796572000000000000000000006044820152606401610555565b828114610adf5760405162461bcd60e51b815260206004820152603060248201527f636861696e20616e64206164647265737320617272617973206d75737420626560448201527f207468652073616d65206c656e677468000000000000000000000000000000006064820152608401610555565b60005b60ff8116841115610cda57600985858360ff16818110610b0457610b046117df565b9050602002016020810190610b199190611952565b60ff1610610b695760405162461bcd60e51b815260206004820152600b60248201527f4d61782039207a6f6e65730000000000000000000000000000000000000000006044820152606401610555565b60006002868660ff8516818110610b8257610b826117df565b9050602002016020810190610b979190611952565b60ff16600c8110610baa57610baa6117df565b01546001600160a01b031614610c285760405162461bcd60e51b815260206004820152603160248201527f54686520617070726f766564206164647265737320666f722074686973207a6f60448201527f6e6520616c7265616479206578697374730000000000000000000000000000006064820152608401610555565b82828260ff16818110610c3d57610c3d6117df565b9050602002016020810190610c529190611644565b600286868460ff16818110610c6957610c696117df565b9050602002016020810190610c7e9190611952565b60ff16600c8110610c9157610c916117df565b0180547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b039290921691909117905580610cd28161188a565b915050610ae2565b5050505050565b60006104b233848461102d565b600281600c8110610cfe57600080fd5b01546001600160a01b0316905081565b81f780610d835760405162461bcd60e51b815260206004820152603f60248201527f5370656e64657220616464726573732069732065787465726e616c2e2055736560448201527f2063726f73732d636861696e207472616e736665722066756e6374696f6e2e006064820152608401610555565b6001600160a01b038416610dfe5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460448201527f72657373000000000000000000000000000000000000000000000000000000006064820152608401610555565b6001600160a01b038316610e7a5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f20616464726560448201527f73730000000000000000000000000000000000000000000000000000000000006064820152608401610555565b6001600160a01b0384811660008181526001602090815260408083209488168084529482529182902086905590518581527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a350505050565b6001600160a01b038216610f325760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f2061646472657373006044820152606401610555565b80600e6000828254610f449190611877565b90915550506001600160a01b038216600081815260208181526040808320805486019055518481527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a35050565b6001600160a01b038381166000908152600160209081526040808320938616835292905220546000198114611027578181101561101a5760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e63650000006044820152606401610555565b6110278484848403610d0e565b50505050565b81f7806110a25760405162461bcd60e51b815260206004820152603760248201527f416464726573732069732065787465726e616c2e205573652063726f73732d6360448201527f6861696e207472616e736665722066756e6374696f6e2e0000000000000000006064820152608401610555565b6001600160a01b03841661111e5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f20616460448201527f64726573730000000000000000000000000000000000000000000000000000006064820152608401610555565b6001600160a01b03831661119a5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201527f65737300000000000000000000000000000000000000000000000000000000006064820152608401610555565b6001600160a01b038416600090815260208190526040902054828110156112295760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e742065786365656473206260448201527f616c616e636500000000000000000000000000000000000000000000000000006064820152608401610555565b6001600160a01b03858116600081815260208181526040808320888703905593881680835291849020805488019055925186815290927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a3610cda565b6001600160a01b03821661130b5760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f2061646472657360448201527f73000000000000000000000000000000000000000000000000000000000000006064820152608401610555565b6001600160a01b0382166000908152602081905260409020548181101561139a5760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e60448201527f63650000000000000000000000000000000000000000000000000000000000006064820152608401610555565b6001600160a01b0383166000818152602081815260408083208686039055600e80548790039055518581529192917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a3505050565b60608160000361143b57505060408051808201909152600181527f3000000000000000000000000000000000000000000000000000000000000000602082015290565b8160005b8115611465578061144f81611975565b915061145e9050600a8361198e565b915061143f565b60008167ffffffffffffffff811115611480576114806119b0565b6040519080825280601f01601f1916602001820160405280156114aa576020820181803683370190505b509050815b851561154f576114c06001826119c6565b905060006114cf600a8861198e565b6114da90600a6118a9565b6114e490886119c6565b6114ef9060306119d9565b905060008160f81b90508084848151811061150c5761150c6117df565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350611546600a8961198e565b975050506114af565b50949350505050565b60005b8381101561157357818101518382015260200161155b565b50506000910152565b60008151808452611594816020860160208601611558565b601f01601f19169290920160200192915050565b6020815260006115bb602083018461157c565b9392505050565b80356001600160a01b03811681146115d957600080fd5b919050565b600080604083850312156115f157600080fd5b6115fa836115c2565b946020939093013593505050565b60008060006060848603121561161d57600080fd5b611626846115c2565b9250611634602085016115c2565b9150604084013590509250925092565b60006020828403121561165657600080fd5b6115bb826115c2565b60006020828403121561167157600080fd5b5035919050565b600080600080600060a0868803121561169057600080fd5b611699866115c2565b97602087013597506040870135966060810135965060800135945092505050565b60008083601f8401126116cc57600080fd5b50813567ffffffffffffffff8111156116e457600080fd5b6020830191508360208260051b85010111156116ff57600080fd5b9250929050565b6000806000806040858703121561171c57600080fd5b843567ffffffffffffffff8082111561173457600080fd5b611740888389016116ba565b9096509450602087013591508082111561175957600080fd5b50611766878288016116ba565b95989497509550505050565b6000806040838503121561178557600080fd5b61178e836115c2565b915061179c602084016115c2565b90509250929050565b600181811c908216806117b957607f821691505b6020821081036117d957634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052603260045260246000fd5b7f53656e646572200000000000000000000000000000000000000000000000000081526000825161182d816007850160208701611558565b7f206e6f7420617070726f766564000000000000000000000000000000000000006007939091019283015250601401919050565b634e487b7160e01b600052601160045260246000fd5b808201808211156104b6576104b6611861565b600060ff821660ff81036118a0576118a0611861565b60010192915050565b80820281158282048414176104b6576104b6611861565b7f4e6f7420656e6f756768206761732073656e742c206e656564206174206c656181527f737420000000000000000000000000000000000000000000000000000000000060208201526000825161191e816023850160208701611558565b7f20776569000000000000000000000000000000000000000000000000000000006023939091019283015250602701919050565b60006020828403121561196457600080fd5b813560ff811681146115bb57600080fd5b60006001820161198757611987611861565b5060010190565b6000826119ab57634e487b7160e01b600052601260045260246000fd5b500490565b634e487b7160e01b600052604160045260246000fd5b818103818111156104b6576104b6611861565b60ff81811683821601908111156104b6576104b661186156fea26469706673582212204c6dd8a18c56cd6389a7fc7f0bf473d092abcc9aec3ae408859c35bbcc52713e64736f6c637822302e382e31392d646576656c6f702b636f6d6d69742e63383866343066642e6d6f640053", + "deployedBytecode": "0x6080604052600436106101295760003560e01c8063593b79fe116100a5578063a457c2d711610074578063a9059cbb11610059578063a9059cbb14610375578063bc472aa314610395578063dd62ed3e146103cd57600080fd5b8063a457c2d714610335578063a534d9de1461035557600080fd5b8063593b79fe1461028657806370a08231146102d757806373cddab21461030d57806395d89b411461032057600080fd5b806323b872dd116100fc57806339509351116100e1578063395093511461020c578063399444bc1461022c578063429437bf1461024c57600080fd5b806323b872dd146101ca578063313ce567146101ea57600080fd5b806306fdde031461012e578063095ea7b31461015957806318160ddd1461018957806320e8dd93146101a8575b600080fd5b34801561013a57600080fd5b50610143610413565b60405161015091906115a8565b60405180910390f35b34801561016557600080fd5b506101796101743660046115de565b6104a5565b6040519015158152602001610150565b34801561019557600080fd5b50600e545b604051908152602001610150565b3480156101b457600080fd5b506101c86101c33660046115de565b6104bc565b005b3480156101d657600080fd5b506101796101e5366004611608565b61056d565b3480156101f657600080fd5b5060125b60405160ff9091168152602001610150565b34801561021857600080fd5b506101796102273660046115de565b61058f565b34801561023857600080fd5b506101fa610247366004611644565b6105ce565b34801561025857600080fd5b5061026c61026736600461165f565b6106e5565b6040805160ff938416815292909116602083015201610150565b34801561029257600080fd5b506101436102a1366004611644565b604051606082811b6bffffffffffffffffffffffff19166020830152906034016040516020818303038152906040529050919050565b3480156102e357600080fd5b5061019a6102f2366004611644565b6001600160a01b031660009081526020819052604090205490565b6101c861031b366004611678565b610708565b34801561032c57600080fd5b5061014361094c565b34801561034157600080fd5b506101796103503660046115de565b61095b565b34801561036157600080fd5b506101c8610370366004611706565b610a10565b34801561038157600080fd5b506101796103903660046115de565b610ce1565b3480156103a157600080fd5b506103b56103b036600461165f565b610cee565b6040516001600160a01b039091168152602001610150565b3480156103d957600080fd5b5061019a6103e8366004611772565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b6060600f8054610422906117a5565b80601f016020809104026020016040519081016040528092919081815260200182805461044e906117a5565b801561049b5780601f106104705761010080835404028352916020019161049b565b820191906000526020600020905b81548152906001019060200180831161047e57829003601f168201915b5050505050905090565b60006104b2338484610d0e565b5060015b92915050565b3360026104c8826105ce565b60ff16600c81106104db576104db6117df565b01546040516bffffffffffffffffffffffff193360601b1660208201526001600160a01b03909116919091149060340160408051601f1981840301815290829052610528916020016117f5565b6040516020818303038152906040529061055e5760405162461bcd60e51b815260040161055591906115a8565b60405180910390fd5b506105698282610edc565b5050565b600061057a843384610f9b565b61058584848461102d565b5060019392505050565b3360008181526001602090815260408083206001600160a01b038716845290915281205490919061058590829086906105c9908790611877565b610d0e565b604080516bffffffffffffffffffffffff19606084901b1660208201528151601481830301815260349091019091526000908190600081518110610614576106146117df565b016020015160f81c905060005b60098160ff16101561069c5760128160ff16600d8110610643576106436117df565b015460ff9081169083161080159061067e575060128160ff16600d811061066c5761066c6117df565b015460ff610100909104811690831611155b1561068a579392505050565b806106948161188a565b915050610621565b5060405162461bcd60e51b815260206004820152601060248201527f496e76616c6964204c6f636174696f6e000000000000000000000000000000006044820152606401610555565b601281600d81106106f557600080fd5b015460ff80821692506101009091041682565b84f780156107585760405162461bcd60e51b815260206004820152601760248201527f41646472657373206973206e6f742065787465726e616c0000000000000000006044820152606401610555565b610762338661128f565b6000600261076f886105ce565b60ff16600c8110610782576107826117df565b01546001600160a01b03169050806108025760405162461bcd60e51b815260206004820152602f60248201527f546f6b656e206973206e6f7420617661696c61626c65206f6e2074686520646560448201527f7374696e6174696f6e20636861696e00000000000000000000000000000000006064820152608401610555565b60008561080f8686611877565b61081991906118a9565b905080341015610828826113f8565b60405160200161083891906118c0565b604051602081830303815290604052906108655760405162461bcd60e51b815260040161055591906115a8565b506040516001600160a01b03891660248201526044810188905260009060640160408051601f198184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f20e8dd930000000000000000000000000000000000000000000000000000000017815281519192506000918291829190898b8d858b81f69050896001600160a01b0316336001600160a01b03167fcf0ee562475620bbcd2f1b0675c8163317513271e4fdbbe9722436f247bd6d998b60405161093891815260200190565b60405180910390a350505050505050505050565b606060108054610422906117a5565b3360008181526001602090815260408083206001600160a01b0387168452909152812054909190838110156109f85760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760448201527f207a65726f0000000000000000000000000000000000000000000000000000006064820152608401610555565b610a058286868403610d0e565b506001949350505050565b6011546001600160a01b03163314610a6a5760405162461bcd60e51b815260206004820152601660248201527f53656e646572206973206e6f74206465706c6f796572000000000000000000006044820152606401610555565b828114610adf5760405162461bcd60e51b815260206004820152603060248201527f636861696e20616e64206164647265737320617272617973206d75737420626560448201527f207468652073616d65206c656e677468000000000000000000000000000000006064820152608401610555565b60005b60ff8116841115610cda57600985858360ff16818110610b0457610b046117df565b9050602002016020810190610b199190611952565b60ff1610610b695760405162461bcd60e51b815260206004820152600b60248201527f4d61782039207a6f6e65730000000000000000000000000000000000000000006044820152606401610555565b60006002868660ff8516818110610b8257610b826117df565b9050602002016020810190610b979190611952565b60ff16600c8110610baa57610baa6117df565b01546001600160a01b031614610c285760405162461bcd60e51b815260206004820152603160248201527f54686520617070726f766564206164647265737320666f722074686973207a6f60448201527f6e6520616c7265616479206578697374730000000000000000000000000000006064820152608401610555565b82828260ff16818110610c3d57610c3d6117df565b9050602002016020810190610c529190611644565b600286868460ff16818110610c6957610c696117df565b9050602002016020810190610c7e9190611952565b60ff16600c8110610c9157610c916117df565b0180547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b039290921691909117905580610cd28161188a565b915050610ae2565b5050505050565b60006104b233848461102d565b600281600c8110610cfe57600080fd5b01546001600160a01b0316905081565b81f780610d835760405162461bcd60e51b815260206004820152603f60248201527f5370656e64657220616464726573732069732065787465726e616c2e2055736560448201527f2063726f73732d636861696e207472616e736665722066756e6374696f6e2e006064820152608401610555565b6001600160a01b038416610dfe5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460448201527f72657373000000000000000000000000000000000000000000000000000000006064820152608401610555565b6001600160a01b038316610e7a5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f20616464726560448201527f73730000000000000000000000000000000000000000000000000000000000006064820152608401610555565b6001600160a01b0384811660008181526001602090815260408083209488168084529482529182902086905590518581527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a350505050565b6001600160a01b038216610f325760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f2061646472657373006044820152606401610555565b80600e6000828254610f449190611877565b90915550506001600160a01b038216600081815260208181526040808320805486019055518481527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a35050565b6001600160a01b038381166000908152600160209081526040808320938616835292905220546000198114611027578181101561101a5760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e63650000006044820152606401610555565b6110278484848403610d0e565b50505050565b81f7806110a25760405162461bcd60e51b815260206004820152603760248201527f416464726573732069732065787465726e616c2e205573652063726f73732d6360448201527f6861696e207472616e736665722066756e6374696f6e2e0000000000000000006064820152608401610555565b6001600160a01b03841661111e5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f20616460448201527f64726573730000000000000000000000000000000000000000000000000000006064820152608401610555565b6001600160a01b03831661119a5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201527f65737300000000000000000000000000000000000000000000000000000000006064820152608401610555565b6001600160a01b038416600090815260208190526040902054828110156112295760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e742065786365656473206260448201527f616c616e636500000000000000000000000000000000000000000000000000006064820152608401610555565b6001600160a01b03858116600081815260208181526040808320888703905593881680835291849020805488019055925186815290927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a3610cda565b6001600160a01b03821661130b5760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f2061646472657360448201527f73000000000000000000000000000000000000000000000000000000000000006064820152608401610555565b6001600160a01b0382166000908152602081905260409020548181101561139a5760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e60448201527f63650000000000000000000000000000000000000000000000000000000000006064820152608401610555565b6001600160a01b0383166000818152602081815260408083208686039055600e80548790039055518581529192917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a3505050565b60608160000361143b57505060408051808201909152600181527f3000000000000000000000000000000000000000000000000000000000000000602082015290565b8160005b8115611465578061144f81611975565b915061145e9050600a8361198e565b915061143f565b60008167ffffffffffffffff811115611480576114806119b0565b6040519080825280601f01601f1916602001820160405280156114aa576020820181803683370190505b509050815b851561154f576114c06001826119c6565b905060006114cf600a8861198e565b6114da90600a6118a9565b6114e490886119c6565b6114ef9060306119d9565b905060008160f81b90508084848151811061150c5761150c6117df565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350611546600a8961198e565b975050506114af565b50949350505050565b60005b8381101561157357818101518382015260200161155b565b50506000910152565b60008151808452611594816020860160208601611558565b601f01601f19169290920160200192915050565b6020815260006115bb602083018461157c565b9392505050565b80356001600160a01b03811681146115d957600080fd5b919050565b600080604083850312156115f157600080fd5b6115fa836115c2565b946020939093013593505050565b60008060006060848603121561161d57600080fd5b611626846115c2565b9250611634602085016115c2565b9150604084013590509250925092565b60006020828403121561165657600080fd5b6115bb826115c2565b60006020828403121561167157600080fd5b5035919050565b600080600080600060a0868803121561169057600080fd5b611699866115c2565b97602087013597506040870135966060810135965060800135945092505050565b60008083601f8401126116cc57600080fd5b50813567ffffffffffffffff8111156116e457600080fd5b6020830191508360208260051b85010111156116ff57600080fd5b9250929050565b6000806000806040858703121561171c57600080fd5b843567ffffffffffffffff8082111561173457600080fd5b611740888389016116ba565b9096509450602087013591508082111561175957600080fd5b50611766878288016116ba565b95989497509550505050565b6000806040838503121561178557600080fd5b61178e836115c2565b915061179c602084016115c2565b90509250929050565b600181811c908216806117b957607f821691505b6020821081036117d957634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052603260045260246000fd5b7f53656e646572200000000000000000000000000000000000000000000000000081526000825161182d816007850160208701611558565b7f206e6f7420617070726f766564000000000000000000000000000000000000006007939091019283015250601401919050565b634e487b7160e01b600052601160045260246000fd5b808201808211156104b6576104b6611861565b600060ff821660ff81036118a0576118a0611861565b60010192915050565b80820281158282048414176104b6576104b6611861565b7f4e6f7420656e6f756768206761732073656e742c206e656564206174206c656181527f737420000000000000000000000000000000000000000000000000000000000060208201526000825161191e816023850160208701611558565b7f20776569000000000000000000000000000000000000000000000000000000006023939091019283015250602701919050565b60006020828403121561196457600080fd5b813560ff811681146115bb57600080fd5b60006001820161198757611987611861565b5060010190565b6000826119ab57634e487b7160e01b600052601260045260246000fd5b500490565b634e487b7160e01b600052604160045260246000fd5b818103818111156104b6576104b6611861565b60ff81811683821601908111156104b6576104b661186156fea26469706673582212204c6dd8a18c56cd6389a7fc7f0bf473d092abcc9aec3ae408859c35bbcc52713e64736f6c637822302e382e31392d646576656c6f702b636f6d6d69742e63383866343066642e6d6f640053", + "linkReferences": {}, + "deployedLinkReferences": {} +} + + +export default QRC20; \ No newline at end of file diff --git a/src.ts/_tests/contracts/TestContract.ts b/src.ts/_tests/contracts/TestContract.ts new file mode 100644 index 00000000..dfb1bae1 --- /dev/null +++ b/src.ts/_tests/contracts/TestContract.ts @@ -0,0 +1,205 @@ +const TestContract = { + "_format": "hh-sol-artifact-1", + "contractName": "TestContract", + "sourceName": "contracts/Test.sol", + "abi": [ + { + "inputs": [ + { + "internalType": "uint256", + "name": "code", + "type": "uint256" + }, + { + "internalType": "string", + "name": "message", + "type": "string" + } + ], + "name": "CustomError1", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "value", + "type": "address" + } + ], + "name": "EventAddress", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "bytes", + "name": "value", + "type": "bytes" + } + ], + "name": "EventBytes", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "string", + "name": "value", + "type": "string" + } + ], + "name": "EventString", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "EventUint256", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "a", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "b", + "type": "uint256" + } + ], + "name": "testCallAdd", + "outputs": [ + { + "internalType": "uint256", + "name": "result", + "type": "uint256" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bool", + "name": "pass", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "code", + "type": "uint256" + }, + { + "internalType": "string", + "name": "message", + "type": "string" + } + ], + "name": "testCustomError1", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bool", + "name": "pass", + "type": "bool" + }, + { + "internalType": "string", + "name": "message", + "type": "string" + } + ], + "name": "testErrorString", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "valueUint256", + "type": "uint256" + }, + { + "internalType": "address", + "name": "valueAddress", + "type": "address" + }, + { + "internalType": "string", + "name": "valueString", + "type": "string" + }, + { + "internalType": "bytes", + "name": "valueBytes", + "type": "bytes" + } + ], + "name": "testEvent", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "code", + "type": "uint256" + } + ], + "name": "testPanic", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "pure", + "type": "function" + } + ], + "bytecode": "0x608060405234801561001057600080fd5b5061058d806100206000396000f3fe608060405234801561001057600080fd5b50600436106100675760003560e01c8063c8d6fda711610050578063c8d6fda7146100a4578063db734248146100b9578063f24684e5146100cc57600080fd5b80633da613681461006c578063b206699b14610091575b600080fd5b61007f61007a3660046102aa565b6100df565b60405190815260200160405180910390f35b61007f61009f366004610321565b61013a565b6100b76100b2366004610374565b610167565b005b61007f6100c7366004610419565b61024d565b61007f6100da366004610473565b610295565b6000816000036101365760405162461bcd60e51b815260206004820152601360248201527f50616e69633a20636f6465206973207a65726f0000000000000000000000000060448201526064015b60405180910390fd5b5090565b600082828561015d5760405162461bcd60e51b815260040161012d9291906104be565b5091949350505050565b60405186907f85c55bbb820e6d71c71f4894e57751de334b38c421f9c170b0e66d32eafea33790600090a260405173ffffffffffffffffffffffffffffffffffffffff8616907f52cb491081609a3d8c50cb8d5c1395de748f65789fc66e140e795decadd86c3090600090a27f7240e2f75cccc64acf37f699b7cc2726ccd9c0ed8afeafdbf7911af78d077bad84846040516102049291906104be565b60405180910390a17f06e852ba9138ee18ce13f482908b8634bc29d809282ea568cf505aca412b195e828260405161023d9291906104be565b60405180910390a1505050505050565b60008461028c578383836040517f180c751a00000000000000000000000000000000000000000000000000000000815260040161012d939291906104da565b50919392505050565b60006102a182846104fd565b90505b92915050565b6000602082840312156102bc57600080fd5b5035919050565b803580151581146102d357600080fd5b919050565b60008083601f8401126102ea57600080fd5b50813567ffffffffffffffff81111561030257600080fd5b60208301915083602082850101111561031a57600080fd5b9250929050565b60008060006040848603121561033657600080fd5b61033f846102c3565b9250602084013567ffffffffffffffff81111561035b57600080fd5b610367868287016102d8565b9497909650939450505050565b6000806000806000806080878903121561038d57600080fd5b86359550602087013573ffffffffffffffffffffffffffffffffffffffff811681146103b857600080fd5b9450604087013567ffffffffffffffff808211156103d557600080fd5b6103e18a838b016102d8565b909650945060608901359150808211156103fa57600080fd5b5061040789828a016102d8565b979a9699509497509295939492505050565b6000806000806060858703121561042f57600080fd5b610438856102c3565b935060208501359250604085013567ffffffffffffffff81111561045b57600080fd5b610467878288016102d8565b95989497509550505050565b6000806040838503121561048657600080fd5b50508035926020909101359150565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6020815260006104d2602083018486610495565b949350505050565b8381526040602082015260006104f4604083018486610495565b95945050505050565b808201808211156102a4577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fdfea2646970667358221220aa52c22ce2f4a856b56d32ae58c6b41a9dba4c7aed43a0872ffa898f157e67b564736f6c637822302e382e31392d646576656c6f702b636f6d6d69742e63383866343066642e6d6f640053", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100675760003560e01c8063c8d6fda711610050578063c8d6fda7146100a4578063db734248146100b9578063f24684e5146100cc57600080fd5b80633da613681461006c578063b206699b14610091575b600080fd5b61007f61007a3660046102aa565b6100df565b60405190815260200160405180910390f35b61007f61009f366004610321565b61013a565b6100b76100b2366004610374565b610167565b005b61007f6100c7366004610419565b61024d565b61007f6100da366004610473565b610295565b6000816000036101365760405162461bcd60e51b815260206004820152601360248201527f50616e69633a20636f6465206973207a65726f0000000000000000000000000060448201526064015b60405180910390fd5b5090565b600082828561015d5760405162461bcd60e51b815260040161012d9291906104be565b5091949350505050565b60405186907f85c55bbb820e6d71c71f4894e57751de334b38c421f9c170b0e66d32eafea33790600090a260405173ffffffffffffffffffffffffffffffffffffffff8616907f52cb491081609a3d8c50cb8d5c1395de748f65789fc66e140e795decadd86c3090600090a27f7240e2f75cccc64acf37f699b7cc2726ccd9c0ed8afeafdbf7911af78d077bad84846040516102049291906104be565b60405180910390a17f06e852ba9138ee18ce13f482908b8634bc29d809282ea568cf505aca412b195e828260405161023d9291906104be565b60405180910390a1505050505050565b60008461028c578383836040517f180c751a00000000000000000000000000000000000000000000000000000000815260040161012d939291906104da565b50919392505050565b60006102a182846104fd565b90505b92915050565b6000602082840312156102bc57600080fd5b5035919050565b803580151581146102d357600080fd5b919050565b60008083601f8401126102ea57600080fd5b50813567ffffffffffffffff81111561030257600080fd5b60208301915083602082850101111561031a57600080fd5b9250929050565b60008060006040848603121561033657600080fd5b61033f846102c3565b9250602084013567ffffffffffffffff81111561035b57600080fd5b610367868287016102d8565b9497909650939450505050565b6000806000806000806080878903121561038d57600080fd5b86359550602087013573ffffffffffffffffffffffffffffffffffffffff811681146103b857600080fd5b9450604087013567ffffffffffffffff808211156103d557600080fd5b6103e18a838b016102d8565b909650945060608901359150808211156103fa57600080fd5b5061040789828a016102d8565b979a9699509497509295939492505050565b6000806000806060858703121561042f57600080fd5b610438856102c3565b935060208501359250604085013567ffffffffffffffff81111561045b57600080fd5b610467878288016102d8565b95989497509550505050565b6000806040838503121561048657600080fd5b50508035926020909101359150565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6020815260006104d2602083018486610495565b949350505050565b8381526040602082015260006104f4604083018486610495565b95945050505050565b808201808211156102a4577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fdfea2646970667358221220aa52c22ce2f4a856b56d32ae58c6b41a9dba4c7aed43a0872ffa898f157e67b564736f6c637822302e382e31392d646576656c6f702b636f6d6d69742e63383866343066642e6d6f640053", + "linkReferences": {}, + "deployedLinkReferences": {} +} + +export default TestContract; \ No newline at end of file diff --git a/src.ts/_tests/contracts/TypedContract.ts b/src.ts/_tests/contracts/TypedContract.ts new file mode 100644 index 00000000..6972a575 --- /dev/null +++ b/src.ts/_tests/contracts/TypedContract.ts @@ -0,0 +1,1916 @@ +const TypedContract = { + "_format": "hh-sol-artifact-1", + "contractName": "TypedContract", + "sourceName": "contracts/TestTyped.sol", + "abi": [ + { + "inputs": [ + { + "internalType": "uint32", + "name": "", + "type": "uint32" + } + ], + "name": "testTyped", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes24", + "name": "", + "type": "bytes24" + } + ], + "name": "testTyped", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "int208", + "name": "", + "type": "int208" + } + ], + "name": "testTyped", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint176", + "name": "", + "type": "uint176" + } + ], + "name": "testTyped", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "", + "type": "bytes4" + } + ], + "name": "testTyped", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes9", + "name": "", + "type": "bytes9" + } + ], + "name": "testTyped", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "int72", + "name": "", + "type": "int72" + } + ], + "name": "testTyped", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint200", + "name": "", + "type": "uint200" + } + ], + "name": "testTyped", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes20", + "name": "", + "type": "bytes20" + } + ], + "name": "testTyped", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "int32", + "name": "", + "type": "int32" + } + ], + "name": "testTyped", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint216", + "name": "", + "type": "uint216" + } + ], + "name": "testTyped", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint184", + "name": "", + "type": "uint184" + } + ], + "name": "testTyped", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint152", + "name": "", + "type": "uint152" + } + ], + "name": "testTyped", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "int248", + "name": "", + "type": "int248" + } + ], + "name": "testTyped", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint80", + "name": "", + "type": "uint80" + } + ], + "name": "testTyped", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes28", + "name": "", + "type": "bytes28" + } + ], + "name": "testTyped", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes30", + "name": "", + "type": "bytes30" + } + ], + "name": "testTyped", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "int120", + "name": "", + "type": "int120" + } + ], + "name": "testTyped", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes21", + "name": "", + "type": "bytes21" + } + ], + "name": "testTyped", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint104", + "name": "", + "type": "uint104" + } + ], + "name": "testTyped", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "int96", + "name": "", + "type": "int96" + } + ], + "name": "testTyped", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint224", + "name": "", + "type": "uint224" + } + ], + "name": "testTyped", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "int168", + "name": "", + "type": "int168" + } + ], + "name": "testTyped", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "int200", + "name": "", + "type": "int200" + } + ], + "name": "testTyped", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "int184", + "name": "", + "type": "int184" + } + ], + "name": "testTyped", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes14", + "name": "", + "type": "bytes14" + } + ], + "name": "testTyped", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint192", + "name": "", + "type": "uint192" + } + ], + "name": "testTyped", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes2", + "name": "", + "type": "bytes2" + } + ], + "name": "testTyped", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint24", + "name": "", + "type": "uint24" + } + ], + "name": "testTyped", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "int112", + "name": "", + "type": "int112" + } + ], + "name": "testTyped", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes6", + "name": "", + "type": "bytes6" + } + ], + "name": "testTyped", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint16", + "name": "", + "type": "uint16" + } + ], + "name": "testTyped", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes3", + "name": "", + "type": "bytes3" + } + ], + "name": "testTyped", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes17", + "name": "", + "type": "bytes17" + } + ], + "name": "testTyped", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "int224", + "name": "", + "type": "int224" + } + ], + "name": "testTyped", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "int128", + "name": "", + "type": "int128" + } + ], + "name": "testTyped", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes18", + "name": "", + "type": "bytes18" + } + ], + "name": "testTyped", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "int104", + "name": "", + "type": "int104" + } + ], + "name": "testTyped", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes7", + "name": "", + "type": "bytes7" + } + ], + "name": "testTyped", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes25", + "name": "", + "type": "bytes25" + } + ], + "name": "testTyped", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint40", + "name": "", + "type": "uint40" + } + ], + "name": "testTyped", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint120", + "name": "", + "type": "uint120" + } + ], + "name": "testTyped", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint168", + "name": "", + "type": "uint168" + } + ], + "name": "testTyped", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "int136", + "name": "", + "type": "int136" + } + ], + "name": "testTyped", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint248", + "name": "", + "type": "uint248" + } + ], + "name": "testTyped", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes8", + "name": "", + "type": "bytes8" + } + ], + "name": "testTyped", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "int192", + "name": "", + "type": "int192" + } + ], + "name": "testTyped", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "int216", + "name": "", + "type": "int216" + } + ], + "name": "testTyped", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "name": "testTyped", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint240", + "name": "", + "type": "uint240" + } + ], + "name": "testTyped", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint112", + "name": "", + "type": "uint112" + } + ], + "name": "testTyped", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes29", + "name": "", + "type": "bytes29" + } + ], + "name": "testTyped", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "int80", + "name": "", + "type": "int80" + } + ], + "name": "testTyped", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "int176", + "name": "", + "type": "int176" + } + ], + "name": "testTyped", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes31", + "name": "", + "type": "bytes31" + } + ], + "name": "testTyped", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "name": "testTyped", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint208", + "name": "", + "type": "uint208" + } + ], + "name": "testTyped", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint88", + "name": "", + "type": "uint88" + } + ], + "name": "testTyped", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes10", + "name": "", + "type": "bytes10" + } + ], + "name": "testTyped", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes16", + "name": "", + "type": "bytes16" + } + ], + "name": "testTyped", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "int88", + "name": "", + "type": "int88" + } + ], + "name": "testTyped", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint64", + "name": "", + "type": "uint64" + } + ], + "name": "testTyped", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "testTyped", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes12", + "name": "", + "type": "bytes12" + } + ], + "name": "testTyped", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes27", + "name": "", + "type": "bytes27" + } + ], + "name": "testTyped", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "int64", + "name": "", + "type": "int64" + } + ], + "name": "testTyped", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint136", + "name": "", + "type": "uint136" + } + ], + "name": "testTyped", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint232", + "name": "", + "type": "uint232" + } + ], + "name": "testTyped", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes26", + "name": "", + "type": "bytes26" + } + ], + "name": "testTyped", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes5", + "name": "", + "type": "bytes5" + } + ], + "name": "testTyped", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint48", + "name": "", + "type": "uint48" + } + ], + "name": "testTyped", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "int40", + "name": "", + "type": "int40" + } + ], + "name": "testTyped", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint96", + "name": "", + "type": "uint96" + } + ], + "name": "testTyped", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint160", + "name": "", + "type": "uint160" + } + ], + "name": "testTyped", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "int8", + "name": "", + "type": "int8" + } + ], + "name": "testTyped", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint72", + "name": "", + "type": "uint72" + } + ], + "name": "testTyped", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "int232", + "name": "", + "type": "int232" + } + ], + "name": "testTyped", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "name": "testTyped", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "testTyped", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "int16", + "name": "", + "type": "int16" + } + ], + "name": "testTyped", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes15", + "name": "", + "type": "bytes15" + } + ], + "name": "testTyped", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint56", + "name": "", + "type": "uint56" + } + ], + "name": "testTyped", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes23", + "name": "", + "type": "bytes23" + } + ], + "name": "testTyped", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "int240", + "name": "", + "type": "int240" + } + ], + "name": "testTyped", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "int160", + "name": "", + "type": "int160" + } + ], + "name": "testTyped", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint128", + "name": "", + "type": "uint128" + } + ], + "name": "testTyped", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "int48", + "name": "", + "type": "int48" + } + ], + "name": "testTyped", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "name": "testTyped", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes13", + "name": "", + "type": "bytes13" + } + ], + "name": "testTyped", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes22", + "name": "", + "type": "bytes22" + } + ], + "name": "testTyped", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "int256", + "name": "", + "type": "int256" + } + ], + "name": "testTyped", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes19", + "name": "", + "type": "bytes19" + } + ], + "name": "testTyped", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "int152", + "name": "", + "type": "int152" + } + ], + "name": "testTyped", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint144", + "name": "", + "type": "uint144" + } + ], + "name": "testTyped", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "name": "testTyped", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "int24", + "name": "", + "type": "int24" + } + ], + "name": "testTyped", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes11", + "name": "", + "type": "bytes11" + } + ], + "name": "testTyped", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "int56", + "name": "", + "type": "int56" + } + ], + "name": "testTyped", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "int144", + "name": "", + "type": "int144" + } + ], + "name": "testTyped", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes1", + "name": "", + "type": "bytes1" + } + ], + "name": "testTyped", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "pure", + "type": "function" + } + ], + "bytecode": "0x608060405234801561001057600080fd5b506134a7806100206000396000f3fe608060405234801561001057600080fd5b506004361061065c5760003560e01c8063a202e8c011610345578063cec31ded116101bd578063e96add8c11610104578063f3164597116100ad578063f85a090311610087578063f85a0903146120b7578063fa4d99c9146120fd578063fbf3e13a14612143578063fd1652cb1461218957600080fd5b8063f316459714611fe5578063f44076171461202b578063f7b0e3d51461207157600080fd5b8063eecd1129116100de578063eecd112914611f13578063ef4483be14611f59578063f0fb21ff14611f9f57600080fd5b8063e96add8c14611e41578063e9da42ca14611e87578063eb01940114611ecd57600080fd5b8063d92e6c0611610166578063e0fa6ea111610140578063e0fa6ea114611d6f578063e137fb7014611db5578063e8fb922314611dfb57600080fd5b8063d92e6c0614611c9d578063dad2ef4f14611ce3578063dafbc72414611d2957600080fd5b8063d4b789d811610197578063d4b789d814611bcb578063d4c0c48614611c11578063d7d7398414611c5757600080fd5b8063cec31ded14611af9578063d0e03b0714611b3f578063d20f679a14611b8557600080fd5b8063bbeb25e01161028c578063c233fd3311610235578063c84ad5801161020f578063c84ad580146119e1578063c8ddda4a14611a27578063cc69cf9714611a6d578063ccd94f9814611ab357600080fd5b8063c233fd331461190f578063c639604b14611955578063c847fe3b1461199b57600080fd5b8063c081607b11610266578063c081607b1461183d578063c1397e9914611883578063c1847bee146118c957600080fd5b8063bbeb25e01461176b578063bccdc9c4146117b1578063bf01c7f9146117f757600080fd5b8063ad87e2e1116102ee578063b860f47f116102c8578063b860f47f14611699578063ba607fac146116df578063bb73447f1461172557600080fd5b8063ad87e2e1146115c7578063b429b23c1461160d578063b7bab2861461165357600080fd5b8063a925e7621161031f578063a925e762146114f5578063a95d606e1461153b578063aa8de9461461158157600080fd5b8063a202e8c014611423578063a3ab9e7a14611469578063a6496f62146114af57600080fd5b806351e0489a116104d85780637c9affcb1161041f578063891a099d116103c85780639df2391c116103a25780639df2391c1461130b5780639faf388f146113515780639fcbede614611397578063a178b800146113dd57600080fd5b8063891a099d146112395780638e4884d11461127f5780639ded4e2b146112c557600080fd5b806381c4b4cc116103f957806381c4b4cc146111675780638275b290146111ad57806387ad7515146111f357600080fd5b80637c9affcb146110955780637fcc3d5d146110db578063803bf56d1461112157600080fd5b80636913a82b11610481578063769008e41161045b578063769008e414610fc35780637a3058c1146110095780637bc705c11461104f57600080fd5b80636913a82b14610ef15780636a678a7514610f3757806375b5533714610f7d57600080fd5b80636357d3b7116104b25780636357d3b714610e1f578063659665f914610e65578063679b530214610eab57600080fd5b806351e0489a14610d4d57806357301b0214610d935780635793d40814610dd957600080fd5b80632a0caa6a116105a7578063429545a4116105505780634961a7ce1161052a5780634961a7ce14610c355780634a3ccd5f14610c7b5780634fb7d4bd14610cc157806350fbcfb614610d0757600080fd5b8063429545a414610b6357806343c84f3314610ba957806346d79d1314610bef57600080fd5b806333c064151161058157806333c0641514610a9157806334bdbab714610ad75780634029cdee14610b1d57600080fd5b80632a0caa6a146109bf5780632a97dfbf14610a055780632f0d528b14610a4b57600080fd5b80631b46fa941161060957806325cb6b9a116105e357806325cb6b9a146108ed57806326888cda1461093357806328b01d811461097957600080fd5b80631b46fa941461081b5780631eb765fd1461086157806325bc2c82146108a757600080fd5b8063107810d51161063a578063107810d5146107495780631400a02f1461078f5780631a762a3a146107d557600080fd5b806303290450146106615780630e9ba011146106bd5780630f84821114610703575b600080fd5b6106a761066f3660046121cf565b5060408051808201909152600681527f75696e7433320000000000000000000000000000000000000000000000000000602082015290565b6040516106b491906121fc565b60405180910390f35b6106a76106cb36600461224a565b5060408051808201909152600781527f6279746573323400000000000000000000000000000000000000000000000000602082015290565b6106a7610711366004612275565b5060408051808201909152600681527f696e743230380000000000000000000000000000000000000000000000000000602082015290565b6106a7610757366004612298565b5060408051808201909152600781527f75696e7431373600000000000000000000000000000000000000000000000000602082015290565b6106a761079d3660046122d0565b5060408051808201909152600681527f6279746573340000000000000000000000000000000000000000000000000000602082015290565b6106a76107e3366004612312565b5060408051808201909152600681527f6279746573390000000000000000000000000000000000000000000000000000602082015290565b6106a7610829366004612354565b5060408051808201909152600581527f696e743732000000000000000000000000000000000000000000000000000000602082015290565b6106a761086f366004612377565b5060408051808201909152600781527f75696e7432303000000000000000000000000000000000000000000000000000602082015290565b6106a76108b53660046123b2565b5060408051808201909152600781527f6279746573323000000000000000000000000000000000000000000000000000602082015290565b6106a76108fb3660046123e1565b5060408051808201909152600581527f696e743332000000000000000000000000000000000000000000000000000000602082015290565b6106a7610941366004612404565b5060408051808201909152600781527f75696e7432313600000000000000000000000000000000000000000000000000602082015290565b6106a7610987366004612441565b5060408051808201909152600781527f75696e7431383400000000000000000000000000000000000000000000000000602082015290565b6106a76109cd36600461247a565b5060408051808201909152600781527f75696e7431353200000000000000000000000000000000000000000000000000602082015290565b6106a7610a133660046124af565b5060408051808201909152600681527f696e743234380000000000000000000000000000000000000000000000000000602082015290565b6106a7610a593660046124d2565b5060408051808201909152600681527f75696e7438300000000000000000000000000000000000000000000000000000602082015290565b6106a7610a9f3660046124fe565b5060408051808201909152600781527f6279746573323800000000000000000000000000000000000000000000000000602082015290565b6106a7610ae5366004612525565b5060408051808201909152600781527f6279746573333000000000000000000000000000000000000000000000000000602082015290565b6106a7610b2b36600461254a565b5060408051808201909152600681527f696e743132300000000000000000000000000000000000000000000000000000602082015290565b6106a7610b7136600461256d565b5060408051808201909152600781527f6279746573323100000000000000000000000000000000000000000000000000602082015290565b6106a7610bb736600461259b565b5060408051808201909152600781527f75696e7431303400000000000000000000000000000000000000000000000000602082015290565b6106a7610bfd3660046125ca565b5060408051808201909152600581527f696e743936000000000000000000000000000000000000000000000000000000602082015290565b6106a7610c433660046125ed565b5060408051808201909152600781527f75696e7432323400000000000000000000000000000000000000000000000000602082015290565b6106a7610c8936600461262b565b5060408051808201909152600681527f696e743136380000000000000000000000000000000000000000000000000000602082015290565b6106a7610ccf36600461264e565b5060408051808201909152600681527f696e743230300000000000000000000000000000000000000000000000000000602082015290565b6106a7610d15366004612671565b5060408051808201909152600681527f696e743138340000000000000000000000000000000000000000000000000000602082015290565b6106a7610d5b366004612694565b5060408051808201909152600781527f6279746573313400000000000000000000000000000000000000000000000000602082015290565b6106a7610da13660046126d6565b5060408051808201909152600781527f75696e7431393200000000000000000000000000000000000000000000000000602082015290565b6106a7610de7366004612710565b5060408051808201909152600681527f6279746573320000000000000000000000000000000000000000000000000000602082015290565b6106a7610e2d366004612752565b5060408051808201909152600681527f75696e7432340000000000000000000000000000000000000000000000000000602082015290565b6106a7610e73366004612777565b5060408051808201909152600681527f696e743131320000000000000000000000000000000000000000000000000000602082015290565b6106a7610eb936600461279a565b5060408051808201909152600681527f6279746573360000000000000000000000000000000000000000000000000000602082015290565b6106a7610eff3660046127dc565b5060408051808201909152600681527f75696e7431360000000000000000000000000000000000000000000000000000602082015290565b6106a7610f45366004612800565b5060408051808201909152600681527f6279746573330000000000000000000000000000000000000000000000000000602082015290565b6106a7610f8b366004612842565b5060408051808201909152600781527f6279746573313700000000000000000000000000000000000000000000000000602082015290565b6106a7610fd1366004612874565b5060408051808201909152600681527f696e743232340000000000000000000000000000000000000000000000000000602082015290565b6106a7611017366004612897565b5060408051808201909152600681527f696e743132380000000000000000000000000000000000000000000000000000602082015290565b6106a761105d3660046128ba565b5060408051808201909152600781527f6279746573313800000000000000000000000000000000000000000000000000602082015290565b6106a76110a33660046128eb565b5060408051808201909152600681527f696e743130340000000000000000000000000000000000000000000000000000602082015290565b6106a76110e936600461290e565b5060408051808201909152600681527f6279746573370000000000000000000000000000000000000000000000000000602082015290565b6106a761112f366004612950565b5060408051808201909152600781527f6279746573323500000000000000000000000000000000000000000000000000602082015290565b6106a761117536600461297a565b5060408051808201909152600681527f75696e7434300000000000000000000000000000000000000000000000000000602082015290565b6106a76111bb3660046129a1565b5060408051808201909152600781527f75696e7431323000000000000000000000000000000000000000000000000000602082015290565b6106a76112013660046129d2565b5060408051808201909152600781527f75696e7431363800000000000000000000000000000000000000000000000000602082015290565b6106a7611247366004612a09565b5060408051808201909152600681527f696e743133360000000000000000000000000000000000000000000000000000602082015290565b6106a761128d366004612a2c565b5060408051808201909152600781527f75696e7432343800000000000000000000000000000000000000000000000000602082015290565b6106a76112d3366004612a6d565b5060408051808201909152600681527f6279746573380000000000000000000000000000000000000000000000000000602082015290565b6106a7611319366004612aaf565b5060408051808201909152600681527f696e743139320000000000000000000000000000000000000000000000000000602082015290565b6106a761135f366004612ad2565b5060408051808201909152600681527f696e743231360000000000000000000000000000000000000000000000000000602082015290565b6106a76113a5366004612b9a565b5060408051808201909152600581527f6279746573000000000000000000000000000000000000000000000000000000602082015290565b6106a76113eb366004612beb565b5060408051808201909152600781527f75696e7432343000000000000000000000000000000000000000000000000000602082015290565b6106a7611431366004612c2b565b5060408051808201909152600781527f75696e7431313200000000000000000000000000000000000000000000000000602082015290565b6106a7611477366004612c5b565b5060408051808201909152600781527f6279746573323900000000000000000000000000000000000000000000000000602082015290565b6106a76114bd366004612c81565b5060408051808201909152600581527f696e743830000000000000000000000000000000000000000000000000000000602082015290565b6106a7611503366004612ca4565b5060408051808201909152600681527f696e743137360000000000000000000000000000000000000000000000000000602082015290565b6106a7611549366004612cc7565b5060408051808201909152600781527f6279746573333100000000000000000000000000000000000000000000000000602082015290565b6106a761158f366004612ceb565b5060408051808201909152600581527f75696e7438000000000000000000000000000000000000000000000000000000602082015290565b6106a76115d5366004612d0e565b5060408051808201909152600781527f75696e7432303800000000000000000000000000000000000000000000000000602082015290565b6106a761161b366004612d4a565b5060408051808201909152600681527f75696e7438380000000000000000000000000000000000000000000000000000602082015290565b6106a7611661366004612d77565b5060408051808201909152600781527f6279746573313000000000000000000000000000000000000000000000000000602082015290565b6106a76116a7366004612db9565b5060408051808201909152600781527f6279746573313600000000000000000000000000000000000000000000000000602082015290565b6106a76116ed366004612dfb565b5060408051808201909152600581527f696e743838000000000000000000000000000000000000000000000000000000602082015290565b6106a7611733366004612e1e565b5060408051808201909152600681527f75696e7436340000000000000000000000000000000000000000000000000000602082015290565b6106a7611779366004612e6d565b5060408051808201909152600781527f6164647265737300000000000000000000000000000000000000000000000000602082015290565b6106a76117bf366004612e8a565b5060408051808201909152600781527f6279746573313200000000000000000000000000000000000000000000000000602082015290565b6106a7611805366004612ecc565b5060408051808201909152600781527f6279746573323700000000000000000000000000000000000000000000000000602082015290565b6106a761184b366004612ef4565b5060408051808201909152600581527f696e743634000000000000000000000000000000000000000000000000000000602082015290565b6106a7611891366004612f17565b5060408051808201909152600781527f75696e7431333600000000000000000000000000000000000000000000000000602082015290565b6106a76118d7366004612f4a565b5060408051808201909152600781527f75696e7432333200000000000000000000000000000000000000000000000000602082015290565b6106a761191d366004612f89565b5060408051808201909152600781527f6279746573323600000000000000000000000000000000000000000000000000602082015290565b6106a7611963366004612fb2565b5060408051808201909152600681527f6279746573350000000000000000000000000000000000000000000000000000602082015290565b6106a76119a9366004612ff4565b5060408051808201909152600681527f75696e7434380000000000000000000000000000000000000000000000000000602082015290565b6106a76119ef36600461301c565b5060408051808201909152600581527f696e743430000000000000000000000000000000000000000000000000000000602082015290565b6106a7611a3536600461303f565b5060408051808201909152600681527f75696e7439360000000000000000000000000000000000000000000000000000602082015290565b6106a7611a7b366004612e6d565b5060408051808201909152600781527f75696e7431363000000000000000000000000000000000000000000000000000602082015290565b6106a7611ac136600461306d565b5060408051808201909152600481527f696e743800000000000000000000000000000000000000000000000000000000602082015290565b6106a7611b07366004613090565b5060408051808201909152600681527f75696e7437320000000000000000000000000000000000000000000000000000602082015290565b6106a7611b4d3660046130bb565b5060408051808201909152600681527f696e743233320000000000000000000000000000000000000000000000000000602082015290565b6106a7611b933660046130de565b5060408051808201909152600781527f6279746573333200000000000000000000000000000000000000000000000000602082015290565b6106a7611bd93660046130de565b5060408051808201909152600781527f75696e7432353600000000000000000000000000000000000000000000000000602082015290565b6106a7611c1f3660046130f7565b5060408051808201909152600581527f696e743136000000000000000000000000000000000000000000000000000000602082015290565b6106a7611c6536600461311a565b5060408051808201909152600781527f6279746573313500000000000000000000000000000000000000000000000000602082015290565b6106a7611cab36600461315c565b5060408051808201909152600681527f75696e7435360000000000000000000000000000000000000000000000000000602082015290565b6106a7611cf1366004613185565b5060408051808201909152600781527f6279746573323300000000000000000000000000000000000000000000000000602082015290565b6106a7611d373660046131b1565b5060408051808201909152600681527f696e743234300000000000000000000000000000000000000000000000000000602082015290565b6106a7611d7d3660046131d4565b5060408051808201909152600681527f696e743136300000000000000000000000000000000000000000000000000000602082015290565b6106a7611dc33660046131f7565b5060408051808201909152600781527f75696e7431323800000000000000000000000000000000000000000000000000602082015290565b6106a7611e09366004613229565b5060408051808201909152600581527f696e743438000000000000000000000000000000000000000000000000000000602082015290565b6106a7611e4f36600461324c565b5060408051808201909152600481527f626f6f6c00000000000000000000000000000000000000000000000000000000602082015290565b6106a7611e9536600461326e565b5060408051808201909152600781527f6279746573313300000000000000000000000000000000000000000000000000602082015290565b6106a7611edb3660046132b0565b5060408051808201909152600781527f6279746573323200000000000000000000000000000000000000000000000000602082015290565b6106a7611f213660046130de565b5060408051808201909152600681527f696e743235360000000000000000000000000000000000000000000000000000602082015290565b6106a7611f673660046132dd565b5060408051808201909152600781527f6279746573313900000000000000000000000000000000000000000000000000602082015290565b6106a7611fad36600461330d565b5060408051808201909152600681527f696e743135320000000000000000000000000000000000000000000000000000602082015290565b6106a7611ff3366004613330565b5060408051808201909152600781527f75696e7431343400000000000000000000000000000000000000000000000000602082015290565b6106a7612039366004612b9a565b5060408051808201909152600681527f737472696e670000000000000000000000000000000000000000000000000000602082015290565b6106a761207f366004613364565b5060408051808201909152600581527f696e743234000000000000000000000000000000000000000000000000000000602082015290565b6106a76120c5366004613387565b5060408051808201909152600781527f6279746573313100000000000000000000000000000000000000000000000000602082015290565b6106a761210b3660046133c9565b5060408051808201909152600581527f696e743536000000000000000000000000000000000000000000000000000000602082015290565b6106a76121513660046133ec565b5060408051808201909152600681527f696e743134340000000000000000000000000000000000000000000000000000602082015290565b6106a761219736600461340f565b5060408051808201909152600681527f6279746573310000000000000000000000000000000000000000000000000000602082015290565b6000602082840312156121e157600080fd5b813563ffffffff811681146121f557600080fd5b9392505050565b600060208083528351808285015260005b818110156122295785810183015185820160400152820161220d565b506000604082860101526040601f19601f8301168501019250505092915050565b60006020828403121561225c57600080fd5b813567ffffffffffffffff19811681146121f557600080fd5b60006020828403121561228757600080fd5b81358060190b81146121f557600080fd5b6000602082840312156122aa57600080fd5b813575ffffffffffffffffffffffffffffffffffffffffffff811681146121f557600080fd5b6000602082840312156122e257600080fd5b81357fffffffff00000000000000000000000000000000000000000000000000000000811681146121f557600080fd5b60006020828403121561232457600080fd5b81357fffffffffffffffffff0000000000000000000000000000000000000000000000811681146121f557600080fd5b60006020828403121561236657600080fd5b81358060080b81146121f557600080fd5b60006020828403121561238957600080fd5b813578ffffffffffffffffffffffffffffffffffffffffffffffffff811681146121f557600080fd5b6000602082840312156123c457600080fd5b81356bffffffffffffffffffffffff19811681146121f557600080fd5b6000602082840312156123f357600080fd5b81358060030b81146121f557600080fd5b60006020828403121561241657600080fd5b81357affffffffffffffffffffffffffffffffffffffffffffffffffffff811681146121f557600080fd5b60006020828403121561245357600080fd5b813576ffffffffffffffffffffffffffffffffffffffffffffff811681146121f557600080fd5b60006020828403121561248c57600080fd5b813572ffffffffffffffffffffffffffffffffffffff811681146121f557600080fd5b6000602082840312156124c157600080fd5b813580601e0b81146121f557600080fd5b6000602082840312156124e457600080fd5b813569ffffffffffffffffffff811681146121f557600080fd5b60006020828403121561251057600080fd5b813563ffffffff19811681146121f557600080fd5b60006020828403121561253757600080fd5b813561ffff19811681146121f557600080fd5b60006020828403121561255c57600080fd5b813580600e0b81146121f557600080fd5b60006020828403121561257f57600080fd5b81356affffffffffffffffffffff19811681146121f557600080fd5b6000602082840312156125ad57600080fd5b81356cffffffffffffffffffffffffff811681146121f557600080fd5b6000602082840312156125dc57600080fd5b813580600b0b81146121f557600080fd5b6000602082840312156125ff57600080fd5b81357bffffffffffffffffffffffffffffffffffffffffffffffffffffffff811681146121f557600080fd5b60006020828403121561263d57600080fd5b81358060140b81146121f557600080fd5b60006020828403121561266057600080fd5b81358060180b81146121f557600080fd5b60006020828403121561268357600080fd5b81358060160b81146121f557600080fd5b6000602082840312156126a657600080fd5b81357fffffffffffffffffffffffffffff000000000000000000000000000000000000811681146121f557600080fd5b6000602082840312156126e857600080fd5b813577ffffffffffffffffffffffffffffffffffffffffffffffff811681146121f557600080fd5b60006020828403121561272257600080fd5b81357fffff000000000000000000000000000000000000000000000000000000000000811681146121f557600080fd5b60006020828403121561276457600080fd5b813562ffffff811681146121f557600080fd5b60006020828403121561278957600080fd5b813580600d0b81146121f557600080fd5b6000602082840312156127ac57600080fd5b81357fffffffffffff0000000000000000000000000000000000000000000000000000811681146121f557600080fd5b6000602082840312156127ee57600080fd5b813561ffff811681146121f557600080fd5b60006020828403121561281257600080fd5b81357fffffff0000000000000000000000000000000000000000000000000000000000811681146121f557600080fd5b60006020828403121561285457600080fd5b81356effffffffffffffffffffffffffffff19811681146121f557600080fd5b60006020828403121561288657600080fd5b813580601b0b81146121f557600080fd5b6000602082840312156128a957600080fd5b813580600f0b81146121f557600080fd5b6000602082840312156128cc57600080fd5b81356dffffffffffffffffffffffffffff19811681146121f557600080fd5b6000602082840312156128fd57600080fd5b813580600c0b81146121f557600080fd5b60006020828403121561292057600080fd5b81357fffffffffffffff00000000000000000000000000000000000000000000000000811681146121f557600080fd5b60006020828403121561296257600080fd5b813566ffffffffffffff19811681146121f557600080fd5b60006020828403121561298c57600080fd5b813564ffffffffff811681146121f557600080fd5b6000602082840312156129b357600080fd5b81356effffffffffffffffffffffffffffff811681146121f557600080fd5b6000602082840312156129e457600080fd5b813574ffffffffffffffffffffffffffffffffffffffffff811681146121f557600080fd5b600060208284031215612a1b57600080fd5b81358060100b81146121f557600080fd5b600060208284031215612a3e57600080fd5b81357effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff811681146121f557600080fd5b600060208284031215612a7f57600080fd5b81357fffffffffffffffff000000000000000000000000000000000000000000000000811681146121f557600080fd5b600060208284031215612ac157600080fd5b81358060170b81146121f557600080fd5b600060208284031215612ae457600080fd5b813580601a0b81146121f557600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600067ffffffffffffffff80841115612b3f57612b3f612af5565b604051601f8501601f19908116603f01168101908282118183101715612b6757612b67612af5565b81604052809350858152868686011115612b8057600080fd5b858560208301376000602087830101525050509392505050565b600060208284031215612bac57600080fd5b813567ffffffffffffffff811115612bc357600080fd5b8201601f81018413612bd457600080fd5b612be384823560208401612b24565b949350505050565b600060208284031215612bfd57600080fd5b81357dffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff811681146121f557600080fd5b600060208284031215612c3d57600080fd5b81356dffffffffffffffffffffffffffff811681146121f557600080fd5b600060208284031215612c6d57600080fd5b813562ffffff19811681146121f557600080fd5b600060208284031215612c9357600080fd5b81358060090b81146121f557600080fd5b600060208284031215612cb657600080fd5b81358060150b81146121f557600080fd5b600060208284031215612cd957600080fd5b813560ff19811681146121f557600080fd5b600060208284031215612cfd57600080fd5b813560ff811681146121f557600080fd5b600060208284031215612d2057600080fd5b813579ffffffffffffffffffffffffffffffffffffffffffffffffffff811681146121f557600080fd5b600060208284031215612d5c57600080fd5b81356affffffffffffffffffffff811681146121f557600080fd5b600060208284031215612d8957600080fd5b81357fffffffffffffffffffff00000000000000000000000000000000000000000000811681146121f557600080fd5b600060208284031215612dcb57600080fd5b81357fffffffffffffffffffffffffffffffff00000000000000000000000000000000811681146121f557600080fd5b600060208284031215612e0d57600080fd5b813580600a0b81146121f557600080fd5b600060208284031215612e3057600080fd5b813567ffffffffffffffff811681146121f557600080fd5b73ffffffffffffffffffffffffffffffffffffffff81168114612e6a57600080fd5b50565b600060208284031215612e7f57600080fd5b81356121f581612e48565b600060208284031215612e9c57600080fd5b81357fffffffffffffffffffffffff0000000000000000000000000000000000000000811681146121f557600080fd5b600060208284031215612ede57600080fd5b813564ffffffffff19811681146121f557600080fd5b600060208284031215612f0657600080fd5b81358060070b81146121f557600080fd5b600060208284031215612f2957600080fd5b813570ffffffffffffffffffffffffffffffffff811681146121f557600080fd5b600060208284031215612f5c57600080fd5b81357cffffffffffffffffffffffffffffffffffffffffffffffffffffffffff811681146121f557600080fd5b600060208284031215612f9b57600080fd5b813565ffffffffffff19811681146121f557600080fd5b600060208284031215612fc457600080fd5b81357fffffffffff000000000000000000000000000000000000000000000000000000811681146121f557600080fd5b60006020828403121561300657600080fd5b813565ffffffffffff811681146121f557600080fd5b60006020828403121561302e57600080fd5b81358060040b81146121f557600080fd5b60006020828403121561305157600080fd5b81356bffffffffffffffffffffffff811681146121f557600080fd5b60006020828403121561307f57600080fd5b81358060000b81146121f557600080fd5b6000602082840312156130a257600080fd5b813568ffffffffffffffffff811681146121f557600080fd5b6000602082840312156130cd57600080fd5b813580601c0b81146121f557600080fd5b6000602082840312156130f057600080fd5b5035919050565b60006020828403121561310957600080fd5b81358060010b81146121f557600080fd5b60006020828403121561312c57600080fd5b81357fffffffffffffffffffffffffffffff0000000000000000000000000000000000811681146121f557600080fd5b60006020828403121561316e57600080fd5b813566ffffffffffffff811681146121f557600080fd5b60006020828403121561319757600080fd5b813568ffffffffffffffffff19811681146121f557600080fd5b6000602082840312156131c357600080fd5b813580601d0b81146121f557600080fd5b6000602082840312156131e657600080fd5b81358060130b81146121f557600080fd5b60006020828403121561320957600080fd5b81356fffffffffffffffffffffffffffffffff811681146121f557600080fd5b60006020828403121561323b57600080fd5b81358060050b81146121f557600080fd5b60006020828403121561325e57600080fd5b813580151581146121f557600080fd5b60006020828403121561328057600080fd5b81357fffffffffffffffffffffffffff00000000000000000000000000000000000000811681146121f557600080fd5b6000602082840312156132c257600080fd5b813569ffffffffffffffffffff19811681146121f557600080fd5b6000602082840312156132ef57600080fd5b81356cffffffffffffffffffffffffff19811681146121f557600080fd5b60006020828403121561331f57600080fd5b81358060120b81146121f557600080fd5b60006020828403121561334257600080fd5b813571ffffffffffffffffffffffffffffffffffff811681146121f557600080fd5b60006020828403121561337657600080fd5b81358060020b81146121f557600080fd5b60006020828403121561339957600080fd5b81357fffffffffffffffffffffff000000000000000000000000000000000000000000811681146121f557600080fd5b6000602082840312156133db57600080fd5b81358060060b81146121f557600080fd5b6000602082840312156133fe57600080fd5b81358060110b81146121f557600080fd5b60006020828403121561342157600080fd5b81357fff00000000000000000000000000000000000000000000000000000000000000811681146121f557600080fdfea2646970667358221220c03630ca6910d46ede5cae5ed1f6ae9571e1ccb99a0b3b83f560d5c9079c96db64736f6c637822302e382e31392d646576656c6f702b636f6d6d69742e63383866343066642e6d6f640053", + "deployedBytecode": "0x608060405234801561001057600080fd5b506004361061065c5760003560e01c8063a202e8c011610345578063cec31ded116101bd578063e96add8c11610104578063f3164597116100ad578063f85a090311610087578063f85a0903146120b7578063fa4d99c9146120fd578063fbf3e13a14612143578063fd1652cb1461218957600080fd5b8063f316459714611fe5578063f44076171461202b578063f7b0e3d51461207157600080fd5b8063eecd1129116100de578063eecd112914611f13578063ef4483be14611f59578063f0fb21ff14611f9f57600080fd5b8063e96add8c14611e41578063e9da42ca14611e87578063eb01940114611ecd57600080fd5b8063d92e6c0611610166578063e0fa6ea111610140578063e0fa6ea114611d6f578063e137fb7014611db5578063e8fb922314611dfb57600080fd5b8063d92e6c0614611c9d578063dad2ef4f14611ce3578063dafbc72414611d2957600080fd5b8063d4b789d811610197578063d4b789d814611bcb578063d4c0c48614611c11578063d7d7398414611c5757600080fd5b8063cec31ded14611af9578063d0e03b0714611b3f578063d20f679a14611b8557600080fd5b8063bbeb25e01161028c578063c233fd3311610235578063c84ad5801161020f578063c84ad580146119e1578063c8ddda4a14611a27578063cc69cf9714611a6d578063ccd94f9814611ab357600080fd5b8063c233fd331461190f578063c639604b14611955578063c847fe3b1461199b57600080fd5b8063c081607b11610266578063c081607b1461183d578063c1397e9914611883578063c1847bee146118c957600080fd5b8063bbeb25e01461176b578063bccdc9c4146117b1578063bf01c7f9146117f757600080fd5b8063ad87e2e1116102ee578063b860f47f116102c8578063b860f47f14611699578063ba607fac146116df578063bb73447f1461172557600080fd5b8063ad87e2e1146115c7578063b429b23c1461160d578063b7bab2861461165357600080fd5b8063a925e7621161031f578063a925e762146114f5578063a95d606e1461153b578063aa8de9461461158157600080fd5b8063a202e8c014611423578063a3ab9e7a14611469578063a6496f62146114af57600080fd5b806351e0489a116104d85780637c9affcb1161041f578063891a099d116103c85780639df2391c116103a25780639df2391c1461130b5780639faf388f146113515780639fcbede614611397578063a178b800146113dd57600080fd5b8063891a099d146112395780638e4884d11461127f5780639ded4e2b146112c557600080fd5b806381c4b4cc116103f957806381c4b4cc146111675780638275b290146111ad57806387ad7515146111f357600080fd5b80637c9affcb146110955780637fcc3d5d146110db578063803bf56d1461112157600080fd5b80636913a82b11610481578063769008e41161045b578063769008e414610fc35780637a3058c1146110095780637bc705c11461104f57600080fd5b80636913a82b14610ef15780636a678a7514610f3757806375b5533714610f7d57600080fd5b80636357d3b7116104b25780636357d3b714610e1f578063659665f914610e65578063679b530214610eab57600080fd5b806351e0489a14610d4d57806357301b0214610d935780635793d40814610dd957600080fd5b80632a0caa6a116105a7578063429545a4116105505780634961a7ce1161052a5780634961a7ce14610c355780634a3ccd5f14610c7b5780634fb7d4bd14610cc157806350fbcfb614610d0757600080fd5b8063429545a414610b6357806343c84f3314610ba957806346d79d1314610bef57600080fd5b806333c064151161058157806333c0641514610a9157806334bdbab714610ad75780634029cdee14610b1d57600080fd5b80632a0caa6a146109bf5780632a97dfbf14610a055780632f0d528b14610a4b57600080fd5b80631b46fa941161060957806325cb6b9a116105e357806325cb6b9a146108ed57806326888cda1461093357806328b01d811461097957600080fd5b80631b46fa941461081b5780631eb765fd1461086157806325bc2c82146108a757600080fd5b8063107810d51161063a578063107810d5146107495780631400a02f1461078f5780631a762a3a146107d557600080fd5b806303290450146106615780630e9ba011146106bd5780630f84821114610703575b600080fd5b6106a761066f3660046121cf565b5060408051808201909152600681527f75696e7433320000000000000000000000000000000000000000000000000000602082015290565b6040516106b491906121fc565b60405180910390f35b6106a76106cb36600461224a565b5060408051808201909152600781527f6279746573323400000000000000000000000000000000000000000000000000602082015290565b6106a7610711366004612275565b5060408051808201909152600681527f696e743230380000000000000000000000000000000000000000000000000000602082015290565b6106a7610757366004612298565b5060408051808201909152600781527f75696e7431373600000000000000000000000000000000000000000000000000602082015290565b6106a761079d3660046122d0565b5060408051808201909152600681527f6279746573340000000000000000000000000000000000000000000000000000602082015290565b6106a76107e3366004612312565b5060408051808201909152600681527f6279746573390000000000000000000000000000000000000000000000000000602082015290565b6106a7610829366004612354565b5060408051808201909152600581527f696e743732000000000000000000000000000000000000000000000000000000602082015290565b6106a761086f366004612377565b5060408051808201909152600781527f75696e7432303000000000000000000000000000000000000000000000000000602082015290565b6106a76108b53660046123b2565b5060408051808201909152600781527f6279746573323000000000000000000000000000000000000000000000000000602082015290565b6106a76108fb3660046123e1565b5060408051808201909152600581527f696e743332000000000000000000000000000000000000000000000000000000602082015290565b6106a7610941366004612404565b5060408051808201909152600781527f75696e7432313600000000000000000000000000000000000000000000000000602082015290565b6106a7610987366004612441565b5060408051808201909152600781527f75696e7431383400000000000000000000000000000000000000000000000000602082015290565b6106a76109cd36600461247a565b5060408051808201909152600781527f75696e7431353200000000000000000000000000000000000000000000000000602082015290565b6106a7610a133660046124af565b5060408051808201909152600681527f696e743234380000000000000000000000000000000000000000000000000000602082015290565b6106a7610a593660046124d2565b5060408051808201909152600681527f75696e7438300000000000000000000000000000000000000000000000000000602082015290565b6106a7610a9f3660046124fe565b5060408051808201909152600781527f6279746573323800000000000000000000000000000000000000000000000000602082015290565b6106a7610ae5366004612525565b5060408051808201909152600781527f6279746573333000000000000000000000000000000000000000000000000000602082015290565b6106a7610b2b36600461254a565b5060408051808201909152600681527f696e743132300000000000000000000000000000000000000000000000000000602082015290565b6106a7610b7136600461256d565b5060408051808201909152600781527f6279746573323100000000000000000000000000000000000000000000000000602082015290565b6106a7610bb736600461259b565b5060408051808201909152600781527f75696e7431303400000000000000000000000000000000000000000000000000602082015290565b6106a7610bfd3660046125ca565b5060408051808201909152600581527f696e743936000000000000000000000000000000000000000000000000000000602082015290565b6106a7610c433660046125ed565b5060408051808201909152600781527f75696e7432323400000000000000000000000000000000000000000000000000602082015290565b6106a7610c8936600461262b565b5060408051808201909152600681527f696e743136380000000000000000000000000000000000000000000000000000602082015290565b6106a7610ccf36600461264e565b5060408051808201909152600681527f696e743230300000000000000000000000000000000000000000000000000000602082015290565b6106a7610d15366004612671565b5060408051808201909152600681527f696e743138340000000000000000000000000000000000000000000000000000602082015290565b6106a7610d5b366004612694565b5060408051808201909152600781527f6279746573313400000000000000000000000000000000000000000000000000602082015290565b6106a7610da13660046126d6565b5060408051808201909152600781527f75696e7431393200000000000000000000000000000000000000000000000000602082015290565b6106a7610de7366004612710565b5060408051808201909152600681527f6279746573320000000000000000000000000000000000000000000000000000602082015290565b6106a7610e2d366004612752565b5060408051808201909152600681527f75696e7432340000000000000000000000000000000000000000000000000000602082015290565b6106a7610e73366004612777565b5060408051808201909152600681527f696e743131320000000000000000000000000000000000000000000000000000602082015290565b6106a7610eb936600461279a565b5060408051808201909152600681527f6279746573360000000000000000000000000000000000000000000000000000602082015290565b6106a7610eff3660046127dc565b5060408051808201909152600681527f75696e7431360000000000000000000000000000000000000000000000000000602082015290565b6106a7610f45366004612800565b5060408051808201909152600681527f6279746573330000000000000000000000000000000000000000000000000000602082015290565b6106a7610f8b366004612842565b5060408051808201909152600781527f6279746573313700000000000000000000000000000000000000000000000000602082015290565b6106a7610fd1366004612874565b5060408051808201909152600681527f696e743232340000000000000000000000000000000000000000000000000000602082015290565b6106a7611017366004612897565b5060408051808201909152600681527f696e743132380000000000000000000000000000000000000000000000000000602082015290565b6106a761105d3660046128ba565b5060408051808201909152600781527f6279746573313800000000000000000000000000000000000000000000000000602082015290565b6106a76110a33660046128eb565b5060408051808201909152600681527f696e743130340000000000000000000000000000000000000000000000000000602082015290565b6106a76110e936600461290e565b5060408051808201909152600681527f6279746573370000000000000000000000000000000000000000000000000000602082015290565b6106a761112f366004612950565b5060408051808201909152600781527f6279746573323500000000000000000000000000000000000000000000000000602082015290565b6106a761117536600461297a565b5060408051808201909152600681527f75696e7434300000000000000000000000000000000000000000000000000000602082015290565b6106a76111bb3660046129a1565b5060408051808201909152600781527f75696e7431323000000000000000000000000000000000000000000000000000602082015290565b6106a76112013660046129d2565b5060408051808201909152600781527f75696e7431363800000000000000000000000000000000000000000000000000602082015290565b6106a7611247366004612a09565b5060408051808201909152600681527f696e743133360000000000000000000000000000000000000000000000000000602082015290565b6106a761128d366004612a2c565b5060408051808201909152600781527f75696e7432343800000000000000000000000000000000000000000000000000602082015290565b6106a76112d3366004612a6d565b5060408051808201909152600681527f6279746573380000000000000000000000000000000000000000000000000000602082015290565b6106a7611319366004612aaf565b5060408051808201909152600681527f696e743139320000000000000000000000000000000000000000000000000000602082015290565b6106a761135f366004612ad2565b5060408051808201909152600681527f696e743231360000000000000000000000000000000000000000000000000000602082015290565b6106a76113a5366004612b9a565b5060408051808201909152600581527f6279746573000000000000000000000000000000000000000000000000000000602082015290565b6106a76113eb366004612beb565b5060408051808201909152600781527f75696e7432343000000000000000000000000000000000000000000000000000602082015290565b6106a7611431366004612c2b565b5060408051808201909152600781527f75696e7431313200000000000000000000000000000000000000000000000000602082015290565b6106a7611477366004612c5b565b5060408051808201909152600781527f6279746573323900000000000000000000000000000000000000000000000000602082015290565b6106a76114bd366004612c81565b5060408051808201909152600581527f696e743830000000000000000000000000000000000000000000000000000000602082015290565b6106a7611503366004612ca4565b5060408051808201909152600681527f696e743137360000000000000000000000000000000000000000000000000000602082015290565b6106a7611549366004612cc7565b5060408051808201909152600781527f6279746573333100000000000000000000000000000000000000000000000000602082015290565b6106a761158f366004612ceb565b5060408051808201909152600581527f75696e7438000000000000000000000000000000000000000000000000000000602082015290565b6106a76115d5366004612d0e565b5060408051808201909152600781527f75696e7432303800000000000000000000000000000000000000000000000000602082015290565b6106a761161b366004612d4a565b5060408051808201909152600681527f75696e7438380000000000000000000000000000000000000000000000000000602082015290565b6106a7611661366004612d77565b5060408051808201909152600781527f6279746573313000000000000000000000000000000000000000000000000000602082015290565b6106a76116a7366004612db9565b5060408051808201909152600781527f6279746573313600000000000000000000000000000000000000000000000000602082015290565b6106a76116ed366004612dfb565b5060408051808201909152600581527f696e743838000000000000000000000000000000000000000000000000000000602082015290565b6106a7611733366004612e1e565b5060408051808201909152600681527f75696e7436340000000000000000000000000000000000000000000000000000602082015290565b6106a7611779366004612e6d565b5060408051808201909152600781527f6164647265737300000000000000000000000000000000000000000000000000602082015290565b6106a76117bf366004612e8a565b5060408051808201909152600781527f6279746573313200000000000000000000000000000000000000000000000000602082015290565b6106a7611805366004612ecc565b5060408051808201909152600781527f6279746573323700000000000000000000000000000000000000000000000000602082015290565b6106a761184b366004612ef4565b5060408051808201909152600581527f696e743634000000000000000000000000000000000000000000000000000000602082015290565b6106a7611891366004612f17565b5060408051808201909152600781527f75696e7431333600000000000000000000000000000000000000000000000000602082015290565b6106a76118d7366004612f4a565b5060408051808201909152600781527f75696e7432333200000000000000000000000000000000000000000000000000602082015290565b6106a761191d366004612f89565b5060408051808201909152600781527f6279746573323600000000000000000000000000000000000000000000000000602082015290565b6106a7611963366004612fb2565b5060408051808201909152600681527f6279746573350000000000000000000000000000000000000000000000000000602082015290565b6106a76119a9366004612ff4565b5060408051808201909152600681527f75696e7434380000000000000000000000000000000000000000000000000000602082015290565b6106a76119ef36600461301c565b5060408051808201909152600581527f696e743430000000000000000000000000000000000000000000000000000000602082015290565b6106a7611a3536600461303f565b5060408051808201909152600681527f75696e7439360000000000000000000000000000000000000000000000000000602082015290565b6106a7611a7b366004612e6d565b5060408051808201909152600781527f75696e7431363000000000000000000000000000000000000000000000000000602082015290565b6106a7611ac136600461306d565b5060408051808201909152600481527f696e743800000000000000000000000000000000000000000000000000000000602082015290565b6106a7611b07366004613090565b5060408051808201909152600681527f75696e7437320000000000000000000000000000000000000000000000000000602082015290565b6106a7611b4d3660046130bb565b5060408051808201909152600681527f696e743233320000000000000000000000000000000000000000000000000000602082015290565b6106a7611b933660046130de565b5060408051808201909152600781527f6279746573333200000000000000000000000000000000000000000000000000602082015290565b6106a7611bd93660046130de565b5060408051808201909152600781527f75696e7432353600000000000000000000000000000000000000000000000000602082015290565b6106a7611c1f3660046130f7565b5060408051808201909152600581527f696e743136000000000000000000000000000000000000000000000000000000602082015290565b6106a7611c6536600461311a565b5060408051808201909152600781527f6279746573313500000000000000000000000000000000000000000000000000602082015290565b6106a7611cab36600461315c565b5060408051808201909152600681527f75696e7435360000000000000000000000000000000000000000000000000000602082015290565b6106a7611cf1366004613185565b5060408051808201909152600781527f6279746573323300000000000000000000000000000000000000000000000000602082015290565b6106a7611d373660046131b1565b5060408051808201909152600681527f696e743234300000000000000000000000000000000000000000000000000000602082015290565b6106a7611d7d3660046131d4565b5060408051808201909152600681527f696e743136300000000000000000000000000000000000000000000000000000602082015290565b6106a7611dc33660046131f7565b5060408051808201909152600781527f75696e7431323800000000000000000000000000000000000000000000000000602082015290565b6106a7611e09366004613229565b5060408051808201909152600581527f696e743438000000000000000000000000000000000000000000000000000000602082015290565b6106a7611e4f36600461324c565b5060408051808201909152600481527f626f6f6c00000000000000000000000000000000000000000000000000000000602082015290565b6106a7611e9536600461326e565b5060408051808201909152600781527f6279746573313300000000000000000000000000000000000000000000000000602082015290565b6106a7611edb3660046132b0565b5060408051808201909152600781527f6279746573323200000000000000000000000000000000000000000000000000602082015290565b6106a7611f213660046130de565b5060408051808201909152600681527f696e743235360000000000000000000000000000000000000000000000000000602082015290565b6106a7611f673660046132dd565b5060408051808201909152600781527f6279746573313900000000000000000000000000000000000000000000000000602082015290565b6106a7611fad36600461330d565b5060408051808201909152600681527f696e743135320000000000000000000000000000000000000000000000000000602082015290565b6106a7611ff3366004613330565b5060408051808201909152600781527f75696e7431343400000000000000000000000000000000000000000000000000602082015290565b6106a7612039366004612b9a565b5060408051808201909152600681527f737472696e670000000000000000000000000000000000000000000000000000602082015290565b6106a761207f366004613364565b5060408051808201909152600581527f696e743234000000000000000000000000000000000000000000000000000000602082015290565b6106a76120c5366004613387565b5060408051808201909152600781527f6279746573313100000000000000000000000000000000000000000000000000602082015290565b6106a761210b3660046133c9565b5060408051808201909152600581527f696e743536000000000000000000000000000000000000000000000000000000602082015290565b6106a76121513660046133ec565b5060408051808201909152600681527f696e743134340000000000000000000000000000000000000000000000000000602082015290565b6106a761219736600461340f565b5060408051808201909152600681527f6279746573310000000000000000000000000000000000000000000000000000602082015290565b6000602082840312156121e157600080fd5b813563ffffffff811681146121f557600080fd5b9392505050565b600060208083528351808285015260005b818110156122295785810183015185820160400152820161220d565b506000604082860101526040601f19601f8301168501019250505092915050565b60006020828403121561225c57600080fd5b813567ffffffffffffffff19811681146121f557600080fd5b60006020828403121561228757600080fd5b81358060190b81146121f557600080fd5b6000602082840312156122aa57600080fd5b813575ffffffffffffffffffffffffffffffffffffffffffff811681146121f557600080fd5b6000602082840312156122e257600080fd5b81357fffffffff00000000000000000000000000000000000000000000000000000000811681146121f557600080fd5b60006020828403121561232457600080fd5b81357fffffffffffffffffff0000000000000000000000000000000000000000000000811681146121f557600080fd5b60006020828403121561236657600080fd5b81358060080b81146121f557600080fd5b60006020828403121561238957600080fd5b813578ffffffffffffffffffffffffffffffffffffffffffffffffff811681146121f557600080fd5b6000602082840312156123c457600080fd5b81356bffffffffffffffffffffffff19811681146121f557600080fd5b6000602082840312156123f357600080fd5b81358060030b81146121f557600080fd5b60006020828403121561241657600080fd5b81357affffffffffffffffffffffffffffffffffffffffffffffffffffff811681146121f557600080fd5b60006020828403121561245357600080fd5b813576ffffffffffffffffffffffffffffffffffffffffffffff811681146121f557600080fd5b60006020828403121561248c57600080fd5b813572ffffffffffffffffffffffffffffffffffffff811681146121f557600080fd5b6000602082840312156124c157600080fd5b813580601e0b81146121f557600080fd5b6000602082840312156124e457600080fd5b813569ffffffffffffffffffff811681146121f557600080fd5b60006020828403121561251057600080fd5b813563ffffffff19811681146121f557600080fd5b60006020828403121561253757600080fd5b813561ffff19811681146121f557600080fd5b60006020828403121561255c57600080fd5b813580600e0b81146121f557600080fd5b60006020828403121561257f57600080fd5b81356affffffffffffffffffffff19811681146121f557600080fd5b6000602082840312156125ad57600080fd5b81356cffffffffffffffffffffffffff811681146121f557600080fd5b6000602082840312156125dc57600080fd5b813580600b0b81146121f557600080fd5b6000602082840312156125ff57600080fd5b81357bffffffffffffffffffffffffffffffffffffffffffffffffffffffff811681146121f557600080fd5b60006020828403121561263d57600080fd5b81358060140b81146121f557600080fd5b60006020828403121561266057600080fd5b81358060180b81146121f557600080fd5b60006020828403121561268357600080fd5b81358060160b81146121f557600080fd5b6000602082840312156126a657600080fd5b81357fffffffffffffffffffffffffffff000000000000000000000000000000000000811681146121f557600080fd5b6000602082840312156126e857600080fd5b813577ffffffffffffffffffffffffffffffffffffffffffffffff811681146121f557600080fd5b60006020828403121561272257600080fd5b81357fffff000000000000000000000000000000000000000000000000000000000000811681146121f557600080fd5b60006020828403121561276457600080fd5b813562ffffff811681146121f557600080fd5b60006020828403121561278957600080fd5b813580600d0b81146121f557600080fd5b6000602082840312156127ac57600080fd5b81357fffffffffffff0000000000000000000000000000000000000000000000000000811681146121f557600080fd5b6000602082840312156127ee57600080fd5b813561ffff811681146121f557600080fd5b60006020828403121561281257600080fd5b81357fffffff0000000000000000000000000000000000000000000000000000000000811681146121f557600080fd5b60006020828403121561285457600080fd5b81356effffffffffffffffffffffffffffff19811681146121f557600080fd5b60006020828403121561288657600080fd5b813580601b0b81146121f557600080fd5b6000602082840312156128a957600080fd5b813580600f0b81146121f557600080fd5b6000602082840312156128cc57600080fd5b81356dffffffffffffffffffffffffffff19811681146121f557600080fd5b6000602082840312156128fd57600080fd5b813580600c0b81146121f557600080fd5b60006020828403121561292057600080fd5b81357fffffffffffffff00000000000000000000000000000000000000000000000000811681146121f557600080fd5b60006020828403121561296257600080fd5b813566ffffffffffffff19811681146121f557600080fd5b60006020828403121561298c57600080fd5b813564ffffffffff811681146121f557600080fd5b6000602082840312156129b357600080fd5b81356effffffffffffffffffffffffffffff811681146121f557600080fd5b6000602082840312156129e457600080fd5b813574ffffffffffffffffffffffffffffffffffffffffff811681146121f557600080fd5b600060208284031215612a1b57600080fd5b81358060100b81146121f557600080fd5b600060208284031215612a3e57600080fd5b81357effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff811681146121f557600080fd5b600060208284031215612a7f57600080fd5b81357fffffffffffffffff000000000000000000000000000000000000000000000000811681146121f557600080fd5b600060208284031215612ac157600080fd5b81358060170b81146121f557600080fd5b600060208284031215612ae457600080fd5b813580601a0b81146121f557600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600067ffffffffffffffff80841115612b3f57612b3f612af5565b604051601f8501601f19908116603f01168101908282118183101715612b6757612b67612af5565b81604052809350858152868686011115612b8057600080fd5b858560208301376000602087830101525050509392505050565b600060208284031215612bac57600080fd5b813567ffffffffffffffff811115612bc357600080fd5b8201601f81018413612bd457600080fd5b612be384823560208401612b24565b949350505050565b600060208284031215612bfd57600080fd5b81357dffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff811681146121f557600080fd5b600060208284031215612c3d57600080fd5b81356dffffffffffffffffffffffffffff811681146121f557600080fd5b600060208284031215612c6d57600080fd5b813562ffffff19811681146121f557600080fd5b600060208284031215612c9357600080fd5b81358060090b81146121f557600080fd5b600060208284031215612cb657600080fd5b81358060150b81146121f557600080fd5b600060208284031215612cd957600080fd5b813560ff19811681146121f557600080fd5b600060208284031215612cfd57600080fd5b813560ff811681146121f557600080fd5b600060208284031215612d2057600080fd5b813579ffffffffffffffffffffffffffffffffffffffffffffffffffff811681146121f557600080fd5b600060208284031215612d5c57600080fd5b81356affffffffffffffffffffff811681146121f557600080fd5b600060208284031215612d8957600080fd5b81357fffffffffffffffffffff00000000000000000000000000000000000000000000811681146121f557600080fd5b600060208284031215612dcb57600080fd5b81357fffffffffffffffffffffffffffffffff00000000000000000000000000000000811681146121f557600080fd5b600060208284031215612e0d57600080fd5b813580600a0b81146121f557600080fd5b600060208284031215612e3057600080fd5b813567ffffffffffffffff811681146121f557600080fd5b73ffffffffffffffffffffffffffffffffffffffff81168114612e6a57600080fd5b50565b600060208284031215612e7f57600080fd5b81356121f581612e48565b600060208284031215612e9c57600080fd5b81357fffffffffffffffffffffffff0000000000000000000000000000000000000000811681146121f557600080fd5b600060208284031215612ede57600080fd5b813564ffffffffff19811681146121f557600080fd5b600060208284031215612f0657600080fd5b81358060070b81146121f557600080fd5b600060208284031215612f2957600080fd5b813570ffffffffffffffffffffffffffffffffff811681146121f557600080fd5b600060208284031215612f5c57600080fd5b81357cffffffffffffffffffffffffffffffffffffffffffffffffffffffffff811681146121f557600080fd5b600060208284031215612f9b57600080fd5b813565ffffffffffff19811681146121f557600080fd5b600060208284031215612fc457600080fd5b81357fffffffffff000000000000000000000000000000000000000000000000000000811681146121f557600080fd5b60006020828403121561300657600080fd5b813565ffffffffffff811681146121f557600080fd5b60006020828403121561302e57600080fd5b81358060040b81146121f557600080fd5b60006020828403121561305157600080fd5b81356bffffffffffffffffffffffff811681146121f557600080fd5b60006020828403121561307f57600080fd5b81358060000b81146121f557600080fd5b6000602082840312156130a257600080fd5b813568ffffffffffffffffff811681146121f557600080fd5b6000602082840312156130cd57600080fd5b813580601c0b81146121f557600080fd5b6000602082840312156130f057600080fd5b5035919050565b60006020828403121561310957600080fd5b81358060010b81146121f557600080fd5b60006020828403121561312c57600080fd5b81357fffffffffffffffffffffffffffffff0000000000000000000000000000000000811681146121f557600080fd5b60006020828403121561316e57600080fd5b813566ffffffffffffff811681146121f557600080fd5b60006020828403121561319757600080fd5b813568ffffffffffffffffff19811681146121f557600080fd5b6000602082840312156131c357600080fd5b813580601d0b81146121f557600080fd5b6000602082840312156131e657600080fd5b81358060130b81146121f557600080fd5b60006020828403121561320957600080fd5b81356fffffffffffffffffffffffffffffffff811681146121f557600080fd5b60006020828403121561323b57600080fd5b81358060050b81146121f557600080fd5b60006020828403121561325e57600080fd5b813580151581146121f557600080fd5b60006020828403121561328057600080fd5b81357fffffffffffffffffffffffffff00000000000000000000000000000000000000811681146121f557600080fd5b6000602082840312156132c257600080fd5b813569ffffffffffffffffffff19811681146121f557600080fd5b6000602082840312156132ef57600080fd5b81356cffffffffffffffffffffffffff19811681146121f557600080fd5b60006020828403121561331f57600080fd5b81358060120b81146121f557600080fd5b60006020828403121561334257600080fd5b813571ffffffffffffffffffffffffffffffffffff811681146121f557600080fd5b60006020828403121561337657600080fd5b81358060020b81146121f557600080fd5b60006020828403121561339957600080fd5b81357fffffffffffffffffffffff000000000000000000000000000000000000000000811681146121f557600080fd5b6000602082840312156133db57600080fd5b81358060060b81146121f557600080fd5b6000602082840312156133fe57600080fd5b81358060110b81146121f557600080fd5b60006020828403121561342157600080fd5b81357fff00000000000000000000000000000000000000000000000000000000000000811681146121f557600080fdfea2646970667358221220c03630ca6910d46ede5cae5ed1f6ae9571e1ccb99a0b3b83f560d5c9079c96db64736f6c637822302e382e31392d646576656c6f702b636f6d6d69742e63383866343066642e6d6f640053", + "linkReferences": {}, + "deployedLinkReferences": {} +} + + + + +export default TypedContract; \ No newline at end of file diff --git a/src.ts/_tests/create-provider.ts b/src.ts/_tests/create-provider.ts index 17228280..0ed14b6c 100644 --- a/src.ts/_tests/create-provider.ts +++ b/src.ts/_tests/create-provider.ts @@ -1,9 +1,11 @@ import { - FallbackProvider, isError, + JsonRpcProvider, } from "../index.js"; import type { AbstractProvider } from "../index.js"; +import dotenv from "dotenv"; +dotenv.config(); interface ProviderCreator { name: string; @@ -11,24 +13,19 @@ interface ProviderCreator { create: (network: string) => null | AbstractProvider; }; -const ethNetworks = [ "default", "mainnet" ]; +const quaiNetworks = [ "colosseum" ]; const ProviderCreators: Array = [ { - name: "FallbackProvider", - networks: ethNetworks, + name: "JsonRpcProvider", + networks: quaiNetworks, create: function(network: string) { - const providers: Array = []; - for (const providerName of [ "JsonRpcProvider" ]) { - const provider = getProvider(providerName, network); - if (provider) { providers.push(provider); } - } - if (providers.length === 0) { throw new Error("UNSUPPORTED NETWORK"); } - return new FallbackProvider(providers); + return new JsonRpcProvider(process.env.RPC_URL, network); } }, ]; + let setup = false; const cleanup: Array<() => void> = [ ]; export function setupProviders(): void { @@ -54,7 +51,6 @@ export function getProviderNetworks(provider: string): Array { export function getProvider(provider: string, network: string): null | AbstractProvider { if (setup == false) { throw new Error("MUST CALL setupProviders in root context"); } - console.log(`getProvider: ${ provider }.${ network }`); const creator = getCreator(provider); try { if (creator) { @@ -76,7 +72,7 @@ export function checkProvider(provider: string, network: string): boolean { } export function connect(network: string): AbstractProvider { - const provider = getProvider("InfuraProvider", network); + const provider = getProvider("JsonRpcProvider", network); if (provider == null) { throw new Error(`could not connect to ${ network }`); } return provider; } diff --git a/src.ts/_tests/test-contract-integ.ts b/src.ts/_tests/test-contract-integ.ts index 2aec6ce4..959f213f 100644 --- a/src.ts/_tests/test-contract-integ.ts +++ b/src.ts/_tests/test-contract-integ.ts @@ -1,106 +1,109 @@ import assert from "assert"; +import { quais, Contract } from "../index.js"; +import dotenv from "dotenv"; +import QRC20 from "./contracts/QRC20.js" +import { stall } from "./utils.js"; - -import { quais } from "../index.js"; +dotenv.config(); interface ContractAbi { mint: quais.BaseContractMethod<[ quais.AddressLike ], [ boolean ], quais.ContractTransactionResponse>; totalSupply: quais.BaseContractMethod<[ ], [ bigint ], [ bigint ]>; balanceOf: quais.BaseContractMethod<[ quais.AddressLike ], [ bigint ], [ bigint ]>; + transfer: quais.BaseContractMethod<[ quais.AddressLike, bigint ], [ boolean ], quais.ContractTransactionResponse>; } describe("Tests contract integration", function() { - const provider = new quais.JsonRpcProvider("http:/\/127.0.0.1:8545"); - - const abi = [ - "constructor(address owner, uint maxSupply)", - "function mint(address target) returns (bool minted)", - "function totalSupply() view returns (uint supply)", - "function balanceOf(address target) view returns (uint balance)", - "event Minted(address target)" - ]; - - let address: null | string = null; - - it("deploys a contract", async function() { - this.timeout(10000); - - const bytecode = "0x60c060405234801561001057600080fd5b506040516105863803806105868339818101604052810190610032919061010e565b8173ffffffffffffffffffffffffffffffffffffffff1660808173ffffffffffffffffffffffffffffffffffffffff16815250508060a08181525050505061014e565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006100a58261007a565b9050919050565b6100b58161009a565b81146100c057600080fd5b50565b6000815190506100d2816100ac565b92915050565b6000819050919050565b6100eb816100d8565b81146100f657600080fd5b50565b600081519050610108816100e2565b92915050565b6000806040838503121561012557610124610075565b5b6000610133858286016100c3565b9250506020610144858286016100f9565b9150509250929050565b60805160a051610414610172600039600060fa0152600061021f01526104146000f3fe608060405234801561001057600080fd5b506004361061004c5760003560e01c806318160ddd146100515780636a6278421461006f57806370a082311461009f5780638da5cb5b146100cf575b600080fd5b6100596100ed565b604051610066919061025c565b60405180910390f35b610089600480360381019061008491906102da565b6100f6565b6040516100969190610322565b60405180910390f35b6100b960048036038101906100b491906102da565b6101d2565b6040516100c6919061025c565b60405180910390f35b6100d761021b565b6040516100e4919061034c565b60405180910390f35b60008054905090565b60007f00000000000000000000000000000000000000000000000000000000000000006000541061012657600080fd5b600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600081548092919061017690610396565b919050555060008081548092919061018d90610396565b91905055507f90ddedd5a25821bba11fbb98de02ec1f75c1be90ae147d6450ce873e7b78b5d8826040516101c1919061034c565b60405180910390a160019050919050565b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60007f0000000000000000000000000000000000000000000000000000000000000000905090565b6000819050919050565b61025681610243565b82525050565b6000602082019050610271600083018461024d565b92915050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006102a78261027c565b9050919050565b6102b78161029c565b81146102c257600080fd5b50565b6000813590506102d4816102ae565b92915050565b6000602082840312156102f0576102ef610277565b5b60006102fe848285016102c5565b91505092915050565b60008115159050919050565b61031c81610307565b82525050565b60006020820190506103376000830184610313565b92915050565b6103468161029c565b82525050565b6000602082019050610361600083018461033d565b92915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60006103a182610243565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82036103d3576103d2610367565b5b60018201905091905056fea26469706673582212200a979ea2bfdf429b5546fa25906c9d20a3d67ef5fbe531f31d2cc83533e3239564736f6c63430008120033"; - const signer = await provider.getSigner(0); - - const factory = new quais.ContractFactory(abi, bytecode, signer); - - const contract = await factory.deploy(signer, 100); + const provider = new quais.JsonRpcProvider(process.env.RPC_URL); + const wallet = new quais.Wallet(process.env.FAUCET_PRIVATEKEY || '', provider); + const abi = QRC20.abi; + const bytecode = QRC20.bytecode; + const constructorArgs = { + name: 'Testing', + symbol: 'Test', + totalSupply: Math.pow(10, 3), + } + let contract: Contract; + let address: string; + + before(async function() { + this.timeout(100000); + const factory = new quais.ContractFactory(abi, bytecode, wallet); + contract = await factory.deploy(constructorArgs.name, constructorArgs.symbol, constructorArgs.totalSupply, { + gasLimit: 5000000 }) as Contract; address = await contract.getAddress(); + console.log('Contract deployed to:', address); + + let tries = 0; + const POLLING_TRIES = 10; // define POLLING_TRIES if not defined elsewhere + let deployed = false; + let code = await provider.getCode(address); + while (tries < POLLING_TRIES && !deployed) { + code = await provider.getCode(address); + if (code != "0x") { + deployed = true; + } + tries += 1; + await stall(10000); // Ensure stall is defined or use a different delay mechanism + } - await contract.waitForDeployment(); + if (!deployed) { + throw new Error("Contract deployment failed"); + } + }); - const deployed = await provider.getCode(address); - assert.ok(deployed != "0x", "has bytescode"); + it("confirms the contract deployment", function() { + assert.ok(address, "Contract address should be available"); + assert.ok(contract, "Contract instance should be available"); }); it("runs contract operations", async function() { - this.timeout(10000); + this.timeout(100000); assert.ok(address != null); - const signer = await provider.getSigner(0); const CustomContract = quais.BaseContract.buildClass(abi); - const contract = new CustomContract(address, signer); //quais.Contract.from(address, abi, signer); + const contract = new CustomContract(address, wallet); //quais.Contract.from(address, abi, signer); // Test implicit staticCall (i.e. view/pure) { const supply0 = await contract.totalSupply(); - assert.equal(supply0, BigInt(0), "initial supply 0; default"); + assert.equal(supply0, BigInt(1000), "initial supply 0; default"); } // Test explicit staticCall { const supply0 = await contract.totalSupply.staticCall(); - assert.equal(supply0, BigInt(0), "initial supply 0; staticCall"); + assert.equal(supply0, BigInt(1000), "initial supply 0; staticCall"); } // Test staticCallResult (positional and named) { const supply0 = await contract.totalSupply.staticCallResult(); - assert.equal(supply0[0], BigInt(0), "initial supply 0; staticCallResult"); - assert.equal(supply0.supply, BigInt(0), "initial supply 0; staticCallResult"); + assert.equal(supply0[0], BigInt(1000), "initial supply 0; staticCallResult"); } - // Test populateTransaction - const txInfo = await contract.mint.populateTransaction(signer); - assert.equal(txInfo.to, address, "populateTransaction.to"); - const txInfoData = quais.hexlify(quais.concat([ - "0x6a627842", - quais.zeroPadValue(await signer.getAddress(), 32) - ])); - assert.equal(txInfo.data, txInfoData, "populateTransaction.data"); - - // Test minting (default) - const tx = await contract.mint(signer); - const receipt = await tx.wait(); + const reciever = '0x0aff86a125b29b25a9e418c2fb64f1753532c0ca' + // Test transfer (default) + const tx = await contract.transfer(reciever,BigInt(1)); - assert.ok(receipt, "receipt"); + await stall(60000) + + const receipt = await provider.getTransactionReceipt(tx.hash); + await stall(10000) + assert.ok(receipt, "receipt not null"); + const contractAddr = await contract.getAddress() // Check the receipt has parsed the events + assert.equal(receipt.logs.length, 1, "logs.length"); - assert.ok(receipt instanceof quais.ContractTransactionReceipt, "receipt typeof"); - assert.ok(receipt.logs[0] instanceof quais.EventLog, "receipt.log typeof"); - assert.equal(receipt.logs[0].fragment && receipt.logs[0].fragment.name, "Minted", "logs[0].fragment.name"); - assert.equal(receipt.logs[0].args[0], await signer.getAddress(), "logs[0].args[0]"); - assert.equal(receipt.logs[0].args.target, await signer.getAddress(), "logs[0].args.target"); - - // Check the state has been adjusted - assert.equal(await contract.totalSupply(), BigInt(1), "initial supply 1; default"); - assert.equal(await contract.balanceOf(signer), BigInt(1), "balanceOf(signer)"); - - // Test minting (explicit) - const tx2 = await contract.mint.send(signer); - await tx2.wait(); + assert.ok(receipt instanceof quais.TransactionReceipt, "receipt typeof"); + assert.ok(receipt.logs[0] instanceof quais.Log, "receipt.log typeof"); + assert.equal(receipt.logs[0].address, contractAddr, "Proper target address"); // Check the state has been adjusted - assert.equal(await contract.totalSupply(), BigInt(2), "initial supply 2; default"); + assert.equal(await contract.balanceOf(reciever), BigInt(1), "balanceOf(signer)"); }); }); diff --git a/src.ts/_tests/test-contract.ts b/src.ts/_tests/test-contract.ts index 7afce92c..dbb80f8d 100644 --- a/src.ts/_tests/test-contract.ts +++ b/src.ts/_tests/test-contract.ts @@ -4,179 +4,176 @@ import assert from "assert"; import { getProvider, setupProviders } from "./create-provider.js"; import { - Contract, EventLog, isError, Typed, Wallet + Contract, ContractFactory, isError, Typed, } from "../index.js"; -import type { ContractEventPayload, ContractEventName, Log } from "../index.js"; +import TestContract from "./contracts/TestContract.js" +import TypedContract from "./contracts/TypedContract.js" +import { quais } from "../index.js"; +import { stall } from "./utils.js"; setupProviders(); describe("Test Contract", function() { - const addr = "0x99417252Aad7B065940eBdF50d665Fb8879c5958"; - const abi = [ - "error CustomError1(uint256 code, string message)", - - "event EventUint256(uint256 indexed value)", - "event EventAddress(address indexed value)", - "event EventString(string value)", - "event EventBytes(bytes value)", - - "function testCustomError1(bool pass, uint code, string calldata message) pure returns (uint256)", - "function testErrorString(bool pass, string calldata message) pure returns (uint256)", - "function testPanic(uint256 code) returns (uint256)", - "function testEvent(uint256 valueUint256, address valueAddress, string valueString, bytes valueBytes) public", - "function testCallAdd(uint256 a, uint256 b) pure returns (uint256 result)", - ]; + const provider = new quais.JsonRpcProvider(process.env.RPC_URL); + const wallet = new quais.Wallet(process.env.FAUCET_PRIVATEKEY || '', provider); + const abi = TestContract.abi; + const bytecode = TestContract.bytecode; + let contract: Contract; + let addr: string + before( async function () { + this.timeout(60000); + await stall(10000); + const factory = new ContractFactory(abi, bytecode, wallet); + contract = await factory.deploy({gasLimit: 5000000, maxFeePerGas: quais.parseUnits('10', 'gwei'), maxPriorityFeePerGas: quais.parseUnits('3', 'gwei')}) as Contract; + addr = await contract.getAddress(); + console.log("Contract deployed to: ", addr); + await stall(30000); + }) + it("tests contract calls", async function() { this.timeout(10000); - const provider = getProvider("InfuraProvider", "goerli"); - const contract = new Contract(addr, abi, provider); - assert.equal(await contract.testCallAdd(4, 5), BigInt(9), "testCallAdd(4, 5)"); assert.equal(await contract.testCallAdd(6, 0), BigInt(6), "testCallAdd(6, 0)"); }); - it("tests events", async function() { - this.timeout(60000); - - const provider = getProvider("InfuraProvider", "goerli"); - assert.ok(provider); - - const contract = new Contract(addr, abi, provider); - - const signer = new Wallet((process.env.FAUCET_PRIVATEKEY), provider); - const contractSigner = contract.connect(signer); - - const vUint256 = 42; - const vAddrName = "quais.eth"; - const vAddr = "0x228568EA92aC5Bc281c1E30b1893735c60a139F1"; - const vString = "Hello"; - const vBytes = "0x12345678"; - - let hash: null | string = null; - - // Test running a listener for a specific event - const specificEvent = new Promise((resolve, reject) => { - contract.on("EventUint256", async (value, event) => { - // Triggered by someone else - if (hash == null || hash !== event.log.transactionHash) { return; } - - try { - assert.equal(event.filter, "EventUint256", "event.filter"); - assert.equal(event.fragment.name, "EventUint256", "event.fragment.name"); - assert.equal(event.log.address, addr, "event.log.address"); - assert.equal(event.args.length, 1, "event.args.length"); - assert.equal(event.args[0], BigInt(42), "event.args[0]"); - - const count = await contract.listenerCount("EventUint256"); - await event.removeListener(); - assert.equal(await contract.listenerCount("EventUint256"), count - 1, "decrement event count"); - - resolve(null); - } catch (e) { - event.removeListener(); - reject(e); - } - }); - }); - - // Test running a listener on all (i.e. "*") events - const allEvents = new Promise((resolve, reject) => { - const waitingFor: Record = { - EventUint256: vUint256, - EventAddress: vAddr, - EventString: vString, - EventBytes: vBytes - }; - - contract.on("*", (event: ContractEventPayload) => { - // Triggered by someone else - if (hash == null || hash !== event.log.transactionHash) { return; } - try { - const name = event.eventName; - - assert.equal(event.args[0], waitingFor[name], `${ name }`); - delete waitingFor[name]; - - if (Object.keys(waitingFor).length === 0) { - event.removeListener(); - resolve(null); - } - - } catch (error) { - reject(error); - } - }); - - }); - - // Send a transaction to trigger some events - const tx = await contractSigner.testEvent(vUint256, vAddr, vString, vBytes); - hash = tx.hash; - - const checkEvent = (filter: ContractEventName, event: EventLog | Log) => { - const values: Record = { - EventUint256: vUint256, - EventString: vString, - EventAddress: vAddr, - EventBytes: vBytes - }; - - assert.ok(event instanceof EventLog, `queryFilter(${ filter }):isEventLog`); - - const name = event.eventName; - - assert.equal(event.address, addr, `queryFilter(${ filter }):address`); - assert.equal(event.args[0], values[name], `queryFilter(${ filter }):args[0]`); - }; - - const checkEventFilter = async (filter: ContractEventName) => { - const events = (await contract.queryFilter(filter, -10)).filter((e) => (e.transactionHash === hash)); - assert.equal(events.length, 1, `queryFilter(${ filter }).length`); - checkEvent(filter, events[0]); - return events[0]; - }; - - const receipt = await tx.wait(); - - // Check the logs in the receipt - for (const log of receipt.logs) { checkEvent("receipt", log); } - - // Various options for queryFilter - await checkEventFilter("EventUint256"); - await checkEventFilter([ "EventUint256" ]); - await checkEventFilter([ [ "EventUint256" ] ]); - await checkEventFilter("EventUint256(uint)"); - await checkEventFilter([ "EventUint256(uint)" ]); - await checkEventFilter([ [ "EventUint256(uint)" ] ]); - await checkEventFilter([ [ "EventUint256", "EventUint256(uint)" ] ]); - await checkEventFilter("0x85c55bbb820e6d71c71f4894e57751de334b38c421f9c170b0e66d32eafea337"); - - // Query by Event - await checkEventFilter(contract.filters.EventUint256); - - // Query by Deferred Topic Filter; address - await checkEventFilter(contract.filters.EventUint256(vUint256)); - - // Query by Deferred Topic Filter; address - await checkEventFilter(contract.filters.EventAddress(vAddr)); - - // Query by Deferred Topic Filter; ENS name => address - await checkEventFilter(contract.filters.EventAddress(vAddrName)); - - // Multiple Methods - { - const filter = [ [ "EventUint256", "EventString" ] ]; - const events = (await contract.queryFilter(filter, -10)).filter((e) => (e.transactionHash === hash)); - assert.equal(events.length, 2, `queryFilter(${ filter }).length`); - - for (const event of events) { checkEvent(filter, event); } - } - - await specificEvent; - await allEvents; - }); + //Awaiting Quai subscrigbe functionality + + // it("tests events", async function() { + // this.timeout(60000); + + // assert.ok(provider) + + // const vUint256 = 42; + // const vAddrName = "quais.eth"; + // const vAddr = "0x228568EA92aC5Bc281c1E30b1893735c60a139F1"; + // const vString = "Hello"; + // const vBytes = "0x12345678"; + + // let hash: null | string = null; + + // // Test running a listener for a specific event + // const specificEvent = new Promise((resolve, reject) => { + // contract.on("EventUint256", async (value, event) => { + // // Triggered by someone else + // if (hash == null || hash !== event.log.transactionHash) { return; } + + // try { + // assert.equal(event.filter, "EventUint256", "event.filter"); + // assert.equal(event.fragment.name, "EventUint256", "event.fragment.name"); + // assert.equal(event.log.address, addr, "event.log.address"); + // assert.equal(event.args.length, 1, "event.args.length"); + // assert.equal(event.args[0], BigInt(42), "event.args[0]"); + + // const count = await contract.listenerCount("EventUint256"); + // await event.removeListener(); + // assert.equal(await contract.listenerCount("EventUint256"), count - 1, "decrement event count"); + + // resolve(null); + // } catch (e) { + // event.removeListener(); + // reject(e); + // } + // }); + // }); + + // // Test running a listener on all (i.e. "*") events + // const allEvents = new Promise((resolve, reject) => { + // const waitingFor: Record = { + // EventUint256: vUint256, + // EventAddress: vAddr, + // EventString: vString, + // EventBytes: vBytes + // }; + + // contract.on("*", (event: ContractEventPayload) => { + // // Triggered by someone else + // if (hash == null || hash !== event.log.transactionHash) { return; } + // try { + // const name = event.eventName; + + // assert.equal(event.args[0], waitingFor[name], `${ name }`); + // delete waitingFor[name]; + + // if (Object.keys(waitingFor).length === 0) { + // event.removeListener(); + // resolve(null); + // } + + // } catch (error) { + // reject(error); + // } + // }); + + // }); + + // // Send a transaction to trigger some events + // const tx = await contractSigner.testEvent(vUint256, vAddr, vString, vBytes); + // hash = tx.hash; + + // const checkEvent = (filter: ContractEventName, event: EventLog | Log) => { + // const values: Record = { + // EventUint256: vUint256, + // EventString: vString, + // EventAddress: vAddr, + // EventBytes: vBytes + // }; + + // assert.ok(event instanceof EventLog, `queryFilter(${ filter }):isEventLog`); + + // const name = event.eventName; + + // assert.equal(event.address, addr, `queryFilter(${ filter }):address`); + // assert.equal(event.args[0], values[name], `queryFilter(${ filter }):args[0]`); + // }; + + // const checkEventFilter = async (filter: ContractEventName) => { + // const events = (await contract.queryFilter(filter, -10)).filter((e) => (e.transactionHash === hash)); + // assert.equal(events.length, 1, `queryFilter(${ filter }).length`); + // checkEvent(filter, events[0]); + // return events[0]; + // }; + + // const receipt = await tx.wait(); + + // // Check the logs in the receipt + // for (const log of receipt.logs) { checkEvent("receipt", log); } + + // // Various options for queryFilter + // await checkEventFilter("EventUint256"); + // await checkEventFilter([ "EventUint256" ]); + // await checkEventFilter([ [ "EventUint256" ] ]); + // await checkEventFilter("EventUint256(uint)"); + // await checkEventFilter([ "EventUint256(uint)" ]); + // await checkEventFilter([ [ "EventUint256(uint)" ] ]); + // await checkEventFilter([ [ "EventUint256", "EventUint256(uint)" ] ]); + // await checkEventFilter("0x85c55bbb820e6d71c71f4894e57751de334b38c421f9c170b0e66d32eafea337"); + + // // Query by Event + // await checkEventFilter(contract.filters.EventUint256); + + // // Query by Deferred Topic Filter; address + // await checkEventFilter(contract.filters.EventUint256(vUint256)); + + // // Query by Deferred Topic Filter; address + // await checkEventFilter(contract.filters.EventAddress(vAddr)); + + // // Query by Deferred Topic Filter; ENS name => address + // await checkEventFilter(contract.filters.EventAddress(vAddrName)); + + // // Multiple Methods + // { + // const filter = [ [ "EventUint256", "EventString" ] ]; + // const events = (await contract.queryFilter(filter, -10)).filter((e) => (e.transactionHash === hash)); + // assert.equal(events.length, 2, `queryFilter(${ filter }).length`); + + // for (const event of events) { checkEvent(filter, event); } + // } + + // await specificEvent; + // await allEvents; + // }); it("tests the _in_ operator for functions", function() { const contract = new Contract(addr, abi); @@ -249,20 +246,21 @@ describe("Test Typed Contract Interaction", function() { } ]; - const abi: Array = [ ]; - for (let i = 1; i <= 32; i++) { - abi.push(`function testTyped(uint${ i * 8 }) public pure returns (string memory)`); - abi.push(`function testTyped(int${ i * 8 }) public pure returns (string memory)`); - abi.push(`function testTyped(bytes${ i }) public pure returns (string memory)`); - } - abi.push(`function testTyped(address) public pure returns (string memory)`); - abi.push(`function testTyped(bool) public pure returns (string memory)`); - abi.push(`function testTyped(bytes memory) public pure returns (string memory)`); - abi.push(`function testTyped(string memory) public pure returns (string memory)`); + const abi = TypedContract.abi + const provider = new quais.JsonRpcProvider(process.env.RPC_URL); + const wallet = new quais.Wallet(process.env.FAUCET_PRIVATEKEY || '', provider); + const bytecode = TypedContract.bytecode; + let contract: Contract; + let addr: string + before( async function () { + this.timeout(120000); + const factory = new ContractFactory(abi, bytecode, wallet); + contract = await factory.deploy({gasLimit: 5000000, maxFeePerGas: quais.parseUnits('10', 'gwei'), maxPriorityFeePerGas: quais.parseUnits('3', 'gwei'),}) as Contract; + addr = await contract.getAddress(); + console.log("Contract deployed to: ", addr); + await stall(50000); + }) - const addr = "0x838f41545DA5e18AA0e1ab391085d22E172B7B02"; - const provider = getProvider("InfuraProvider", "goerli"); - const contract = new Contract(addr, abi, provider); for (const { types, valueFunc } of tests) { for (const type of types) { @@ -288,78 +286,6 @@ describe("Test Typed Contract Interaction", function() { }); - - -/* -describe("Test Contract Calls", function() { - it("finds typed methods", async function() { - const contract = new Contract("0xC18360217D8F7Ab5e7c516566761Ea12Ce7F9D72", [ - "function foo(string s) view returns (uint)", - "function foo(uint8) view returns (uint)", - "function foo(uint u, bool b) view returns (uint)", - ]); - const value = Typed.string("42"); - await contract.foo.populateTransaction(value, Typed.overrides({ value: 100 })) - contract["foo(string)"].fragment - }); -}); - -describe("Test Contract Interface", function() { - it("builds contract interfaces", async function() { - this.timeout(60000); - - interface Erc20Interface { - // Constant Methods - balanceOf: ConstantContractMethod<[ address: string | Addressable ], bigint>; - decimals: ConstantContractMethod<[ ], bigint>; - - name: ConstantContractMethod<[ ], string>; - symbol: ConstantContractMethod<[ ], string>; - - // Mutation Methods - transferFrom: ContractMethod<[ address: string | Addressable, - address: string | Addressable, amount: BigNumberish ], boolean>; - - // Events - filters: { - Transfer: ContractEvent<[ from: Addressable | string, to: BigNumberish ]>; - } - } - - const erc20Abi = [ - "function balanceOf(address owner) view returns (uint)", - "function decimals() view returns (uint)", - "function name() view returns (string)", - "function symbol() view returns (string)", - - "function transferFrom(address from, address to, uint amount) returns (boolean)", - - "event Transfer(address indexed from, address indexed to, uint amount)" - ]; - - class Erc20Contract extends BaseContract.buildClass(erc20Abi) { }; - - const provider = new providers.InfuraProvider(); - // ENS - //const addr = "0xC18360217D8F7Ab5e7c516566761Ea12Ce7F9D72"; - // DAI - const addr = "0x6B175474E89094C44Da98b954EedeAC495271d0F"; - const contract = new Erc20Contract(addr, provider); - console.log("SYMBOL", await contract.symbol()); - console.log("DECIMALS", await contract.decimals()); - console.log(await contract.balanceOf("0x5555763613a12D8F3e73be831DFf8598089d3dCa")); - console.log(await contract.balanceOf("ricmoo.eth")); - - await contract.on(contract.filters.Transfer, (from, to, value, event) => { - console.log("HELLO!", { from, to, value, event }); - event.removeListener(); - }); - const logs = await contract.queryFilter("Transfer", -10); - console.log(logs, logs[0], logs[0].args.from); - }); -}); -*/ - type TestContractFallbackResult = { data: string; } | { diff --git a/src.ts/_tests/test-hash.ts b/src.ts/_tests/test-hash.ts index cacd1b72..cd7d7a34 100644 --- a/src.ts/_tests/test-hash.ts +++ b/src.ts/_tests/test-hash.ts @@ -146,17 +146,17 @@ describe("Test EIP-191 Personal Message Hash", function() { { test: "hello-world", message: "Hello World", - hash: "0xa1de988600a42c4b4ab089b619297c17d53cffae5d5120d82d8a92d0bb3b78f2" + hash: "0xca6464b285e602e01f3261caa151da2bd35fe19cb3532f7acd0d594ca0d810c5" }, { test: "binary-message", message: new Uint8Array([ 0x42, 0x43 ]), - hash: "0x0d3abc18ec299cf9b42ba439ac6f7e3e6ec9f5c048943704e30fc2d9c7981438" + hash: "0xd2ca8706bdbb1255b510b6acf42339faabf95bb8192cc7c562a6019ad8463c60" }, { test: "hex-looking-string", message: "0x4243", - hash: "0x6d91b221f765224b256762dcba32d62209cf78e9bebb0a1b758ca26c76db3af4" + hash: "0xcfe58e0f243f48080feeeb86f9b27e35f65955d3b39a644478c376b2733d9804" } ]; diff --git a/src.ts/_tests/test-provider-jsonrpc.ts b/src.ts/_tests/test-provider-jsonrpc.ts index 04f7bc36..6d88a3ef 100644 --- a/src.ts/_tests/test-provider-jsonrpc.ts +++ b/src.ts/_tests/test-provider-jsonrpc.ts @@ -12,6 +12,7 @@ const StatusMessages: Record = { 500: "SERVER ERROR", }; +//Requires running a local node and working quai_accounts api call type ProcessRequest = (method: string, params: Array, blockNumber: number) => any; @@ -28,13 +29,13 @@ function createProvider(testFunc: ProcessRequest): JsonRpcProvider { let result = testFunc(req.method, req.params, blockNumber); if (result === undefined) { switch (req.method) { - case "eth_blockNumber": + case "quai_blockNumber": result = blockNumber; break; - case "eth_chainId": + case "quai_chainId": result = "0x1337"; break; - case "eth_accounts": + case "quai_accounts": result = [ wallet.address ]; break; default: @@ -98,10 +99,10 @@ describe("Ensure Catchable Errors", function() { const provider = createProvider((method, params, blockNumber) => { switch (method) { - case "eth_sendTransaction": + case "quai_sendTransaction": return txObj.hash; - case "eth_getTransactionByHash": { + case "quai_getTransactionByHash": { count++; // First time; fail! @@ -162,10 +163,10 @@ describe("Ensure Catchable Errors", function() { const provider = createProvider((method, params, blockNumber) => { switch (method) { - case "eth_sendTransaction": + case "quai_sendTransaction": return txObj.hash; - case "eth_getTransactionByHash": { + case "quai_getTransactionByHash": { count++; // The fully valid tx response diff --git a/src.ts/_tests/test-providers-avatar.ts b/src.ts/_tests/test-providers-avatar.ts deleted file mode 100644 index e6fff590..00000000 --- a/src.ts/_tests/test-providers-avatar.ts +++ /dev/null @@ -1,34 +0,0 @@ -import assert from "assert"; - -import { connect, setupProviders } from "./create-provider.js"; - -setupProviders(); - -describe("Resolve ENS avatar", function() { - [ - { title: "data", name: "data-avatar.tests.quais.eth", value: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAMAAACeL25MAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyVpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDYuMC1jMDAyIDc5LjE2NDQ4OCwgMjAyMC8wNy8xMC0yMjowNjo1MyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIDIyLjAgKE1hY2ludG9zaCkiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6NUQ4NTEyNUIyOEIwMTFFQzg0NTBDNTU2RDk1NTA5NzgiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6NUQ4NTEyNUMyOEIwMTFFQzg0NTBDNTU2RDk1NTA5NzgiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDo1RDg1MTI1OTI4QjAxMUVDODQ1MEM1NTZEOTU1MDk3OCIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDo1RDg1MTI1QTI4QjAxMUVDODQ1MEM1NTZEOTU1MDk3OCIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/PkbM0uMAAAAGUExURQAA/wAAAHtivz4AAAAOSURBVHjaYmDABAABBgAAFAABaEkyYwAAAABJRU5ErkJggg==" }, - { title: "ipfs", name: "ipfs-avatar.tests.quais.eth", value: "https:/\/gateway.ipfs.io/ipfs/QmQsQgpda6JAYkFoeVcj5iPbwV3xRcvaiXv3bhp1VuYUqw" }, - { title: "url", name: "url-avatar.tests.quais.eth", value: "https:/\/quais.org/static/logo.png" }, - ].forEach((test) => { - it(`Resolves avatar for ${ test.title }`, async function() { - this.timeout(60000); - const provider = connect("goerli"); - const avatar = await provider.getAvatar(test.name); - assert.equal(test.value, avatar, "avatar url"); - }); - }); -/* -// @TODO: Set up some examples on goerli - [ - { title: "ERC-1155", name: "nick.eth", value: "https:/\/lh3.googleusercontent.com/hKHZTZSTmcznonu8I6xcVZio1IF76fq0XmcxnvUykC-FGuVJ75UPdLDlKJsfgVXH9wOSmkyHw0C39VAYtsGyxT7WNybjQ6s3fM3macE" }, -// { title: "ERC-721", name: "brantly.eth", value: "https:/\/api.wrappedpunks.com/images/punks/2430.png" } - ].forEach((test) => { - it(`Resolves avatar for ${ test.title }`, async function() { - this.timeout(60000); - const provider = connect("mainnet"); - const avatar = await provider.getAvatar(test.name); - assert.equal(avatar, test.value, "avatar url"); - }); - }); -*/ -}); diff --git a/src.ts/_tests/test-providers-ccip.ts b/src.ts/_tests/test-providers-ccip.ts deleted file mode 100644 index 9c70fd7d..00000000 --- a/src.ts/_tests/test-providers-ccip.ts +++ /dev/null @@ -1,182 +0,0 @@ -import assert from "assert"; - -import { - concat, dataLength, - keccak256, - toBeArray, - isCallException, isError -} from "../index.js"; - -import { connect, setupProviders } from "./create-provider.js"; - -setupProviders(); - -describe("Test CCIP execution", function() { - - // This matches the verify method in the Solidity contract against the - // processed data from the endpoint - const verify = function(sender: string, data: string, result: string): void { - const check = concat([ - toBeArray(dataLength(sender)), sender, - toBeArray(dataLength(data)), data - ]); - assert.equal(result, keccak256(check), "response is equal"); - } - - const address = "0x6C5ed35574a9b4d163f75bBf0595F7540D8FCc2d"; - const calldata = "0x1234"; - - it("testGet passes under normal operation", async function() { - this.timeout(60000); - - const provider = connect("goerli"); - - // testGet(bytes callData = "0x1234") - const tx = { - to: address, enableCcipRead: true, - data: "0xa5f3271e000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000021234000000000000000000000000000000000000000000000000000000000000" - } - - const result = await provider.call(tx); - verify(address, calldata, result); - }); - - it("testGet should fail with CCIP not explicitly enabled by overrides", async function() { - this.timeout(60000); - - const provider = connect("goerli"); - - // testGet(bytes callData = "0x1234") - const tx = { - to: address, - data: "0xa5f3271e000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000021234000000000000000000000000000000000000000000000000000000000000" - } - - await assert.rejects(async function() { - const result = await provider.call(tx); - console.log(result); - }, (error: unknown) => { - const offchainErrorData = "0x556f18300000000000000000000000006c5ed35574a9b4d163f75bbf0595f7540d8fcc2d00000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000140b1494be100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000018000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000004068747470733a2f2f6574686572732e7269636d6f6f2e776f726b6572732e6465762f746573742d636369702d726561642f7b73656e6465727d2f7b646174617d00000000000000000000000000000000000000000000000000000000000000021234000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000d4d79206578747261206461746100000000000000000000000000000000000000"; - return (isCallException(error) && error.data === offchainErrorData); - }); - }); - - it("testGet should fail with CCIP explicitly disabled on provider", async function() { - this.timeout(60000); - - const provider = connect("goerli"); - provider.disableCcipRead = true; - - // testGetFail(bytes callData = "0x1234") - const tx = { - to: address, enableCcipRead: true, - data: "0xa5f3271e000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000021234000000000000000000000000000000000000000000000000000000000000" - } - - await assert.rejects(async function() { - const result = await provider.call(tx); - console.log(result); - }, (error: unknown) => { - const offchainErrorData = "0x556f18300000000000000000000000006c5ed35574a9b4d163f75bbf0595f7540d8fcc2d00000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000140b1494be100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000018000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000004068747470733a2f2f6574686572732e7269636d6f6f2e776f726b6572732e6465762f746573742d636369702d726561642f7b73656e6465727d2f7b646174617d00000000000000000000000000000000000000000000000000000000000000021234000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000d4d79206578747261206461746100000000000000000000000000000000000000"; - return (isCallException(error) && error.data === offchainErrorData); - }); - }); - - it("testGetFail should fail if all URLs 5xx", async function() { - this.timeout(60000); - - const provider = connect("goerli"); - - // testGetFail(bytes callData = "0x1234") - const tx = { - to: address, enableCcipRead: true, - data: "0x36f9cea6000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000021234000000000000000000000000000000000000000000000000000000000000" - } - - await assert.rejects(async function() { - const result = await provider.call(tx); - console.log(result); - }, (error: unknown) => { - const infoJson = '{"urls":["https:/\/quais.ricmoo.workers.dev/status/500/{sender}/{data}"],"errorMessages":["hello world"]}'; - return (isError(error, "OFFCHAIN_FAULT") && error.reason === "500_SERVER_ERROR" && - JSON.stringify(error.info) === infoJson); - }); - }); - - it("testGetSenderFail should fail if sender does not match", async function() { - this.timeout(60000); - - const provider = connect("goerli"); - - // testGetSenderFail(bytes callData = "0x1234") - const tx = { - to: address, enableCcipRead: true, - data: "0x64bff6d1000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000021234000000000000000000000000000000000000000000000000000000000000", - } - - await assert.rejects(async function() { - const result = await provider.call(tx); - console.log(result); - }, (error: unknown) => { - const errorArgsJson = '["0x0000000000000000000000000000000000000000",["https://quais.ricmoo.workers.dev/test-ccip-read/{sender}/{data}"],"0x1234","0xb1494be1","0x4d792065787472612064617461"]'; - const offchainErrorData = "0x556f1830000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000140b1494be100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000018000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000004068747470733a2f2f6574686572732e7269636d6f6f2e776f726b6572732e6465762f746573742d636369702d726561642f7b73656e6465727d2f7b646174617d00000000000000000000000000000000000000000000000000000000000000021234000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000d4d79206578747261206461746100000000000000000000000000000000000000"; - return (isCallException(error) && error.data === offchainErrorData && - error.revert && - error.revert.signature === "OffchainLookup(address,string[],bytes,bytes4,bytes)" && - JSON.stringify(error.revert.args) === errorArgsJson); - }); - }); - - - it("testGetMissing should fail if early URL 4xx", async function() { - this.timeout(60000); - - const provider = connect("goerli"); - - // testGetMissing(bytes callData = "0x1234") - const tx = { - to: address, enableCcipRead: true, - data: "0x4ece8d7d000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000021234000000000000000000000000000000000000000000000000000000000000" - } - - await assert.rejects(async function() { - const result = await provider.call(tx); - console.log(result); - }, (error: unknown) => { - const infoJson = '{"url":"https:/\/quais.ricmoo.workers.dev/status/404/{sender}/{data}","errorMessage":"hello world"}'; - return (isError(error, "OFFCHAIN_FAULT") && error.reason === "404_MISSING_RESOURCE" && - JSON.stringify(error.info || "") === infoJson); - }); - }); - - - it("testGetFallback passes if any URL returns correctly", async function() { - this.timeout(60000); - - const provider = connect("goerli"); - - // testGetFallback(bytes callData = "0x1234") - const tx = { - to: address, enableCcipRead: true, - data: "0xedf4a021000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000021234000000000000000000000000000000000000000000000000000000000000" - } - - const result = await provider.call(tx); - verify(address, calldata, result); - }); - - it("testPost passes under normal operation", async function() { - this.timeout(60000); - - const provider = connect("goerli"); - - // testPost(bytes callData = "0x1234") - const tx = { - to: address, enableCcipRead: true, - data: "0x66cab49d000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000021234000000000000000000000000000000000000000000000000000000000000" - } - - const result = await provider.call(tx); - verify(address, calldata, result); - }); -}) diff --git a/src.ts/_tests/test-providers-data.ts b/src.ts/_tests/test-providers-data.ts index c6dae62d..a74619f5 100644 --- a/src.ts/_tests/test-providers-data.ts +++ b/src.ts/_tests/test-providers-data.ts @@ -1,227 +1,355 @@ import assert from "assert"; -import { - checkProvider, getProvider, setupProviders, providerNames -} from "./create-provider.js"; -import { retryIt } from "./utils.js"; - -import type { Provider } from "../index.js"; - - -import { - networkFeatureAtBlock, networkNames, - testAddress, testBlock, testReceipt, testTransaction -} from "./blockchain-data.js"; - -import type { TestBlockchainNetwork } from "./blockchain-data.js"; - - -setupProviders(); - - -function forEach(prefix: string, tests: Record>, func: (providerName: string, test: T) => (null | ((p: Provider) => Promise))): void { - for (const networkName of networkNames) { - const networkTests: Array = tests[networkName]; - if (networkTests == null) { continue; } - - for (const test of networkTests) { - for (const providerName of providerNames) { - if (!checkProvider(providerName, networkName)) { continue; } - - // Let the testcase skip this by returning null - const testFunc = func(providerName, test); - if (testFunc == null) { continue; } - - // Prepare the testcase - retryIt(`${ prefix }: ${ providerName }:${ networkName }.${ test.test }`, async function() { - // Create a provider - const provider = getProvider(providerName, networkName); +// import { +// checkProvider, getProvider, providerNames +// } from "./create-provider.js"; +// import { retryIt } from "./utils.js"; + +//import type { Provider } from "../index.js"; +import { quais } from "../index.js"; +import axios from 'axios'; +import { stall } from "./utils.js"; +// import { +// networkFeatureAtBlock, networkNames, +// testAddress, testBlock, testReceipt, testTransaction +// } from "./blockchain-data.js"; + +// import type { TestBlockchainNetwork } from "./blockchain-data.js"; + + +//setupProviders(); + + +const providerC1 = new quais.JsonRpcProvider(process.env.RPC_URL); +const wallet = new quais.Wallet(process.env.FAUCET_PRIVATEKEY || '', providerC1); +const destinationC1 = '0x0aff86a125b29b25a9e418c2fb64f1753532c0ca' +const destinationC2 = '0x261ee260b611a0e4c76c8f148cdf7cad65e0daf8' + +function equals(name: string, actual: any, expected: any): void { + if (expected && expected.eq) { + if (actual == null) { assert.ok(false, name + " - actual big number null"); } + expected = BigInt(expected); + actual = BigInt(actual); + assert.ok(expected.eq(actual), name + " matches"); + + } else if (Array.isArray(expected)) { + if (actual == null) { assert.ok(false, name + " - actual array null"); } + assert.equal(actual.length, expected.length, name + " array lengths match"); + for (let i = 0; i < expected.length; i++) { + equals("(" + name + " - item " + i + ")", actual[i], expected[i]); + } - try { - assert.ok(provider != null, "missing provider"); + } else if (typeof(expected) === "object") { + if (actual == null) { + if (expected === actual) { return; } + assert.ok(false, name + " - actual object null"); + } - await testFunc(provider); + let keys: { [ key: string ]: boolean } = {}; + Object.keys(expected).forEach((key) => { keys[key] = true; }); + Object.keys(actual).forEach((key) => { keys[key] = true; }); - } catch (error) { - // Shutdown socket-based provider, otherwise its socket will prevent - // this process from exiting - if ((provider).destroy) { (provider).destroy(); } + Object.keys(keys).forEach((key) => { + if ( typeof actual[key] === "string" && actual[key].toLowerCase && key === "type") { + actual[key] = actual[key].toLowerCase(); + } + equals("(" + name + " - key + " + key + ")", actual[key], expected[key]); + }); - throw error; - } + } else { + if (actual == null) { assert.ok(false, name + " - actual null"); } - // Shutdown socket-based provider, otherwise its socket will prevent - // this process from exiting - if ((provider).destroy) { (provider).destroy(); } - }); - } + // Modify this part for case-insensitive comparison for string values + if (typeof actual === 'string' && typeof expected === 'string') { + assert.equal(actual.toLowerCase(), expected.toLowerCase(), name + " matches (case-insensitive)"); + } else { + assert.equal(actual, expected, name + " matches"); } } } -describe("Test Provider Address operations", function() { - forEach("test getBalance(address)", testAddress, (providerName, test) => { - if (test.balance == null) { return null; } - return async (provider) => { - assert.equal(await provider.getBalance(test.address), test.balance); - }; - }); - - forEach("test getCode(address)", testAddress, (providerName, test) => { - if (test.code == null) { return null; } - return async (provider) => { - assert.equal(await provider.getCode(test.address), test.code); - }; - }); -/* - forEach("test lookupAddress(address)", testAddress, (provider, test) => { - if (test.name == null) { return null; } - return async () => { - assert.equal(await provider.lookupAddress(test.address), test.name); - }; - }); - - forEach("test resolveName(name)", testAddress, (provider, test) => { - if (test.name == null) { return null; } - return async () => { - assert.equal(await provider.lookupAddress((test.name)), test.address); - }; - }); -*/ - forEach("test getStorage(address)", testAddress, (providerName, test) => { - if (test.storage == null) { return null; } - return async (provider) => { - for (const key in test.storage) { - assert.equal(await provider.getStorage(test.address, key), test.storage[key]); - } - }; - }); - - forEach("test getTransactionCount(address)", testAddress, (providerName, test) => { - if (test.balance == null) { return null; } - return async (provider) => { - assert.equal(await provider.getTransactionCount(test.address), test.nonce); - }; - }); -}); - -function assertObj(prefix: string, actual: any, expected: any): void { - assert.ok(actual != null, `${ prefix } is null`); - for (const key in expected) { - if (expected[key] === undefined) { continue; } - assert.equal(actual[key], expected[key], `${ prefix }.${ key }`); +async function getRPCGasPrice(url:string | undefined){ + try { + let response; + do{ + response = await axios.post(url || "http://localhost:8610", { + jsonrpc: "2.0", + method: "quai_gasPrice", + params: [], + id: 1 + }); + } while (response.data.result == null) + return response.data.result; + + } catch (error: any ) { + throw new Error(`Error fetching block: ${error.message}`); } } -function assertBlock(actual: any, expected: any): void { - // Check transactions - for (let i = 0; i < expected.transactions.length; i++) { - const expectedTx = expected.transactions[i]; - if (typeof(expectedTx) === "string") { - assert.equal(actual.transactions[i], expectedTx, `block.transactions[${ i }]`); - } else { - throw new Error("@TODO"); - } +async function sendTransaction(to: string){ + let txResponse; + let typeValue; + try{ + do{ + const prefix = to.substring(0, 4); + typeValue = (Number(prefix) > 29) ? 2 : 0; + const gas = await getRPCGasPrice(process.env.RPC_URL); + let tx: { + from: string; + to: string; + value: any; + gasPrice: any; + maxFeePerGas: any; + maxPriorityFeePerGas:any; + nonce: number; + data: string; + type: number; + gasLimit: number; + chainId: number; + etxGasLimit?: any; + etxGasTip?: any; + etxGasPrice?: any; + } = { + from: wallet.address, + to, + value: quais.parseEther("0.1"), // Sending 0.1 ether + gasPrice: gas*2, + maxFeePerGas: quais.parseUnits('20', 'gwei'), + maxPriorityFeePerGas: quais.parseUnits('20', 'gwei'), + nonce: await providerC1.getTransactionCount(wallet.address, 'latest'), + data: '', + type: typeValue, + gasLimit: typeValue == 0 ? 21000 : 42000, + chainId: Number(process.env.CHAIN_ID || 1337), + }; + txResponse = await wallet.sendTransaction(tx); + await stall(15000); + } while (txResponse.hash == null); + + console.log(`Transaction hash for type ${typeValue}: `, txResponse.hash); + return txResponse; + } catch(error: any){ + console.error('Failed to send Transaction: ', error); + return null; } - - // Remove the transactions and test keys - expected = Object.assign({ }, expected, { transactions: undefined, test: undefined }); - - // Check remaining keys - assertObj("block", actual, expected); } -function assertTransaction(actual: any, expected: any): void { - // @TODO: Accesslist - - // Check signature - assertObj("tx.signature", actual.signature, expected.signature); - - // Remove the transactions and test keys - expected = Object.assign({ }, expected, { - accessList: undefined, - signature: undefined, - test: undefined - }); - - // Check remaining keys - assertObj("tx", actual, expected); +async function fetchRPCBlock(blockNumber: string | null) { + try { + let response; + do { + response = await axios.post(process.env.RPC_URL || "http://localhost:8610", { + jsonrpc: "2.0", + method: "quai_getBlockByNumber", + params: [ + blockNumber || '0xA', + false + ], + id: 1 + }); + }while (response.data.result.hash == null) + return response.data.result; + + } catch (error: any) { + throw error; + } } -function assertReceipt(actual: any, expected: any): void { - - // Check logs - for (let i = 0; i < expected.logs.length; i++) { - let expectedLog = expected.logs[i]; - for (let j = 0; j < expectedLog.topics.length; j++) { - assert.equal(actual.logs[i].topics[j], expectedLog.topics[j], `receipt.logs[${ i }].topics[${ j }]`); - } - - expectedLog = Object.assign({ }, expectedLog, { topics: undefined }); - - assertObj(`receipt.log[${ i }]`, actual.logs[i], expectedLog); +async function fetchRPCBalance(address: string, url: string){ + try { + let response; + do{ + response = await axios.post(url, { + jsonrpc: "2.0", + method: "quai_getBalance", + params: [ + address, + 'latest' + ], + id: 1 + }); + } while (response.data.result == null) + return response.data.result; + + } catch (error: any) { + throw new Error(`Error fetching block: ${error.message}`); } +} - // Remove the transactions and test keys - expected = Object.assign({ }, expected, { logs: undefined, test: undefined }); - - // In Byzantium, the root was dropped and the status was added - if (networkFeatureAtBlock("byzantium", expected.blockNumber)) { - expected = Object.assign({ }, expected, { root: undefined }); - } else { - expected = Object.assign({ }, expected, { status: undefined }); +async function fetchRPCTxReceipt(hash: string ,url: string){ + try { + let response; + do{ + response = await axios.post(url, { + jsonrpc: "2.0", + method: "quai_getTransactionReceipt", + params: [ + hash + ], + id: 1 + }); + await stall(5000); + } while (response.data.result.blockHash == null) + return response.data.result; + } catch (error:any) { + throw new Error(`Error fetching block: ${error.message}`); } - - // Check remaining keys - assertObj("receipt", actual, expected); } describe("Test Provider Block operations", function() { - forEach("test getBlock(blockHash)", testBlock, (providerName, test) => { - // quaiscan does not support getting a block by blockhash - if (providerName === "quaiscanProvider") { return null; } - - return async (provider) => { - assertBlock(await provider.getBlock(test.hash), test); + let block: quais.BlockParams; + + before( async() => { + const rpcBlock = await fetchRPCBlock('0xA') + block = { + hash: rpcBlock.hash, + number: rpcBlock.number.map((stringNumber: string) => Number(stringNumber)), + transactions: rpcBlock.transactions, + parentHash: rpcBlock.parentHash, + parentEntropy: rpcBlock.parentEntropy.map((entropy: string) => BigInt(entropy)), + extTransactions: rpcBlock.extTransactions, + timestamp: Number(rpcBlock.timestamp), + nonce: rpcBlock.nonce, + difficulty: BigInt(rpcBlock.difficulty), + gasLimit: BigInt(rpcBlock.gasLimit), + gasUsed: BigInt(rpcBlock.gasUsed), + miner: rpcBlock.miner, + extraData: rpcBlock.extraData, + transactionsRoot: rpcBlock.transactionsRoot, + stateRoot: rpcBlock.stateRoot, + receiptsRoot: rpcBlock.receiptsRoot, + baseFeePerGas: BigInt(rpcBlock.baseFeePerGas), + extRollupRoot: rpcBlock.extRollupRoot, + extTransactionsRoot: rpcBlock.extTransactionsRoot, + location: rpcBlock.location, + manifestHash: rpcBlock.manifestHash, + mixHash: rpcBlock.mixHash, + order: rpcBlock.order, + parentDeltaS: rpcBlock.parentDeltaS.map((delta:string) => BigInt(delta)), + sha3Uncles: rpcBlock.sha3Uncles, + size: BigInt(rpcBlock.size), + uncles: rpcBlock.uncles, + subManifest: rpcBlock.subManifest, + totalEntropy: BigInt(rpcBlock.totalEntropy), + } + }) + + it('should fetch block by number', async function () { + let responseBlock = await providerC1.getBlock('0xA') as quais.Block; + assert.ok(responseBlock != null, "block != null"); + + let { provider, ...formatBlock } = { + ...responseBlock, + transactions: responseBlock.transactions, + extTransactions: responseBlock.extTransactions }; + equals("Block by Number", formatBlock, block); }); - - forEach("test getBlock(blockNumber)", testBlock, (providerName, test) => { - return async (provider) => { - assertBlock(await provider.getBlock(test.number), test); + + it('should fetch block by hash', async function() { + assert.ok(block.hash != null, 'block.hash != null') + let responseBlock = await providerC1.getBlock(block.hash) as quais.Block; + assert.ok(responseBlock != null, "block != null"); + + let { provider, ...formatBlock } = { + ...responseBlock, + transactions: responseBlock.transactions, + extTransactions: responseBlock.extTransactions }; + equals("Block by Hash", formatBlock, block); + }) +}) + + +describe("Test Transaction operations", function() { + let internalTx: any; + let internalToExternalTx: any; + + it('should fetch balance after internal tx', async function () { + this.timeout(60000) + const oldBal = await fetchRPCBalance(destinationC1, process.env.RPC_URL || "http://localhost:8610"); + internalTx = await sendTransaction(destinationC1); + await stall(30000) + const expectedBal = BigInt(internalTx.value); + const balance = await providerC1.getBalance(destinationC1); + const actualBal = Number(balance) - Number(oldBal) + assert.equal(actualBal, Number(expectedBal)); }); -}); -describe("Test Provider Transaction operations", function() { - forEach("test getTransaction(hash)", testTransaction, (providerName, test) => { - return async (provider) => { - assertTransaction(await provider.getTransaction(test.hash), test); + it('should get transaction receipt for internal tx', async function () { + this.timeout(60000) + const receipt = await fetchRPCTxReceipt(internalTx.hash, process.env.RPC_URL || "http://localhost:8610"); + const expectedReceipt = { + blockHash: receipt.blockHash, + contractAddress: receipt.contractAddress || null, + blockNumber: Number(receipt.blockNumber), + cumulativeGasUsed: BigInt(receipt.cumulativeGasUsed), + gasPrice: BigInt(receipt.effectiveGasPrice), + etxs: receipt.etxs, + gasUsed: BigInt(receipt.gasUsed), + logs: receipt.logs, + logsBloom: receipt.logsBloom, + status: Number(receipt.status), + to: receipt.to, + from: receipt.from, + hash: receipt.transactionHash, + index: Number(receipt.transactionIndex), + type: receipt.type, + } + const receiptResponse = await providerC1.getTransactionReceipt(internalTx.hash); + let { provider, ...receiptResult } = { + ...receiptResponse, + logs: receiptResponse?.logs }; - }); - - forEach("test getTransactionReceipt(hash)", testReceipt, (providerName, test) => { - return async (provider) => { - const receipt = await provider.getTransactionReceipt(test.hash) - assert.ok(receipt != null, "receipt != null"); - - // Cloudflare doesn't return the root in legacy receipts; but it isn't - // *actually* that important, so we'll give it a pass... - if (providerName === "CloudflareProvider" || providerName === "AnkrProvider" || providerName === "PocketProvider") { - test = Object.assign({ } , test, { root: undefined }); - } - - //if (providerName === "PocketProvider") { - //} - - assertReceipt(receipt, test); + equals("Internal Tx Receipt", receiptResult, expectedReceipt); + + }) + + it("should fetch transaction receipt for internal to external tx", async function () { + this.timeout(120000) + internalToExternalTx = await sendTransaction(destinationC2); + await stall(60000); + const receipt = await fetchRPCTxReceipt(internalToExternalTx.hash, process.env.RPC_URL || "http://localhost:8610"); + await stall(30000); + const etx = receipt.etxs[0]; + const expectedReceipt = { + blockHash: receipt.blockHash, + blockNumber: Number(receipt.blockNumber), + contractAddress: receipt.contractAddress || null, + cumulativeGasUsed: BigInt(receipt.cumulativeGasUsed), + gasPrice: BigInt(receipt.effectiveGasPrice), + etxs: [ + { + type: Number(etx.type), + nonce: Number(etx.nonce), + maxPriorityFeePerGas: BigInt(etx.maxPriorityFeePerGas), + maxFeePerGas: BigInt(etx.maxFeePerGas), + gas: BigInt(etx.gas), + value: BigInt(etx.value), + input: etx.input, + to: etx.to, + from: etx.sender, + hash: etx.hash, + chainId: Number(etx.chainId), + accessList: etx.accessList, + } + ], + gasUsed: BigInt(receipt.gasUsed), + logs: receipt.logs, + logsBloom: receipt.logsBloom, + status: Number(receipt.status), + to: receipt.to, + from: receipt.from, + hash: receipt.transactionHash, + index: Number(receipt.transactionIndex), + type: Number(receipt.type), + } + const receiptResponse = await providerC1.getTransactionReceipt(internalToExternalTx.hash); + let { provider, ...receiptResult } = { + ...receiptResponse, + logs: receiptResponse?.logs }; + equals("Internal to External Tx Receipt", receiptResult, expectedReceipt); }); +}) - forEach("test lookupAddress(addr) == null", testReceipt, (providerName, test) => { - return async (provider) => { - const name = await provider.lookupAddress("0x0123456789012345678901234567890123456789") - assert.ok(name == null, "name == null"); - }; - }); -}); diff --git a/src.ts/_tests/test-providers-errors.ts b/src.ts/_tests/test-providers-errors.ts index 43fecac3..682a0578 100644 --- a/src.ts/_tests/test-providers-errors.ts +++ b/src.ts/_tests/test-providers-errors.ts @@ -11,6 +11,9 @@ import { getProvider, setupProviders, providerNames } from "./create-provider.js import { stall } from "./utils.js"; import type { TransactionResponse } from "../index.js"; +//require('dotenv').config(); +import dotenv from "dotenv"; +dotenv.config(); type TestCustomError = { name: string; @@ -42,9 +45,9 @@ describe("Tests Provider Call Exception", function() { //{ code: 0x51, reason: "UNINITIALIZED_FUNCTION_CALL" }, ]; - const testAddr = "0xF20Ba47c47a32fc2d9ad846fF06f2fa6e89eeC74"; + const testAddr = "0x0aff86a125b29b25a9e418c2fb64f1753532c0ca"; //Cyprus1 - const networkName = "goerli"; + const networkName = "colosseum"; for (const { code, reason } of panics) { for (const method of [ "call", "estimateGas" ]) { for (const providerName of providerNames) { @@ -166,7 +169,7 @@ describe("Tests Provider Call Exception", function() { describe("Test Provider Blockchain Errors", function() { const wallet = new Wallet((process.env.FAUCET_PRIVATEKEY)); - const networkName = "goerli"; + const networkName = "colosseum"; for (const providerName of providerNames) { const provider = getProvider(providerName, networkName); diff --git a/src.ts/_tests/test-providers-fallback.ts b/src.ts/_tests/test-providers-fallback.ts index 66627740..ac3e38cb 100644 --- a/src.ts/_tests/test-providers-fallback.ts +++ b/src.ts/_tests/test-providers-fallback.ts @@ -3,8 +3,7 @@ import assert from "assert"; import { isError, makeError, - AbstractProvider, FallbackProvider, Network, - ZeroAddress + AbstractProvider, FallbackProvider, Network } from "../index.js"; import type { @@ -39,11 +38,11 @@ export class MockProvider extends AbstractProvider { describe("Test Fallback broadcast", function() { - const txHash = "0x33017397ef7c7943dee3b422aec52b0a210de58d73d49c1b3ce455970f01c83a"; + const txHash = "0xe9fb92945282cf04f7bb3027d690fdaab6d601c99a7cdd0a5eb41d1a5c0893d5"; async function test(actions: Array<{ timeout: number, error?: Error }>): Promise { - // https://sepolia.etherscan.io/tx/0x33017397ef7c7943dee3b422aec52b0a210de58d73d49c1b3ce455970f01c83a - const tx = "0x02f87683aa36a7048459682f00845d899ef982520894b5bdaa442bb34f27e793861c456cd5bdc527ac8c89056bc75e2d6310000080c001a07503893743e94445b2361a444343757e6f59d52e19e9b3f65eb138d802eaa972a06e4e9bc10ff55474f9aac0a4c284733b4195cb7b273de5e7465ce75a168e0c38"; + + const tx = "0x00f8788223288202898504a817c8008504a817c800825208940aff86a125b29b25a9e418c2fb64f1753532c0ca88016345785d8a000080c001a0711d47f0f6828721f336430ca87277534d0134de5f04ce3629085f8d5371c129a061c4838dec40c296cfad6fe771d502c26e209089124e6f702c64353b3ca195c1"; const providers: Array = actions.map(({ timeout, error }) => { return new MockProvider(async (r) => { @@ -70,15 +69,6 @@ describe("Test Fallback broadcast", function() { assert(result.hash === txHash, "result.hash === txHash"); }); - it("picks late non-failed broadcasts with quorum-met red-herrings", async function() { - const result = await test([ - { timeout: 200, error: makeError("bad nonce", "NONCE_EXPIRED") }, - { timeout: 400, error: makeError("bad nonce", "NONCE_EXPIRED") }, - { timeout: 1000 }, - ]); - assert(result.hash === txHash, "result.hash === txHash"); - }); - it("insufficient funds short-circuit broadcast", async function() { await assert.rejects(async function() { const result = await test([ @@ -95,67 +85,4 @@ describe("Test Fallback broadcast", function() { }); }); -describe("Test Inflight Quorum", function() { - // Fires the %%actions%% as providers which will delay before returning, - // and returns an array of arrays, where each sub-array indicates which - // providers were inflight at once. - async function test(actions: Array<{ delay: number, stallTimeout: number, priority: number, weight: number }>, quorum: number): Promise>> { - const inflights: Array> = [ [ ] ]; - - const configs = actions.map(({ delay, stallTimeout, priority, weight }, index) => ({ - provider: new MockProvider(async (r) => { - if (r.method === "getBlockNumber") { return 1; } - if (r.method === "getBalance") { - // Add this as inflight - let last = inflights.pop(); - if (last == null) { throw new Error("no elements"); } - inflights.push(last); - last = last.slice(); - last.push(index); - inflights.push(last); - - // Do the thing - await stall(delay); - - // Remove as inflight - last = inflights.pop(); - if (last == null) { throw new Error("no elements"); } - inflights.push(last); - last = last.filter((v) => (v !== index)); - inflights.push(last); - - return 0; - } - console.log(r); - throw new Error(`unhandled method: ${ r.method }`); - }), - stallTimeout, priority, weight - })); - - const provider = new FallbackProvider(configs, network, { - cacheTimeout: -1, pollingInterval: 100, - quorum - }); - await provider.getBalance(ZeroAddress); - - return inflights; - } - - // See: #4298 - it("applies weights against inflight requests", async function() { - this.timeout(2000); - const inflights = await test([ - { delay: 50, stallTimeout: 1000, priority: 1, weight: 2 }, - { delay: 50, stallTimeout: 1000, priority: 1, weight: 2 }, - ], 2); - - // Make sure there is never more than 1 inflight provider at once - for (const running of inflights) { - assert.ok(running.length <= 1, `too many inflight requests: ${ JSON.stringify(inflights) }`); - } - }); - - // @TODO: add lots more tests, checking on priority, weight and stall - // configurations -}); diff --git a/src.ts/_tests/test-providers-send.ts b/src.ts/_tests/test-providers-send.ts deleted file mode 100644 index ac5dd196..00000000 --- a/src.ts/_tests/test-providers-send.ts +++ /dev/null @@ -1,62 +0,0 @@ -import assert from "assert"; - -import { isError, Wallet } from "../index.js"; - -import { getProvider, providerNames, setupProviders } from "./create-provider.js"; - -import type { TransactionResponse } from "../index.js"; - -function stall(duration: number): Promise { - return new Promise((resolve) => { setTimeout(resolve, duration); }); -} - -setupProviders(); - -describe("Sends Transactions", function() { - - const wallet = new Wallet((process.env.FAUCET_PRIVATEKEY)); - console.log("Faucet Address:", wallet.address); - - const networkName = "goerli"; - for (const providerName of providerNames) { - const provider = getProvider(providerName, networkName); - if (provider == null) { continue; } - - it(`tests sending: ${ providerName }`, async function() { - this.timeout(180000); - - const w = wallet.connect(provider); - - const dustAddr = Wallet.createRandom().address; - - // Retry if another CI instance used our value - let tx: null | TransactionResponse = null; - for (let i = 0; i < 10; i++) { - try { - tx = await w.sendTransaction({ - to: dustAddr, - value: 42, - type: 2 - }); - break; - } catch (error) { - if (isError(error, "REPLACEMENT_UNDERPRICED") || isError(error, "NONCE_EXPIRED")) { - await stall(1000); - continue; - } - throw error; - } - } - assert.ok(!!tx, "too many retries"); - - //const receipt = - await provider.waitForTransaction(tx.hash, null, 60000); //tx.wait(); - //console.log(receipt); - - const balance = await provider.getBalance(dustAddr); - assert.equal(balance, BigInt(42), "target balance after send"); - }); - } - - -}); diff --git a/src.ts/_tests/test-providers-wildcard.ts b/src.ts/_tests/test-providers-wildcard.ts deleted file mode 100644 index 8cc98fce..00000000 --- a/src.ts/_tests/test-providers-wildcard.ts +++ /dev/null @@ -1,22 +0,0 @@ -import assert from "assert"; - -import { connect, setupProviders } from "./create-provider.js"; - -setupProviders(); - -describe("Test EIP-2544 ENS wildcards", function() { - const provider = connect("goerli"); - - it("Resolves recursively", async function() { - const resolver = await provider.getResolver("ricmoose.hatch.eth"); - assert.ok(resolver, "failed to get resolver"); - - assert.equal(resolver.address, "0x15abA1fa74Bfdecd63A71218DC632d4328Db8168", "address"); - assert.equal(await resolver.supportsWildcard(), true, "supportsWildcard()"); - - // Test pass-through avatar - assert.equal(await resolver.getAvatar(), "https:/\/static.ricmoo.com/uploads/profile-06cb9c3031c9.jpg", "getAvatar()"); - - assert.equal(await resolver.getAddress(), "0x4B711A377B1b3534749FBe5e59Bcf7F94d92EA98", "getAddress()"); - }); -}); diff --git a/src.ts/_tests/test-transaction.ts b/src.ts/_tests/test-transaction.ts index 4b64a891..128ae8cf 100644 --- a/src.ts/_tests/test-transaction.ts +++ b/src.ts/_tests/test-transaction.ts @@ -2,31 +2,13 @@ import assert from "assert"; import { loadTests } from "./utils.js"; import type { TestCaseTransaction, TestCaseTransactionTx } from "./types.js"; - import { isError, Transaction } from "../index.js"; const BN_0 = BigInt(0); describe("Tests Unsigned Transaction Serializing", function() { - const tests = loadTests("transactions"); - - for (const test of tests) { - it(`serialized unsigned legacy transaction: ${ test.name }`, function() { - const txData = Object.assign({ }, test.transaction, { - type: 0, - accessList: undefined, - maxFeePerGas: undefined, - maxPriorityFeePerGas: undefined - }); - - // Use the testcase sans the chainId for a legacy test - if (txData.chainId != null && parseInt(txData.chainId) != 0) { txData.chainId = "0x00"; } - - const tx = Transaction.from(txData); - assert.equal(tx.unsignedSerialized, test.unsignedLegacy, "unsignedLegacy"); - }); - } + const tests = loadTests("transactions") for (const test of tests) { // Unsupported parameters for EIP-155; i.e. unspecified chain ID @@ -38,95 +20,29 @@ describe("Tests Unsigned Transaction Serializing", function() { maxFeePerGas: undefined, maxPriorityFeePerGas: undefined }); - const tx = Transaction.from(txData); assert.equal(tx.unsignedSerialized, test.unsignedEip155, "unsignedEip155"); }); } - - for (const test of tests) { - it(`serialized unsigned Berlin transaction: ${ test.name }`, function() { - const txData = Object.assign({ }, test.transaction, { - type: 1, - maxFeePerGas: undefined, - maxPriorityFeePerGas: undefined - }); - - const tx = Transaction.from(txData); - assert.equal(tx.unsignedSerialized, test.unsignedBerlin, "unsignedBerlin"); - }); - } - - for (const test of tests) { - it(`serialized unsigned London transaction: ${ test.name }`, function() { - const txData = Object.assign({ }, test.transaction, { type: 2 }); - const tx = Transaction.from(txData); - assert.equal(tx.unsignedSerialized, test.unsignedLondon, "unsignedLondon"); - }); - } }); describe("Tests Signed Transaction Serializing", function() { const tests = loadTests("transactions"); - for (const test of tests) { - it(`serialized signed legacy transaction: ${ test.name }`, function() { - const txData = Object.assign({ }, test.transaction, { - type: 0, - accessList: undefined, - maxFeePerGas: undefined, - maxPriorityFeePerGas: undefined, - signature: test.signatureLegacy - }); - - // Use the testcase sans the chainId for a legacy test - if (txData.chainId != null && parseInt(txData.chainId) != 0) { txData.chainId = "0x00"; } - - const tx = Transaction.from(txData); - assert.equal(tx.serialized, test.signedLegacy, "signedLegacy"); - }); - } - for (const test of tests) { if (!test.unsignedEip155) { continue; } it(`serialized signed EIP-155 transaction: ${ test.name }`, function() { const txData = Object.assign({ }, test.transaction, { type: 0, - accessList: undefined, - maxFeePerGas: undefined, - maxPriorityFeePerGas: undefined, + accessList: [], + maxFeePerGas: 0, + maxPriorityFeePerGas: 0, signature: test.signatureEip155 }); - const tx = Transaction.from(txData); assert.equal(tx.serialized, test.signedEip155, "signedEip155"); }); } - - for (const test of tests) { - it(`serialized signed Berlin transaction: ${ test.name }`, function() { - const txData = Object.assign({ }, test.transaction, { - type: 1, - maxFeePerGas: undefined, - maxPriorityFeePerGas: undefined - }, { signature: test.signatureBerlin }); - - const tx = Transaction.from(txData); - assert.equal(tx.serialized, test.signedBerlin, "signedBerlin"); - }); - } - - for (const test of tests) { - it(`serialized signed London transaction: ${ test.name }`, function() { - const txData = Object.assign({ }, test.transaction, { - type: 2, - signature: test.signatureLondon - }); - - const tx = Transaction.from(txData); - assert.equal(tx.serialized, test.signedLondon, "signedLondon"); - }); - } }); function assertTxUint(actual: null | bigint, _expected: undefined | string, name: string): void { @@ -164,10 +80,9 @@ function addDefaults(tx: any): any { tx = Object.assign({ }, tx); addDefault(tx, "nonce", 0); addDefault(tx, "gasLimit", BN_0); - addDefault(tx, "gasPrice", BN_0); addDefault(tx, "maxFeePerGas", BN_0); addDefault(tx, "maxPriorityFeePerGas", BN_0); - addDefault(tx, "value", BN_0); + addDefault(tx, "value", 0); addDefault(tx, "data", "0x"); addDefault(tx, "accessList", [ ]); addDefault(tx, "chainId", BN_0); @@ -177,53 +92,15 @@ function addDefaults(tx: any): any { describe("Tests Unsigned Transaction Parsing", function() { const tests = loadTests("transactions"); - for (const test of tests) { - it(`parses unsigned legacy transaction: ${ test.name }`, function() { - const tx = Transaction.from(test.unsignedLegacy); - - const expected = addDefaults(test.transaction); - expected.maxFeePerGas = null; - expected.maxPriorityFeePerGas = null; - expected.accessList = null; - expected.chainId = BN_0; - - assertTxEqual(tx, expected); - }); - } - for (const test of tests) { if (!test.unsignedEip155) { continue; } it(`parses unsigned EIP-155 transaction: ${ test.name }`, function() { const tx = Transaction.from(test.unsignedEip155); const expected = addDefaults(test.transaction); - expected.maxFeePerGas = null; - expected.maxPriorityFeePerGas = null; - expected.accessList = null; - - assertTxEqual(tx, expected); - }); - } - - for (const test of tests) { - it(`parses unsigned Berlin transaction: ${ test.name }`, function() { - const tx = Transaction.from(test.unsignedBerlin); - - const expected = addDefaults(test.transaction); - expected.maxFeePerGas = null; - expected.maxPriorityFeePerGas = null; - - assertTxEqual(tx, expected); - }); - } - - for (const test of tests) { - it(`parses unsigned London transaction: ${ test.name }`, function() { - const tx = Transaction.from(test.unsignedLondon); - - const expected = addDefaults(test.transaction); - expected.gasPrice = null; - + expected.maxFeePerGas = 0; + expected.maxPriorityFeePerGas = 0; + expected.accessList = []; assertTxEqual(tx, expected); }); } @@ -232,46 +109,17 @@ describe("Tests Unsigned Transaction Parsing", function() { describe("Tests Signed Transaction Parsing", function() { const tests = loadTests("transactions"); - for (const test of tests) { - it(`parses signed legacy transaction: ${ test.name }`, function() { - let tx = Transaction.from(test.signedLegacy); - - const expected = addDefaults(test.transaction); - expected.maxFeePerGas = null; - expected.maxPriorityFeePerGas = null; - expected.accessList = null; - expected.chainId = BN_0; - - for (let i = 0; i < 2; i++) { - assertTxEqual(tx, expected); - - assert.equal(tx.typeName, "legacy", "typeName"); - - assert.ok(!!tx.signature, "signature:!null") - assert.equal(tx.signature.r, test.signatureLegacy.r, "signature.r"); - assert.equal(tx.signature.s, test.signatureLegacy.s, "signature.s"); - assert.equal(BigInt(tx.signature.v), BigInt(test.signatureLegacy.v), "signature.v"); - - tx = tx.clone(); - } - }); - } - for (const test of tests) { if (!test.unsignedEip155) { continue; } it(`parses signed EIP-155 transaction: ${ test.name }`, function() { let tx = Transaction.from(test.signedEip155); - const expected = addDefaults(test.transaction); - expected.maxFeePerGas = null; - expected.maxPriorityFeePerGas = null; - expected.accessList = null; - + expected.maxFeePerGas = 0; + expected.maxPriorityFeePerGas = 0; + expected.accessList = []; for (let i = 0; i < 2; i++) { assertTxEqual(tx, expected); - assert.equal(tx.typeName, "legacy", "typeName"); - assert.ok(!!tx.signature, "signature:!null") assert.equal(tx.signature.r, test.signatureEip155.r, "signature.r"); assert.equal(tx.signature.s, test.signatureEip155.s, "signature.s"); @@ -280,83 +128,37 @@ describe("Tests Signed Transaction Parsing", function() { } }); } - - for (const test of tests) { - it(`parses signed Berlin transaction: ${ test.name }`, function() { - let tx = Transaction.from(test.signedBerlin); - - const expected = addDefaults(test.transaction); - expected.maxFeePerGas = null; - expected.maxPriorityFeePerGas = null; - - for (let i = 0; i < 2; i++) { - assertTxEqual(tx, expected); - - assert.equal(tx.typeName, "eip-2930", "typeName"); - - assert.ok(!!tx.signature, "signature:!null") - assert.equal(tx.signature.r, test.signatureBerlin.r, "signature.r"); - assert.equal(tx.signature.s, test.signatureBerlin.s, "signature.s"); - assert.equal(tx.signature.yParity, parseInt(test.signatureBerlin.v), "signature.v"); - - tx = tx.clone(); - } - }); - } - - for (const test of tests) { - it(`parses signed London transaction: ${ test.name }`, function() { - let tx = Transaction.from(test.signedLondon); - - const expected = addDefaults(test.transaction); - expected.gasPrice = null; - - for (let i = 0; i < 2; i++) { - assertTxEqual(tx, expected); - - assert.equal(tx.typeName, "eip-1559", "typeName"); - - assert.ok(!!tx.signature, "signature:!null") - assert.equal(tx.signature.r, test.signatureLondon.r, "signature.r"); - assert.equal(tx.signature.s, test.signatureLondon.s, "signature.s"); - assert.equal(tx.signature.yParity, parseInt(test.signatureLondon.v), "signature.v"); - - // Test cloning - tx = tx.clone(); - } - }); - } }); describe("Tests Transaction Parameters", function() { const badData: Array<{ name: string, data: string, argument: string, message?: string }> = [ { name: "accessList=0x09", - data: "0x02c9010203040580070809", + data: "0x00c9010203040580070809", message: "invalid access list", argument: "accessList" }, { name: "accessList=[0x09]", - data: "0x02ca0102030405800708c109", + data: "0x00ca0102030405800708c109", message: "invalid address-slot set", argument: "accessList" }, { name: "accessList=[0x09,0x10]", - data: "0x02cb0102030405800708c20910", + data: "0x00cb0102030405800708c20910", message: "invalid address-slot set", argument: "accessList" }, { name: "accessList=[0x09,[HASH]] (bad address)", - data: "0x02ed0102030405800708e4e309e1a024412927c99a717115f5308c0ebd11136659b3cb6291abb4a8f87e9856a12538", + data: "0x00ed0102030405800708e4e309e1a024412927c99a717115f5308c0ebd11136659b3cb6291abb4a8f87e9856a12538", message: "invalid address", argument: "accessList" }, { name: "accessList=[ADDR,[0x09]] (bad slot)", - data: "0x02e10102030405800708d8d794939d33ff01840e9eeeb67525ec2f7035af41a4b1c109", + data: "0x00e10102030405800708d8d794939d33ff01840e9eeeb67525ec2f7035af41a4b1c109", message: "invalid slot", argument: "accessList" } @@ -368,7 +170,7 @@ describe("Tests Transaction Parameters", function() { // The access list is a single value: 0x09 instead of // structured data const result = Transaction.from(data); - console.log(result); + console.log(result) }, (error: any) => { return (isError(error, "INVALID_ARGUMENT") && error.argument === argument && diff --git a/src.ts/_tests/test-wallet.ts b/src.ts/_tests/test-wallet.ts index 5e739920..918d1b08 100644 --- a/src.ts/_tests/test-wallet.ts +++ b/src.ts/_tests/test-wallet.ts @@ -6,7 +6,6 @@ import type { TestCaseAccount, TestCaseTypedData, TestCaseTransaction } from "./types.js"; - import { hexlify, randomBytes, Wallet } from "../index.js"; import type { HDNodeWallet } from "../index.js"; @@ -26,46 +25,20 @@ describe("Test Private Key Wallet", function() { describe("Test Transaction Signing", function() { const tests = loadTests("transactions"); - for (const test of tests) { - it(`tests signing a legacy transaction: ${ test.name }`, async function() { - const wallet = new Wallet(test.privateKey); - const txData = Object.assign({ }, test.transaction, { type: 0, accessList: undefined, maxFeePerGas: undefined, maxPriorityFeePerGas: undefined }); - - // Use the testcase sans the chainId for a legacy test - if (txData.chainId != null && parseInt(txData.chainId) != 0) { txData.chainId = "0x00"; } - - const signed = await wallet.signTransaction(txData); - assert.equal(signed, test.signedLegacy, "signedLegacy"); - }); - } for (const test of tests) { if (!test.signedEip155) { continue; } it(`tests signing an EIP-155 transaction: ${ test.name }`, async function() { const wallet = new Wallet(test.privateKey); - const txData = Object.assign({ }, test.transaction, { type: 0, accessList: undefined, maxFeePerGas: undefined, maxPriorityFeePerGas: undefined }); + const txData = Object.assign({ }, test.transaction, { type: 0, accessList: [], maxFeePerGas: 0, maxPriorityFeePerGas: 0 }); const signed = await wallet.signTransaction(txData); + // let parsed = Transaction.from(signed); + // // console.log('txData: ', JSON.stringify(parsed)) + // // console.log('EXPECTED: ', test.signedEip155) + // // console.log("ACTUAL: ", signed) assert.equal(signed, test.signedEip155, "signedEip155"); }); } - - for (const test of tests) { - it(`tests signing a Berlin transaction: ${ test.name }`, async function() { - const wallet = new Wallet(test.privateKey); - const txData = Object.assign({ }, test.transaction, { type: 1, maxFeePerGas: undefined, maxPriorityFeePerGas: undefined }); - const signed = await wallet.signTransaction(txData); - assert.equal(signed, test.signedBerlin, "signedBerlin"); - }); - } - - for (const test of tests) { - it(`tests signing a London transaction: ${ test.name }`, async function() { - const wallet = new Wallet(test.privateKey); - const txData = Object.assign({ }, test.transaction, { type: 2 }); - const signed = await wallet.signTransaction(txData); - assert.equal(signed, test.signedLondon, "signedLondon"); - }); - } }); describe("Test Message Signing (EIP-191)", function() { diff --git a/src.ts/contract/factory.ts b/src.ts/contract/factory.ts index b8b61242..3d6b6ff6 100644 --- a/src.ts/contract/factory.ts +++ b/src.ts/contract/factory.ts @@ -167,7 +167,6 @@ export class ContractFactory = Array, I = BaseContract tx.from = this.runner.address; } const grindedTx = await this.grindContractAddress(tx); - const sentTx = await this.runner.sendTransaction(grindedTx); const address = getStatic<(tx: ContractDeployTransaction) => string>( this.constructor, diff --git a/src.ts/providers/format.ts b/src.ts/providers/format.ts index 8f629ade..b04c6204 100644 --- a/src.ts/providers/format.ts +++ b/src.ts/providers/format.ts @@ -5,7 +5,7 @@ import { getAddress, getCreateAddress } from "../address/index.js"; import { Signature } from "../crypto/index.js" import { accessListify } from "../transaction/index.js"; import { - getBigInt, getNumber, hexlify, isHexString, zeroPadValue, + getBigInt, getNumber, isHexString, zeroPadValue, assert, assertArgument } from "../utils/index.js"; @@ -202,7 +202,6 @@ const _formatTransactionReceipt = object({ contractAddress: allowNull(getAddress, null), // should be allowNull(hash), but broken-EIP-658 support is handled in receipt index: getNumber, - root: allowNull(hexlify), gasUsed: getBigInt, logsBloom: allowNull(formatData), blockHash: formatHash, diff --git a/src.ts/providers/formatting.ts b/src.ts/providers/formatting.ts index 02cbdb5f..278f210a 100644 --- a/src.ts/providers/formatting.ts +++ b/src.ts/providers/formatting.ts @@ -284,28 +284,9 @@ export interface TransactionReceiptParams { */ status: null | number; - /** - * The root of this transaction in a pre-bazatium block. In - * post-byzantium blocks this is null. - */ - root: null | string; - etxs: ReadonlyArray; } -/* -export interface LegacyTransactionReceipt { - byzantium: false; - status: null; - root: string; -} - -export interface ByzantiumTransactionReceipt { - byzantium: true; - status: number; - root: null; -} -*/ diff --git a/src.ts/providers/provider-jsonrpc.ts b/src.ts/providers/provider-jsonrpc.ts index c218e4df..0fd77f27 100644 --- a/src.ts/providers/provider-jsonrpc.ts +++ b/src.ts/providers/provider-jsonrpc.ts @@ -1075,6 +1075,9 @@ export abstract class JsonRpcApiProvider extends AbstractProvider { * * Throws if the account doesn't exist. */ + + // Works only if using a local node or browser wallet for this, otherwise cannot get accounts + async getSigner(address?: number | string): Promise { if (address == null) { address = 0; } diff --git a/src.ts/providers/provider.ts b/src.ts/providers/provider.ts index a174172b..21793912 100644 --- a/src.ts/providers/provider.ts +++ b/src.ts/providers/provider.ts @@ -981,19 +981,6 @@ export class Log implements LogParams { ////////////////////// // Transaction Receipt -/* -export interface LegacyTransactionReceipt { - byzantium: false; - status: null; - root: string; -} - -export interface ByzantiumTransactionReceipt { - byzantium: true; - status: number; - root: null; -} -*/ /** * A **TransactionReceipt** includes additional information about a @@ -1100,7 +1087,6 @@ export class TransactionReceipt implements TransactionReceiptParams, Iterable; @@ -1144,7 +1130,6 @@ export class TransactionReceipt implements TransactionReceiptParams, Iterable { if (payload[0] >= 0x7f) { // @TODO: > vs >= ?? return Transaction.from(_parse(payload)); } - switch(payload[0]) { case 0: return Transaction.from(_parse(payload)); @@ -761,7 +758,6 @@ export class Transaction implements TransactionLike { if (tx.to != null) { result.to = tx.to; } if (tx.nonce != null) { result.nonce = tx.nonce; } if (tx.gasLimit != null) { result.gasLimit = tx.gasLimit; } - if (tx.gasPrice != null) { result.gasPrice = tx.gasPrice; } if (tx.maxPriorityFeePerGas != null) { result.maxPriorityFeePerGas = tx.maxPriorityFeePerGas; } if (tx.maxFeePerGas != null) { result.maxFeePerGas = tx.maxFeePerGas; } if (tx.data != null) { result.data = tx.data; } diff --git a/src.ts/utils/shards.ts b/src.ts/utils/shards.ts index 32723a7e..7b5a83b0 100644 --- a/src.ts/utils/shards.ts +++ b/src.ts/utils/shards.ts @@ -1,11 +1,11 @@ -import { ShardData } from "../constants"; +import { ShardData } from "../constants/shards.js"; export function getShardForAddress(address: string): string | null { if (address.length < 4) return null; const byteCode = address.substring(2, 4).toUpperCase(); for (const shardInfo of ShardData) { - if (byteCode >= shardInfo.byte[0] && byteCode <= shardInfo.byte[1]) { + if (byteCode >= shardInfo.byte[0].toUpperCase() && byteCode <= shardInfo.byte[1].toUpperCase()) { return shardInfo.shard; } } diff --git a/testcases/test-env/test-tsc/tsconfig.json b/testcases/test-env/test-tsc/tsconfig.json index d0edaaf5..bc217daf 100644 --- a/testcases/test-env/test-tsc/tsconfig.json +++ b/testcases/test-env/test-tsc/tsconfig.json @@ -1,13 +1,15 @@ { "compilerOptions": { "declaration": true, + "module": "esnext", "importHelpers": false, + "resolveJsonModule": true, + "esModuleInterop": true, "lib": [ "dom", "es2020", "es5" ], - "module": "${TS_MODULE}", "moduleResolution": "${TS_MODULE_RESOLUTION}", "strict": true, "target": "es2022" diff --git a/testcases/transactions.json.gz b/testcases/transactions.json.gz index 7f6d75b7..2a0a6577 100644 Binary files a/testcases/transactions.json.gz and b/testcases/transactions.json.gz differ diff --git a/transactions.json.gz b/transactions.json.gz new file mode 100644 index 00000000..e69de29b