diff --git a/ts/shielder-sdk/.gitignore b/ts/shielder-sdk/.gitignore index 7602784b..4eb1adb4 100644 --- a/ts/shielder-sdk/.gitignore +++ b/ts/shielder-sdk/.gitignore @@ -1,5 +1,5 @@ dist/ node_modules/ -src/_generated/ +src/_generated/abi.ts coverage/ report.json diff --git a/ts/shielder-sdk/src/_generated/abi_v0_0_1.ts b/ts/shielder-sdk/src/_generated/abi_v0_0_1.ts new file mode 100644 index 00000000..1d22a3a2 --- /dev/null +++ b/ts/shielder-sdk/src/_generated/abi_v0_0_1.ts @@ -0,0 +1,863 @@ +export const abi = +[ + { + "type": "constructor", + "inputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "ARITY", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "CONTRACT_VERSION", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "bytes3", + "internalType": "bytes3" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "GAS_LIMIT", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "MAX_CONTRACT_BALANCE", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "MAX_TRANSACTION_AMOUNT", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "TREE_HEIGHT", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "UPGRADE_INTERFACE_VERSION", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "string", + "internalType": "string" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "acceptOwnership", + "inputs": [], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "addressToUInt256", + "inputs": [ + { + "name": "addr", + "type": "address", + "internalType": "address" + } + ], + "outputs": [ + { + "name": "", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "pure" + }, + { + "type": "function", + "name": "depositLimit", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "depositNative", + "inputs": [ + { + "name": "expectedContractVersion", + "type": "bytes3", + "internalType": "bytes3" + }, + { + "name": "idHiding", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "oldNullifierHash", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "newNote", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "merkleRoot", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "proof", + "type": "bytes", + "internalType": "bytes" + } + ], + "outputs": [], + "stateMutability": "payable" + }, + { + "type": "function", + "name": "getMerklePath", + "inputs": [ + { + "name": "index", + "type": "uint256", + "internalType": "uint256" + } + ], + "outputs": [ + { + "name": "", + "type": "uint256[]", + "internalType": "uint256[]" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "initialize", + "inputs": [ + { + "name": "initialOwner", + "type": "address", + "internalType": "address" + }, + { + "name": "_depositLimit", + "type": "uint256", + "internalType": "uint256" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "merkleTree", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "newAccountNative", + "inputs": [ + { + "name": "expectedContractVersion", + "type": "bytes3", + "internalType": "bytes3" + }, + { + "name": "newNote", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "idHash", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "proof", + "type": "bytes", + "internalType": "bytes" + } + ], + "outputs": [], + "stateMutability": "payable" + }, + { + "type": "function", + "name": "nullifiers", + "inputs": [ + { + "name": "nullifier", + "type": "uint256", + "internalType": "uint256" + } + ], + "outputs": [ + { + "name": "", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "owner", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "address", + "internalType": "address" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "pause", + "inputs": [], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "paused", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "bool", + "internalType": "bool" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "pendingOwner", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "address", + "internalType": "address" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "proxiableUUID", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "bytes32", + "internalType": "bytes32" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "renounceOwnership", + "inputs": [], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "setDepositLimit", + "inputs": [ + { + "name": "_depositLimit", + "type": "uint256", + "internalType": "uint256" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "transferOwnership", + "inputs": [ + { + "name": "newOwner", + "type": "address", + "internalType": "address" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "unpause", + "inputs": [], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "upgradeToAndCall", + "inputs": [ + { + "name": "newImplementation", + "type": "address", + "internalType": "address" + }, + { + "name": "data", + "type": "bytes", + "internalType": "bytes" + } + ], + "outputs": [], + "stateMutability": "payable" + }, + { + "type": "function", + "name": "withdrawNative", + "inputs": [ + { + "name": "expectedContractVersion", + "type": "bytes3", + "internalType": "bytes3" + }, + { + "name": "idHiding", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "amount", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "withdrawAddress", + "type": "address", + "internalType": "address" + }, + { + "name": "merkleRoot", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "oldNullifierHash", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "newNote", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "proof", + "type": "bytes", + "internalType": "bytes" + }, + { + "name": "relayerAddress", + "type": "address", + "internalType": "address" + }, + { + "name": "relayerFee", + "type": "uint256", + "internalType": "uint256" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "event", + "name": "DepositNative", + "inputs": [ + { + "name": "contractVersion", + "type": "bytes3", + "indexed": false, + "internalType": "bytes3" + }, + { + "name": "idHiding", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "amount", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "newNote", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "newNoteIndex", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "Initialized", + "inputs": [ + { + "name": "version", + "type": "uint64", + "indexed": false, + "internalType": "uint64" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "NewAccountNative", + "inputs": [ + { + "name": "contractVersion", + "type": "bytes3", + "indexed": false, + "internalType": "bytes3" + }, + { + "name": "idHash", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "amount", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "newNote", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "newNoteIndex", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "OwnershipTransferStarted", + "inputs": [ + { + "name": "previousOwner", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "newOwner", + "type": "address", + "indexed": true, + "internalType": "address" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "OwnershipTransferred", + "inputs": [ + { + "name": "previousOwner", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "newOwner", + "type": "address", + "indexed": true, + "internalType": "address" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "Paused", + "inputs": [ + { + "name": "account", + "type": "address", + "indexed": false, + "internalType": "address" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "Unpaused", + "inputs": [ + { + "name": "account", + "type": "address", + "indexed": false, + "internalType": "address" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "Upgraded", + "inputs": [ + { + "name": "implementation", + "type": "address", + "indexed": true, + "internalType": "address" + } + ], + "anonymous": false + }, + { + "type": "event", + "name": "WithdrawNative", + "inputs": [ + { + "name": "contractVersion", + "type": "bytes3", + "indexed": false, + "internalType": "bytes3" + }, + { + "name": "idHiding", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "amount", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "to", + "type": "address", + "indexed": false, + "internalType": "address" + }, + { + "name": "newNote", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "newNoteIndex", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "relayerAddress", + "type": "address", + "indexed": false, + "internalType": "address" + }, + { + "name": "fee", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + } + ], + "anonymous": false + }, + { + "type": "error", + "name": "AddressEmptyCode", + "inputs": [ + { + "name": "target", + "type": "address", + "internalType": "address" + } + ] + }, + { + "type": "error", + "name": "AmountOverDepositLimit", + "inputs": [] + }, + { + "type": "error", + "name": "AmountTooHigh", + "inputs": [] + }, + { + "type": "error", + "name": "ContractBalanceLimitReached", + "inputs": [] + }, + { + "type": "error", + "name": "DepositVerificationFailed", + "inputs": [] + }, + { + "type": "error", + "name": "DuplicatedNullifier", + "inputs": [] + }, + { + "type": "error", + "name": "ERC1967InvalidImplementation", + "inputs": [ + { + "name": "implementation", + "type": "address", + "internalType": "address" + } + ] + }, + { + "type": "error", + "name": "ERC1967NonPayable", + "inputs": [] + }, + { + "type": "error", + "name": "EnforcedPause", + "inputs": [] + }, + { + "type": "error", + "name": "ExpectedPause", + "inputs": [] + }, + { + "type": "error", + "name": "FailedInnerCall", + "inputs": [] + }, + { + "type": "error", + "name": "FeeHigherThanAmount", + "inputs": [] + }, + { + "type": "error", + "name": "InvalidInitialization", + "inputs": [] + }, + { + "type": "error", + "name": "InvalidTreeHeight", + "inputs": [] + }, + { + "type": "error", + "name": "LeafNotExisting", + "inputs": [] + }, + { + "type": "error", + "name": "MaxTreeSizeExceeded", + "inputs": [] + }, + { + "type": "error", + "name": "MerkleRootDoesNotExist", + "inputs": [] + }, + { + "type": "error", + "name": "NativeTransferFailed", + "inputs": [] + }, + { + "type": "error", + "name": "NewAccountVerificationFailed", + "inputs": [] + }, + { + "type": "error", + "name": "NotAFieldElement", + "inputs": [] + }, + { + "type": "error", + "name": "NotInitializing", + "inputs": [] + }, + { + "type": "error", + "name": "OwnableInvalidOwner", + "inputs": [ + { + "name": "owner", + "type": "address", + "internalType": "address" + } + ] + }, + { + "type": "error", + "name": "OwnableUnauthorizedAccount", + "inputs": [ + { + "name": "account", + "type": "address", + "internalType": "address" + } + ] + }, + { + "type": "error", + "name": "UUPSUnauthorizedCallContext", + "inputs": [] + }, + { + "type": "error", + "name": "UUPSUnsupportedProxiableUUID", + "inputs": [ + { + "name": "slot", + "type": "bytes32", + "internalType": "bytes32" + } + ] + }, + { + "type": "error", + "name": "WithdrawVerificationFailed", + "inputs": [] + }, + { + "type": "error", + "name": "WrongContractVersion", + "inputs": [ + { + "name": "actual", + "type": "bytes3", + "internalType": "bytes3" + }, + { + "name": "expectedByCaller", + "type": "bytes3", + "internalType": "bytes3" + } + ] + }, + { + "type": "error", + "name": "ZeroAmount", + "inputs": [] + } +]as const; \ No newline at end of file diff --git a/ts/shielder-sdk/src/chain/contract.ts b/ts/shielder-sdk/src/chain/contract.ts index 044faaf4..5a74afe7 100644 --- a/ts/shielder-sdk/src/chain/contract.ts +++ b/ts/shielder-sdk/src/chain/contract.ts @@ -10,7 +10,7 @@ import { } from "viem"; import { BaseError, ContractFunctionRevertedError } from "viem"; -import { abi } from "../_generated/abi"; +import { abi } from "../_generated/abi_v0_0_1"; import { shieldActionGasLimit } from "@/constants"; export class VersionRejectedByContract extends CustomError {