diff --git a/.changeset/shiny-toes-nail.md b/.changeset/shiny-toes-nail.md new file mode 100644 index 000000000..83ff7cc90 --- /dev/null +++ b/.changeset/shiny-toes-nail.md @@ -0,0 +1,5 @@ +--- +"@rabbitholegg/questdk-plugin-zora": minor +--- + +add arbitrum support diff --git a/packages/zora/package.json b/packages/zora/package.json index 319eab61a..5efb83fa5 100644 --- a/packages/zora/package.json +++ b/packages/zora/package.json @@ -36,6 +36,7 @@ "tsconfig": "workspace:*" }, "dependencies": { - "@zoralabs/universal-minter": "0.2.12" + "@zoralabs/universal-minter": "0.2.12", + "@rabbitholegg/questdk-plugin-utils": "workspace:*" } } diff --git a/packages/zora/src/Zora.ts b/packages/zora/src/Zora.ts index dc64667ea..3b6942243 100644 --- a/packages/zora/src/Zora.ts +++ b/packages/zora/src/Zora.ts @@ -11,14 +11,16 @@ import { ZORA_MINTER_ABI_1155, ZORA_MINTER_ABI_721, } from './abi' -import type { Chains } from './utils' export const mint = async ( mint: MintActionParams, ): Promise => { const { chainId, contractAddress, tokenId, amount, recipient } = mint - const universalMinter = zoraUniversalMinterAddress[chainId as Chains] + const universalMinter = + zoraUniversalMinterAddress[ + chainId as keyof typeof zoraUniversalMinterAddress + ] const mintContract = universalMinter ? { $or: [contractAddress.toLowerCase(), universalMinter.toLowerCase()] } diff --git a/packages/zora/src/chain-ids.ts b/packages/zora/src/chain-ids.ts index 3145bfc20..f05ce6903 100644 --- a/packages/zora/src/chain-ids.ts +++ b/packages/zora/src/chain-ids.ts @@ -1,6 +1,7 @@ -import { Chains } from './utils' +import { Chains } from '@rabbitholegg/questdk-plugin-utils' export const CHAIN_ID_ARRAY = [ + Chains.ARBITRUM_ONE, Chains.BASE, Chains.ETHEREUM, Chains.OPTIMISM, diff --git a/packages/zora/src/test-setup.ts b/packages/zora/src/test-setup.ts index 8217f92b7..0f4b9d9f2 100644 --- a/packages/zora/src/test-setup.ts +++ b/packages/zora/src/test-setup.ts @@ -1,5 +1,5 @@ import { getAddress } from 'viem' -import { createTestCase } from './utils' +import { createTestCase } from '@rabbitholegg/questdk-plugin-utils' import { BASIC_PURCHASE, MINT_WITH_REWARDS, diff --git a/packages/zora/src/test-transactions.ts b/packages/zora/src/test-transactions.ts index 6b83eea19..0ae9c0cc8 100644 --- a/packages/zora/src/test-transactions.ts +++ b/packages/zora/src/test-transactions.ts @@ -1,6 +1,5 @@ import { type MintActionParams } from '@rabbitholegg/questdk' -import { type TestParams } from './utils' -import { Chains } from './utils' +import { type TestParams, Chains } from '@rabbitholegg/questdk-plugin-utils' export const BASIC_PURCHASE: TestParams = { transaction: { diff --git a/packages/zora/src/utils.ts b/packages/zora/src/utils.ts deleted file mode 100644 index 4532d4401..000000000 --- a/packages/zora/src/utils.ts +++ /dev/null @@ -1,54 +0,0 @@ -import type { Address, Hash } from 'viem' -import type { ActionParams } from '@rabbitholegg/questdk' - -export enum Chains { - ETHEREUM = 1, - OPTIMISM = 10, - BASE = 8453, - ZORA = 7777777, -} - -interface Transaction { - chainId: number - from: Address - hash?: Hash - input: string - to: Address - value: string -} - -export interface TestCase { - transaction: Transaction - params: T - description: string -} - -export type TestParams = { - transaction: Transaction - params: T -} - -/** - * Creates a test case object for a given action and transaction. - * - * This function takes a `TestParams` object that includes both a `Transaction` and - * `ActionParams`, a description of the test case, and an optional set of overrides - * for the action parameters. It returns a `TestCase` object that contains the transaction, - * the combined action parameters with any overrides applied, and the description. - * - * @param {TestParams} testParams - An object containing the transaction and action parameters. - * @param {string} description - A brief description of the test case. - * @param {Partial} [overrides] - Optional overrides for the action parameters. - * @returns {TestCase} A test case object with the transaction, params, and description. - */ -export function createTestCase( - testParams: TestParams, - description: string, - overrides: Partial = {}, -): TestCase { - return { - transaction: testParams.transaction, - params: { ...testParams.params, ...overrides }, - description, - } -} diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 37a3026fe..d5420d885 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -531,6 +531,9 @@ importers: packages/zora: dependencies: + '@rabbitholegg/questdk-plugin-utils': + specifier: workspace:* + version: link:../utils '@zoralabs/universal-minter': specifier: 0.2.12 version: 0.2.12(@types/node@20.4.5)(ts-node@10.9.1)(typescript@5.3.3)