UNPKG

@coinbase/cdp-sdk

Version:

SDK for interacting with the Coinbase Developer Platform Wallet API

990 lines 65.2 kB
/** * Generated by orval v7.6.0 🍺 * Do not edit manually. * Coinbase Developer Platform APIs * The Coinbase Developer Platform APIs - leading the world's transition onchain. * OpenAPI spec version: 2.0.0 */ import { faker } from "@faker-js/faker"; import { HttpResponse, delay, http } from "msw"; import { AbiStateMutability, KnownAbiType } from "../coinbaseDeveloperPlatformAPIs.schemas.js"; export const getListPoliciesResponseEthValueCriterionMock = (overrideResponse = {}) => ({ ...{ type: faker.helpers.arrayElement(["ethValue"]), ethValue: faker.helpers.fromRegExp("^[0-9]+$"), operator: faker.helpers.arrayElement([">", ">=", "<", "<=", "=="]), }, ...overrideResponse, }); export const getListPoliciesResponseEvmAddressCriterionMock = (overrideResponse = {}) => ({ ...{ type: faker.helpers.arrayElement(["evmAddress"]), addresses: Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() => faker.helpers.fromRegExp("^0x[0-9a-fA-F]{40}$")), operator: faker.helpers.arrayElement(["in", "not in"]), }, ...overrideResponse, }); export const getListPoliciesResponseAbiFunctionMock = (overrideResponse = {}) => ({ ...{ type: faker.helpers.arrayElement(["function"]), name: faker.string.alpha(20), inputs: Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() => ({ name: faker.helpers.arrayElement([faker.string.alpha(20), undefined]), type: faker.string.alpha(20), internalType: faker.helpers.arrayElement([faker.string.alpha(20), undefined]), components: faker.helpers.arrayElement([[], undefined]), })), outputs: Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() => ({ name: faker.helpers.arrayElement([faker.string.alpha(20), undefined]), type: faker.string.alpha(20), internalType: faker.helpers.arrayElement([faker.string.alpha(20), undefined]), components: faker.helpers.arrayElement([[], undefined]), })), constant: faker.helpers.arrayElement([faker.datatype.boolean(), undefined]), payable: faker.helpers.arrayElement([faker.datatype.boolean(), undefined]), stateMutability: faker.helpers.arrayElement(Object.values(AbiStateMutability)), gas: faker.helpers.arrayElement([ faker.number.int({ min: undefined, max: undefined }), undefined, ]), }, ...overrideResponse, }); export const getListPoliciesResponseAbiInputMock = (overrideResponse = {}) => ({ ...{ type: faker.helpers.arrayElement([ "constructor", "error", "event", "fallback", "receive", ]), additionalProperties: faker.helpers.arrayElement([{}, undefined]), }, ...overrideResponse, }); export const getListPoliciesResponseEvmDataParameterConditionMock = (overrideResponse = {}) => ({ ...{ name: faker.string.alpha(20), operator: faker.helpers.arrayElement([">", ">=", "<", "<=", "=="]), value: faker.string.alpha(20), }, ...overrideResponse, }); export const getListPoliciesResponseEvmDataParameterConditionListMock = (overrideResponse = {}) => ({ ...{ name: faker.string.alpha(20), operator: faker.helpers.arrayElement(["in", "not in"]), values: Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() => faker.string.alpha(20)), }, ...overrideResponse, }); export const getListPoliciesResponseEvmDataCriterionMock = (overrideResponse = {}) => ({ ...{ type: faker.helpers.arrayElement(["evmData"]), abi: faker.helpers.arrayElement([ faker.helpers.arrayElement(Object.values(KnownAbiType)), Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() => faker.helpers.arrayElement([ { ...getListPoliciesResponseAbiFunctionMock() }, { ...getListPoliciesResponseAbiInputMock() }, ])), ]), conditions: Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() => ({ function: faker.string.alpha(20), params: faker.helpers.arrayElement([ Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() => faker.helpers.arrayElement([ { ...getListPoliciesResponseEvmDataParameterConditionMock() }, { ...getListPoliciesResponseEvmDataParameterConditionListMock() }, ])), undefined, ]), })), }, ...overrideResponse, }); export const getListPoliciesResponseNetUSDChangeCriterionMock = (overrideResponse = {}) => ({ ...{ type: faker.helpers.arrayElement(["netUSDChange"]), changeCents: faker.number.int({ min: undefined, max: undefined }), operator: faker.helpers.arrayElement([">", ">=", "<", "<=", "=="]), }, ...overrideResponse, }); export const getListPoliciesResponseEvmNetworkCriterionMock = (overrideResponse = {}) => ({ ...{ type: faker.helpers.arrayElement(["evmNetwork"]), networks: faker.helpers.arrayElements([ "base-sepolia", "base", "ethereum", "ethereum-sepolia", "avalanche", "polygon", "optimism", "arbitrum", "zora", "bnb", ]), operator: faker.helpers.arrayElement(["in", "not in"]), }, ...overrideResponse, }); export const getListPoliciesResponseEvmMessageCriterionMock = (overrideResponse = {}) => ({ ...{ type: faker.helpers.arrayElement(["evmMessage"]), match: faker.string.alpha(20) }, ...overrideResponse, }); export const getListPoliciesResponseEvmTypedAddressConditionMock = (overrideResponse = {}) => ({ ...{ addresses: Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() => faker.helpers.fromRegExp("^0x[0-9a-fA-F]{40}$")), operator: faker.helpers.arrayElement(["in", "not in"]), path: faker.string.alpha(20), }, ...overrideResponse, }); export const getListPoliciesResponseEvmTypedNumericalConditionMock = (overrideResponse = {}) => ({ ...{ value: faker.helpers.fromRegExp("^[0-9]+$"), operator: faker.helpers.arrayElement([">", ">=", "<", "<=", "=="]), path: faker.string.alpha(20), }, ...overrideResponse, }); export const getListPoliciesResponseEvmTypedStringConditionMock = (overrideResponse = {}) => ({ ...{ match: faker.string.alpha(20), path: faker.string.alpha(20) }, ...overrideResponse, }); export const getListPoliciesResponseSignEvmTypedDataFieldCriterionMock = (overrideResponse = {}) => ({ ...{ type: faker.helpers.arrayElement(["evmTypedDataField"]), types: { types: { [faker.string.alphanumeric(5)]: Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() => ({ name: faker.helpers.arrayElement([faker.string.alpha(20), undefined]), type: faker.helpers.arrayElement([faker.string.alpha(20), undefined]), })), }, primaryType: faker.string.alpha(20), }, conditions: Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() => faker.helpers.arrayElement([ { ...getListPoliciesResponseEvmTypedAddressConditionMock() }, { ...getListPoliciesResponseEvmTypedNumericalConditionMock() }, { ...getListPoliciesResponseEvmTypedStringConditionMock() }, ])), }, ...overrideResponse, }); export const getListPoliciesResponseSignEvmTypedDataVerifyingContractCriterionMock = (overrideResponse = {}) => ({ ...{ type: faker.helpers.arrayElement(["evmTypedDataVerifyingContract"]), addresses: Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() => faker.helpers.fromRegExp("^0x[0-9a-fA-F]{40}$")), operator: faker.helpers.arrayElement(["in", "not in"]), }, ...overrideResponse, }); export const getListPoliciesResponseSolAddressCriterionMock = (overrideResponse = {}) => ({ ...{ type: faker.helpers.arrayElement(["solAddress"]), addresses: Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() => faker.helpers.fromRegExp("^[1-9A-HJ-NP-Za-km-z]{32,44}$")), operator: faker.helpers.arrayElement(["in", "not in"]), }, ...overrideResponse, }); export const getListPoliciesResponseSolValueCriterionMock = (overrideResponse = {}) => ({ ...{ type: faker.helpers.arrayElement(["solValue"]), solValue: faker.string.alpha(20), operator: faker.helpers.arrayElement([">", ">=", "<", "<=", "=="]), }, ...overrideResponse, }); export const getListPoliciesResponseSplAddressCriterionMock = (overrideResponse = {}) => ({ ...{ type: faker.helpers.arrayElement(["splAddress"]), addresses: Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() => faker.helpers.fromRegExp("^[1-9A-HJ-NP-Za-km-z]{32,44}$")), operator: faker.helpers.arrayElement(["in", "not in"]), }, ...overrideResponse, }); export const getListPoliciesResponseSplValueCriterionMock = (overrideResponse = {}) => ({ ...{ type: faker.helpers.arrayElement(["splValue"]), splValue: faker.string.alpha(20), operator: faker.helpers.arrayElement([">", ">=", "<", "<=", "=="]), }, ...overrideResponse, }); export const getListPoliciesResponseMintAddressCriterionMock = (overrideResponse = {}) => ({ ...{ type: faker.helpers.arrayElement(["mintAddress"]), addresses: Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() => faker.helpers.fromRegExp("^[1-9A-HJ-NP-Za-km-z]{32,44}$")), operator: faker.helpers.arrayElement(["in", "not in"]), }, ...overrideResponse, }); export const getListPoliciesResponseMock = () => ({ ...{ policies: Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() => ({ id: faker.helpers.fromRegExp("^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$"), description: faker.helpers.arrayElement([ faker.helpers.fromRegExp("^[A-Za-z0-9 ,.]{1,50}$"), undefined, ]), scope: faker.helpers.arrayElement(["project", "account"]), rules: Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() => faker.helpers.arrayElement([ { action: faker.helpers.arrayElement(["reject", "accept"]), operation: faker.helpers.arrayElement(["signEvmTransaction"]), criteria: Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() => faker.helpers.arrayElement([ { ...getListPoliciesResponseEthValueCriterionMock() }, { ...getListPoliciesResponseEvmAddressCriterionMock() }, { ...getListPoliciesResponseEvmDataCriterionMock() }, { ...getListPoliciesResponseNetUSDChangeCriterionMock() }, ])), }, { action: faker.helpers.arrayElement(["reject", "accept"]), operation: faker.helpers.arrayElement(["sendEvmTransaction"]), criteria: Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() => faker.helpers.arrayElement([ { ...getListPoliciesResponseEthValueCriterionMock() }, { ...getListPoliciesResponseEvmAddressCriterionMock() }, { ...getListPoliciesResponseEvmNetworkCriterionMock() }, { ...getListPoliciesResponseEvmDataCriterionMock() }, { ...getListPoliciesResponseNetUSDChangeCriterionMock() }, ])), }, { action: faker.helpers.arrayElement(["reject", "accept"]), operation: faker.helpers.arrayElement(["signEvmMessage"]), criteria: Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() => faker.helpers.arrayElement([ { ...getListPoliciesResponseEvmMessageCriterionMock() }, ])), }, { action: faker.helpers.arrayElement(["reject", "accept"]), operation: faker.helpers.arrayElement(["signEvmTypedData"]), criteria: Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() => faker.helpers.arrayElement([ { ...getListPoliciesResponseSignEvmTypedDataFieldCriterionMock() }, { ...getListPoliciesResponseSignEvmTypedDataVerifyingContractCriterionMock() }, ])), }, { action: faker.helpers.arrayElement(["reject", "accept"]), operation: faker.helpers.arrayElement(["signSolTransaction"]), criteria: Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() => faker.helpers.arrayElement([ { ...getListPoliciesResponseSolAddressCriterionMock() }, { ...getListPoliciesResponseSolValueCriterionMock() }, { ...getListPoliciesResponseSplAddressCriterionMock() }, { ...getListPoliciesResponseSplValueCriterionMock() }, { ...getListPoliciesResponseMintAddressCriterionMock() }, ])), }, { action: faker.helpers.arrayElement(["reject", "accept"]), operation: faker.helpers.arrayElement(["sendSolTransaction"]), criteria: Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() => faker.helpers.arrayElement([ { ...getListPoliciesResponseSolAddressCriterionMock() }, { ...getListPoliciesResponseSolValueCriterionMock() }, { ...getListPoliciesResponseSplAddressCriterionMock() }, { ...getListPoliciesResponseSplValueCriterionMock() }, { ...getListPoliciesResponseMintAddressCriterionMock() }, ])), }, { action: faker.helpers.arrayElement(["reject", "accept"]), operation: faker.helpers.arrayElement(["signEvmHash"]), }, { action: faker.helpers.arrayElement(["reject", "accept"]), operation: faker.helpers.arrayElement(["prepareUserOperation"]), criteria: Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() => faker.helpers.arrayElement([ { ...getListPoliciesResponseEthValueCriterionMock() }, { ...getListPoliciesResponseEvmAddressCriterionMock() }, { ...getListPoliciesResponseEvmNetworkCriterionMock() }, { ...getListPoliciesResponseEvmDataCriterionMock() }, ])), }, { action: faker.helpers.arrayElement(["reject", "accept"]), operation: faker.helpers.arrayElement(["sendUserOperation"]), criteria: Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() => faker.helpers.arrayElement([ { ...getListPoliciesResponseEthValueCriterionMock() }, { ...getListPoliciesResponseEvmAddressCriterionMock() }, { ...getListPoliciesResponseEvmDataCriterionMock() }, ])), }, ])), createdAt: faker.string.alpha(20), updatedAt: faker.string.alpha(20), })), }, ...{ nextPageToken: faker.helpers.arrayElement([faker.string.alpha(20), undefined]) }, }); export const getCreatePolicyResponseEthValueCriterionMock = (overrideResponse = {}) => ({ ...{ type: faker.helpers.arrayElement(["ethValue"]), ethValue: faker.helpers.fromRegExp("^[0-9]+$"), operator: faker.helpers.arrayElement([">", ">=", "<", "<=", "=="]), }, ...overrideResponse, }); export const getCreatePolicyResponseEvmAddressCriterionMock = (overrideResponse = {}) => ({ ...{ type: faker.helpers.arrayElement(["evmAddress"]), addresses: Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() => faker.helpers.fromRegExp("^0x[0-9a-fA-F]{40}$")), operator: faker.helpers.arrayElement(["in", "not in"]), }, ...overrideResponse, }); export const getCreatePolicyResponseAbiFunctionMock = (overrideResponse = {}) => ({ ...{ type: faker.helpers.arrayElement(["function"]), name: faker.string.alpha(20), inputs: Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() => ({ name: faker.helpers.arrayElement([faker.string.alpha(20), undefined]), type: faker.string.alpha(20), internalType: faker.helpers.arrayElement([faker.string.alpha(20), undefined]), components: faker.helpers.arrayElement([[], undefined]), })), outputs: Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() => ({ name: faker.helpers.arrayElement([faker.string.alpha(20), undefined]), type: faker.string.alpha(20), internalType: faker.helpers.arrayElement([faker.string.alpha(20), undefined]), components: faker.helpers.arrayElement([[], undefined]), })), constant: faker.helpers.arrayElement([faker.datatype.boolean(), undefined]), payable: faker.helpers.arrayElement([faker.datatype.boolean(), undefined]), stateMutability: faker.helpers.arrayElement(Object.values(AbiStateMutability)), gas: faker.helpers.arrayElement([ faker.number.int({ min: undefined, max: undefined }), undefined, ]), }, ...overrideResponse, }); export const getCreatePolicyResponseAbiInputMock = (overrideResponse = {}) => ({ ...{ type: faker.helpers.arrayElement([ "constructor", "error", "event", "fallback", "receive", ]), additionalProperties: faker.helpers.arrayElement([{}, undefined]), }, ...overrideResponse, }); export const getCreatePolicyResponseEvmDataParameterConditionMock = (overrideResponse = {}) => ({ ...{ name: faker.string.alpha(20), operator: faker.helpers.arrayElement([">", ">=", "<", "<=", "=="]), value: faker.string.alpha(20), }, ...overrideResponse, }); export const getCreatePolicyResponseEvmDataParameterConditionListMock = (overrideResponse = {}) => ({ ...{ name: faker.string.alpha(20), operator: faker.helpers.arrayElement(["in", "not in"]), values: Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() => faker.string.alpha(20)), }, ...overrideResponse, }); export const getCreatePolicyResponseEvmDataCriterionMock = (overrideResponse = {}) => ({ ...{ type: faker.helpers.arrayElement(["evmData"]), abi: faker.helpers.arrayElement([ faker.helpers.arrayElement(Object.values(KnownAbiType)), Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() => faker.helpers.arrayElement([ { ...getCreatePolicyResponseAbiFunctionMock() }, { ...getCreatePolicyResponseAbiInputMock() }, ])), ]), conditions: Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() => ({ function: faker.string.alpha(20), params: faker.helpers.arrayElement([ Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() => faker.helpers.arrayElement([ { ...getCreatePolicyResponseEvmDataParameterConditionMock() }, { ...getCreatePolicyResponseEvmDataParameterConditionListMock() }, ])), undefined, ]), })), }, ...overrideResponse, }); export const getCreatePolicyResponseNetUSDChangeCriterionMock = (overrideResponse = {}) => ({ ...{ type: faker.helpers.arrayElement(["netUSDChange"]), changeCents: faker.number.int({ min: undefined, max: undefined }), operator: faker.helpers.arrayElement([">", ">=", "<", "<=", "=="]), }, ...overrideResponse, }); export const getCreatePolicyResponseEvmNetworkCriterionMock = (overrideResponse = {}) => ({ ...{ type: faker.helpers.arrayElement(["evmNetwork"]), networks: faker.helpers.arrayElements([ "base-sepolia", "base", "ethereum", "ethereum-sepolia", "avalanche", "polygon", "optimism", "arbitrum", "zora", "bnb", ]), operator: faker.helpers.arrayElement(["in", "not in"]), }, ...overrideResponse, }); export const getCreatePolicyResponseEvmMessageCriterionMock = (overrideResponse = {}) => ({ ...{ type: faker.helpers.arrayElement(["evmMessage"]), match: faker.string.alpha(20) }, ...overrideResponse, }); export const getCreatePolicyResponseEvmTypedAddressConditionMock = (overrideResponse = {}) => ({ ...{ addresses: Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() => faker.helpers.fromRegExp("^0x[0-9a-fA-F]{40}$")), operator: faker.helpers.arrayElement(["in", "not in"]), path: faker.string.alpha(20), }, ...overrideResponse, }); export const getCreatePolicyResponseEvmTypedNumericalConditionMock = (overrideResponse = {}) => ({ ...{ value: faker.helpers.fromRegExp("^[0-9]+$"), operator: faker.helpers.arrayElement([">", ">=", "<", "<=", "=="]), path: faker.string.alpha(20), }, ...overrideResponse, }); export const getCreatePolicyResponseEvmTypedStringConditionMock = (overrideResponse = {}) => ({ ...{ match: faker.string.alpha(20), path: faker.string.alpha(20) }, ...overrideResponse, }); export const getCreatePolicyResponseSignEvmTypedDataFieldCriterionMock = (overrideResponse = {}) => ({ ...{ type: faker.helpers.arrayElement(["evmTypedDataField"]), types: { types: { [faker.string.alphanumeric(5)]: Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() => ({ name: faker.helpers.arrayElement([faker.string.alpha(20), undefined]), type: faker.helpers.arrayElement([faker.string.alpha(20), undefined]), })), }, primaryType: faker.string.alpha(20), }, conditions: Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() => faker.helpers.arrayElement([ { ...getCreatePolicyResponseEvmTypedAddressConditionMock() }, { ...getCreatePolicyResponseEvmTypedNumericalConditionMock() }, { ...getCreatePolicyResponseEvmTypedStringConditionMock() }, ])), }, ...overrideResponse, }); export const getCreatePolicyResponseSignEvmTypedDataVerifyingContractCriterionMock = (overrideResponse = {}) => ({ ...{ type: faker.helpers.arrayElement(["evmTypedDataVerifyingContract"]), addresses: Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() => faker.helpers.fromRegExp("^0x[0-9a-fA-F]{40}$")), operator: faker.helpers.arrayElement(["in", "not in"]), }, ...overrideResponse, }); export const getCreatePolicyResponseSolAddressCriterionMock = (overrideResponse = {}) => ({ ...{ type: faker.helpers.arrayElement(["solAddress"]), addresses: Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() => faker.helpers.fromRegExp("^[1-9A-HJ-NP-Za-km-z]{32,44}$")), operator: faker.helpers.arrayElement(["in", "not in"]), }, ...overrideResponse, }); export const getCreatePolicyResponseSolValueCriterionMock = (overrideResponse = {}) => ({ ...{ type: faker.helpers.arrayElement(["solValue"]), solValue: faker.string.alpha(20), operator: faker.helpers.arrayElement([">", ">=", "<", "<=", "=="]), }, ...overrideResponse, }); export const getCreatePolicyResponseSplAddressCriterionMock = (overrideResponse = {}) => ({ ...{ type: faker.helpers.arrayElement(["splAddress"]), addresses: Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() => faker.helpers.fromRegExp("^[1-9A-HJ-NP-Za-km-z]{32,44}$")), operator: faker.helpers.arrayElement(["in", "not in"]), }, ...overrideResponse, }); export const getCreatePolicyResponseSplValueCriterionMock = (overrideResponse = {}) => ({ ...{ type: faker.helpers.arrayElement(["splValue"]), splValue: faker.string.alpha(20), operator: faker.helpers.arrayElement([">", ">=", "<", "<=", "=="]), }, ...overrideResponse, }); export const getCreatePolicyResponseMintAddressCriterionMock = (overrideResponse = {}) => ({ ...{ type: faker.helpers.arrayElement(["mintAddress"]), addresses: Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() => faker.helpers.fromRegExp("^[1-9A-HJ-NP-Za-km-z]{32,44}$")), operator: faker.helpers.arrayElement(["in", "not in"]), }, ...overrideResponse, }); export const getCreatePolicyResponseMock = (overrideResponse = {}) => ({ id: faker.helpers.fromRegExp("^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$"), description: faker.helpers.arrayElement([ faker.helpers.fromRegExp("^[A-Za-z0-9 ,.]{1,50}$"), undefined, ]), scope: faker.helpers.arrayElement(["project", "account"]), rules: Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() => faker.helpers.arrayElement([ { action: faker.helpers.arrayElement(["reject", "accept"]), operation: faker.helpers.arrayElement(["signEvmTransaction"]), criteria: Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() => faker.helpers.arrayElement([ { ...getCreatePolicyResponseEthValueCriterionMock() }, { ...getCreatePolicyResponseEvmAddressCriterionMock() }, { ...getCreatePolicyResponseEvmDataCriterionMock() }, { ...getCreatePolicyResponseNetUSDChangeCriterionMock() }, ])), }, { action: faker.helpers.arrayElement(["reject", "accept"]), operation: faker.helpers.arrayElement(["sendEvmTransaction"]), criteria: Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() => faker.helpers.arrayElement([ { ...getCreatePolicyResponseEthValueCriterionMock() }, { ...getCreatePolicyResponseEvmAddressCriterionMock() }, { ...getCreatePolicyResponseEvmNetworkCriterionMock() }, { ...getCreatePolicyResponseEvmDataCriterionMock() }, { ...getCreatePolicyResponseNetUSDChangeCriterionMock() }, ])), }, { action: faker.helpers.arrayElement(["reject", "accept"]), operation: faker.helpers.arrayElement(["signEvmMessage"]), criteria: Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() => faker.helpers.arrayElement([{ ...getCreatePolicyResponseEvmMessageCriterionMock() }])), }, { action: faker.helpers.arrayElement(["reject", "accept"]), operation: faker.helpers.arrayElement(["signEvmTypedData"]), criteria: Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() => faker.helpers.arrayElement([ { ...getCreatePolicyResponseSignEvmTypedDataFieldCriterionMock() }, { ...getCreatePolicyResponseSignEvmTypedDataVerifyingContractCriterionMock() }, ])), }, { action: faker.helpers.arrayElement(["reject", "accept"]), operation: faker.helpers.arrayElement(["signSolTransaction"]), criteria: Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() => faker.helpers.arrayElement([ { ...getCreatePolicyResponseSolAddressCriterionMock() }, { ...getCreatePolicyResponseSolValueCriterionMock() }, { ...getCreatePolicyResponseSplAddressCriterionMock() }, { ...getCreatePolicyResponseSplValueCriterionMock() }, { ...getCreatePolicyResponseMintAddressCriterionMock() }, ])), }, { action: faker.helpers.arrayElement(["reject", "accept"]), operation: faker.helpers.arrayElement(["sendSolTransaction"]), criteria: Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() => faker.helpers.arrayElement([ { ...getCreatePolicyResponseSolAddressCriterionMock() }, { ...getCreatePolicyResponseSolValueCriterionMock() }, { ...getCreatePolicyResponseSplAddressCriterionMock() }, { ...getCreatePolicyResponseSplValueCriterionMock() }, { ...getCreatePolicyResponseMintAddressCriterionMock() }, ])), }, { action: faker.helpers.arrayElement(["reject", "accept"]), operation: faker.helpers.arrayElement(["signEvmHash"]), }, { action: faker.helpers.arrayElement(["reject", "accept"]), operation: faker.helpers.arrayElement(["prepareUserOperation"]), criteria: Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() => faker.helpers.arrayElement([ { ...getCreatePolicyResponseEthValueCriterionMock() }, { ...getCreatePolicyResponseEvmAddressCriterionMock() }, { ...getCreatePolicyResponseEvmNetworkCriterionMock() }, { ...getCreatePolicyResponseEvmDataCriterionMock() }, ])), }, { action: faker.helpers.arrayElement(["reject", "accept"]), operation: faker.helpers.arrayElement(["sendUserOperation"]), criteria: Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() => faker.helpers.arrayElement([ { ...getCreatePolicyResponseEthValueCriterionMock() }, { ...getCreatePolicyResponseEvmAddressCriterionMock() }, { ...getCreatePolicyResponseEvmDataCriterionMock() }, ])), }, ])), createdAt: faker.string.alpha(20), updatedAt: faker.string.alpha(20), ...overrideResponse, }); export const getGetPolicyByIdResponseEthValueCriterionMock = (overrideResponse = {}) => ({ ...{ type: faker.helpers.arrayElement(["ethValue"]), ethValue: faker.helpers.fromRegExp("^[0-9]+$"), operator: faker.helpers.arrayElement([">", ">=", "<", "<=", "=="]), }, ...overrideResponse, }); export const getGetPolicyByIdResponseEvmAddressCriterionMock = (overrideResponse = {}) => ({ ...{ type: faker.helpers.arrayElement(["evmAddress"]), addresses: Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() => faker.helpers.fromRegExp("^0x[0-9a-fA-F]{40}$")), operator: faker.helpers.arrayElement(["in", "not in"]), }, ...overrideResponse, }); export const getGetPolicyByIdResponseAbiFunctionMock = (overrideResponse = {}) => ({ ...{ type: faker.helpers.arrayElement(["function"]), name: faker.string.alpha(20), inputs: Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() => ({ name: faker.helpers.arrayElement([faker.string.alpha(20), undefined]), type: faker.string.alpha(20), internalType: faker.helpers.arrayElement([faker.string.alpha(20), undefined]), components: faker.helpers.arrayElement([[], undefined]), })), outputs: Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() => ({ name: faker.helpers.arrayElement([faker.string.alpha(20), undefined]), type: faker.string.alpha(20), internalType: faker.helpers.arrayElement([faker.string.alpha(20), undefined]), components: faker.helpers.arrayElement([[], undefined]), })), constant: faker.helpers.arrayElement([faker.datatype.boolean(), undefined]), payable: faker.helpers.arrayElement([faker.datatype.boolean(), undefined]), stateMutability: faker.helpers.arrayElement(Object.values(AbiStateMutability)), gas: faker.helpers.arrayElement([ faker.number.int({ min: undefined, max: undefined }), undefined, ]), }, ...overrideResponse, }); export const getGetPolicyByIdResponseAbiInputMock = (overrideResponse = {}) => ({ ...{ type: faker.helpers.arrayElement([ "constructor", "error", "event", "fallback", "receive", ]), additionalProperties: faker.helpers.arrayElement([{}, undefined]), }, ...overrideResponse, }); export const getGetPolicyByIdResponseEvmDataParameterConditionMock = (overrideResponse = {}) => ({ ...{ name: faker.string.alpha(20), operator: faker.helpers.arrayElement([">", ">=", "<", "<=", "=="]), value: faker.string.alpha(20), }, ...overrideResponse, }); export const getGetPolicyByIdResponseEvmDataParameterConditionListMock = (overrideResponse = {}) => ({ ...{ name: faker.string.alpha(20), operator: faker.helpers.arrayElement(["in", "not in"]), values: Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() => faker.string.alpha(20)), }, ...overrideResponse, }); export const getGetPolicyByIdResponseEvmDataCriterionMock = (overrideResponse = {}) => ({ ...{ type: faker.helpers.arrayElement(["evmData"]), abi: faker.helpers.arrayElement([ faker.helpers.arrayElement(Object.values(KnownAbiType)), Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() => faker.helpers.arrayElement([ { ...getGetPolicyByIdResponseAbiFunctionMock() }, { ...getGetPolicyByIdResponseAbiInputMock() }, ])), ]), conditions: Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() => ({ function: faker.string.alpha(20), params: faker.helpers.arrayElement([ Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() => faker.helpers.arrayElement([ { ...getGetPolicyByIdResponseEvmDataParameterConditionMock() }, { ...getGetPolicyByIdResponseEvmDataParameterConditionListMock() }, ])), undefined, ]), })), }, ...overrideResponse, }); export const getGetPolicyByIdResponseNetUSDChangeCriterionMock = (overrideResponse = {}) => ({ ...{ type: faker.helpers.arrayElement(["netUSDChange"]), changeCents: faker.number.int({ min: undefined, max: undefined }), operator: faker.helpers.arrayElement([">", ">=", "<", "<=", "=="]), }, ...overrideResponse, }); export const getGetPolicyByIdResponseEvmNetworkCriterionMock = (overrideResponse = {}) => ({ ...{ type: faker.helpers.arrayElement(["evmNetwork"]), networks: faker.helpers.arrayElements([ "base-sepolia", "base", "ethereum", "ethereum-sepolia", "avalanche", "polygon", "optimism", "arbitrum", "zora", "bnb", ]), operator: faker.helpers.arrayElement(["in", "not in"]), }, ...overrideResponse, }); export const getGetPolicyByIdResponseEvmMessageCriterionMock = (overrideResponse = {}) => ({ ...{ type: faker.helpers.arrayElement(["evmMessage"]), match: faker.string.alpha(20) }, ...overrideResponse, }); export const getGetPolicyByIdResponseEvmTypedAddressConditionMock = (overrideResponse = {}) => ({ ...{ addresses: Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() => faker.helpers.fromRegExp("^0x[0-9a-fA-F]{40}$")), operator: faker.helpers.arrayElement(["in", "not in"]), path: faker.string.alpha(20), }, ...overrideResponse, }); export const getGetPolicyByIdResponseEvmTypedNumericalConditionMock = (overrideResponse = {}) => ({ ...{ value: faker.helpers.fromRegExp("^[0-9]+$"), operator: faker.helpers.arrayElement([">", ">=", "<", "<=", "=="]), path: faker.string.alpha(20), }, ...overrideResponse, }); export const getGetPolicyByIdResponseEvmTypedStringConditionMock = (overrideResponse = {}) => ({ ...{ match: faker.string.alpha(20), path: faker.string.alpha(20) }, ...overrideResponse, }); export const getGetPolicyByIdResponseSignEvmTypedDataFieldCriterionMock = (overrideResponse = {}) => ({ ...{ type: faker.helpers.arrayElement(["evmTypedDataField"]), types: { types: { [faker.string.alphanumeric(5)]: Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() => ({ name: faker.helpers.arrayElement([faker.string.alpha(20), undefined]), type: faker.helpers.arrayElement([faker.string.alpha(20), undefined]), })), }, primaryType: faker.string.alpha(20), }, conditions: Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() => faker.helpers.arrayElement([ { ...getGetPolicyByIdResponseEvmTypedAddressConditionMock() }, { ...getGetPolicyByIdResponseEvmTypedNumericalConditionMock() }, { ...getGetPolicyByIdResponseEvmTypedStringConditionMock() }, ])), }, ...overrideResponse, }); export const getGetPolicyByIdResponseSignEvmTypedDataVerifyingContractCriterionMock = (overrideResponse = {}) => ({ ...{ type: faker.helpers.arrayElement(["evmTypedDataVerifyingContract"]), addresses: Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() => faker.helpers.fromRegExp("^0x[0-9a-fA-F]{40}$")), operator: faker.helpers.arrayElement(["in", "not in"]), }, ...overrideResponse, }); export const getGetPolicyByIdResponseSolAddressCriterionMock = (overrideResponse = {}) => ({ ...{ type: faker.helpers.arrayElement(["solAddress"]), addresses: Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() => faker.helpers.fromRegExp("^[1-9A-HJ-NP-Za-km-z]{32,44}$")), operator: faker.helpers.arrayElement(["in", "not in"]), }, ...overrideResponse, }); export const getGetPolicyByIdResponseSolValueCriterionMock = (overrideResponse = {}) => ({ ...{ type: faker.helpers.arrayElement(["solValue"]), solValue: faker.string.alpha(20), operator: faker.helpers.arrayElement([">", ">=", "<", "<=", "=="]), }, ...overrideResponse, }); export const getGetPolicyByIdResponseSplAddressCriterionMock = (overrideResponse = {}) => ({ ...{ type: faker.helpers.arrayElement(["splAddress"]), addresses: Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() => faker.helpers.fromRegExp("^[1-9A-HJ-NP-Za-km-z]{32,44}$")), operator: faker.helpers.arrayElement(["in", "not in"]), }, ...overrideResponse, }); export const getGetPolicyByIdResponseSplValueCriterionMock = (overrideResponse = {}) => ({ ...{ type: faker.helpers.arrayElement(["splValue"]), splValue: faker.string.alpha(20), operator: faker.helpers.arrayElement([">", ">=", "<", "<=", "=="]), }, ...overrideResponse, }); export const getGetPolicyByIdResponseMintAddressCriterionMock = (overrideResponse = {}) => ({ ...{ type: faker.helpers.arrayElement(["mintAddress"]), addresses: Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() => faker.helpers.fromRegExp("^[1-9A-HJ-NP-Za-km-z]{32,44}$")), operator: faker.helpers.arrayElement(["in", "not in"]), }, ...overrideResponse, }); export const getGetPolicyByIdResponseMock = (overrideResponse = {}) => ({ id: faker.helpers.fromRegExp("^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$"), description: faker.helpers.arrayElement([ faker.helpers.fromRegExp("^[A-Za-z0-9 ,.]{1,50}$"), undefined, ]), scope: faker.helpers.arrayElement(["project", "account"]), rules: Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() => faker.helpers.arrayElement([ { action: faker.helpers.arrayElement(["reject", "accept"]), operation: faker.helpers.arrayElement(["signEvmTransaction"]), criteria: Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() => faker.helpers.arrayElement([ { ...getGetPolicyByIdResponseEthValueCriterionMock() }, { ...getGetPolicyByIdResponseEvmAddressCriterionMock() }, { ...getGetPolicyByIdResponseEvmDataCriterionMock() }, { ...getGetPolicyByIdResponseNetUSDChangeCriterionMock() }, ])), }, { action: faker.helpers.arrayElement(["reject", "accept"]), operation: faker.helpers.arrayElement(["sendEvmTransaction"]), criteria: Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() => faker.helpers.arrayElement([ { ...getGetPolicyByIdResponseEthValueCriterionMock() }, { ...getGetPolicyByIdResponseEvmAddressCriterionMock() }, { ...getGetPolicyByIdResponseEvmNetworkCriterionMock() }, { ...getGetPolicyByIdResponseEvmDataCriterionMock() }, { ...getGetPolicyByIdResponseNetUSDChangeCriterionMock() }, ])), }, { action: faker.helpers.arrayElement(["reject", "accept"]), operation: faker.helpers.arrayElement(["signEvmMessage"]), criteria: Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() => faker.helpers.arrayElement([{ ...getGetPolicyByIdResponseEvmMessageCriterionMock() }])), }, { action: faker.helpers.arrayElement(["reject", "accept"]), operation: faker.helpers.arrayElement(["signEvmTypedData"]), criteria: Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() => faker.helpers.arrayElement([ { ...getGetPolicyByIdResponseSignEvmTypedDataFieldCriterionMock() }, { ...getGetPolicyByIdResponseSignEvmTypedDataVerifyingContractCriterionMock() }, ])), }, { action: faker.helpers.arrayElement(["reject", "accept"]), operation: faker.helpers.arrayElement(["signSolTransaction"]), criteria: Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() => faker.helpers.arrayElement([ { ...getGetPolicyByIdResponseSolAddressCriterionMock() }, { ...getGetPolicyByIdResponseSolValueCriterionMock() }, { ...getGetPolicyByIdResponseSplAddressCriterionMock() }, { ...getGetPolicyByIdResponseSplValueCriterionMock() }, { ...getGetPolicyByIdResponseMintAddressCriterionMock() }, ])), }, { action: faker.helpers.arrayElement(["reject", "accept"]), operation: faker.helpers.arrayElement(["sendSolTransaction"]), criteria: Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() => faker.helpers.arrayElement([ { ...getGetPolicyByIdResponseSolAddressCriterionMock() }, { ...getGetPolicyByIdResponseSolValueCriterionMock() }, { ...getGetPolicyByIdResponseSplAddressCriterionMock() }, { ...getGetPolicyByIdResponseSplValueCriterionMock() }, { ...getGetPolicyByIdResponseMintAddressCriterionMock() }, ])), }, { action: faker.helpers.arrayElement(["reject", "accept"]), operation: faker.helpers.arrayElement(["signEvmHash"]), }, { action: faker.helpers.arrayElement(["reject", "accept"]), operation: faker.helpers.arrayElement(["prepareUserOperation"]), criteria: Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() => faker.helpers.arrayElement([ { ...getGetPolicyByIdResponseEthValueCriterionMock() }, { ...getGetPolicyByIdResponseEvmAddressCriterionMock() }, { ...getGetPolicyByIdResponseEvmNetworkCriterionMock() }, { ...getGetPolicyByIdResponseEvmDataCriterionMock() }, ])), }, { action: faker.helpers.arrayElement(["reject", "accept"]), operation: faker.helpers.arrayElement(["sendUserOperation"]), criteria: Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() => faker.helpers.arrayElement([ { ...getGetPolicyByIdResponseEthValueCriterionMock() }, { ...getGetPolicyByIdResponseEvmAddressCriterionMock() }, { ...getGetPolicyByIdResponseEvmDataCriterionMock() }, ])), }, ])), createdAt: faker.string.alpha(20), updatedAt: faker.string.alpha(20), ...overrideResponse, }); export const getUpdatePolicyResponseEthValueCriterionMock = (overrideResponse = {}) => ({ ...{ type: faker.helpers.arrayElement(["ethValue"]), ethValue: faker.helpers.fromRegExp("^[0-9]+$"), operator: faker.helpers.arrayElement([">", ">=", "<", "<=", "=="]), }, ...overrideResponse, }); export const getUpdatePolicyResponseEvmAddressCriterionMock = (overrideResponse = {}) => ({ ...{ type: faker.helpers.arrayElement(["evmAddress"]), addresses: Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() => faker.helpers.fromRegExp("^0x[0-9a-fA-F]{40}$")), operator: faker.helpers.arrayElement(["in", "not in"]), }, ...overrideResponse, }); export const getUpdatePolicyResponseAbiFunctionMock = (overrideResponse = {}) => ({ ...{ type: faker.helpers.arrayElement(["function"]), name: faker.string.alpha(20), inputs: Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() => ({ name: faker.helpers.arrayElement([faker.string.alpha(20), undefined]), type: faker.string.alpha(20), internalType: faker.helpers.arrayElement([faker.string.alpha(20), undefined]), components: faker.helpers.arrayElement([[], undefined]), })), outputs: Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() => ({ name: faker.helpers.arrayElement([faker.string.alpha(20), undefined]), type: faker.string.alpha(20), internalType: faker.helpers.arrayElement([faker.string.alpha(20), undefined]), components: faker.helpers.arrayElement([[], undefined]), })), constant: faker.helpers.arrayElement([faker.datatype.boolean(), undefined]), payable: faker.helpers.arrayElement([faker.datatype.boolean(), undefined]), stateMutability: faker.helpers.arrayElement(Object.values(AbiStateMutability)), gas: faker.helpers.arrayElement([ faker.number.int({ min: undefined, max: undefined }), undefined, ]), }, ...overrideResponse, }); export const getUpdatePolicyResponseAbiInputMock = (overrideResponse = {}) => ({ ...{ type: faker.helpers.arrayElement([ "constructor", "error", "event", "fallback", "receive", ]), additionalProperties: faker.helpers.arrayElement([{}, undefined]), }, ...overrideResponse, }); export const getUpdatePolicyResponseEvmDataParameterConditionMock = (overrideResponse = {}) => ({ ...{ name: faker.string.alpha(20), operator: f