Skip to content

Commit

Permalink
Merge pull request #228 from rabbitholegg/mmackz/zora/arb-batchmint
Browse files Browse the repository at this point in the history
fix(zora): add batchmint support
  • Loading branch information
mmackz authored Feb 22, 2024
2 parents 7fdd73b + 84c7958 commit 6cce2ec
Show file tree
Hide file tree
Showing 8 changed files with 62 additions and 38 deletions.
5 changes: 5 additions & 0 deletions .changeset/nice-apricots-bathe.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rabbitholegg/questdk-plugin-zora": patch
---

update universal minter package
2 changes: 1 addition & 1 deletion packages/zora/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"tsconfig": "workspace:*"
},
"dependencies": {
"@zoralabs/universal-minter": "0.2.12",
"@zoralabs/universal-minter": "0.2.15",
"@rabbitholegg/questdk-plugin-utils": "workspace:*",
"@rabbitholegg/questdk": "workspace:*"
}
Expand Down
12 changes: 6 additions & 6 deletions packages/zora/src/Zora.test.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { apply } from '@rabbitholegg/questdk/filter'
import { describe, expect, test } from 'vitest'
import { failingTestCases, passingTestCases } from './test-setup'
import { BASIC_PURCHASE } from './test-transactions'
import { mint } from './Zora'
import {
ZORA_MINTER_ABI_1155,
ZORA_MINTER_ABI_721,
UNIVERSAL_MINTER_ABI,
ZORA_MINTER_ABI_721,
ZORA_MINTER_ABI_1155,
} from './abi'
import { failingTestCases, passingTestCases } from './test-setup'
import { BASIC_PURCHASE } from './test-transactions'
import { apply } from '@rabbitholegg/questdk/filter'
import { describe, expect, test } from 'vitest'

describe('Given the zora plugin', () => {
describe('When handling the mint', () => {
Expand Down
14 changes: 7 additions & 7 deletions packages/zora/src/Zora.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import {
type TransactionFilter,
UNIVERSAL_MINTER_ABI,
ZORA_MINTER_ABI_721,
ZORA_MINTER_ABI_1155,
} from './abi'
import { CHAIN_ID_ARRAY } from './chain-ids'
import {
type MintActionParams,
type TransactionFilter,
compressJson,
} from '@rabbitholegg/questdk'
import { zoraUniversalMinterAddress } from '@zoralabs/universal-minter'
import { type Address, getAddress } from 'viem'
import { CHAIN_ID_ARRAY } from './chain-ids'
import {
UNIVERSAL_MINTER_ABI,
ZORA_MINTER_ABI_1155,
ZORA_MINTER_ABI_721,
} from './abi'

export const mint = async (
mint: MintActionParams,
Expand Down
2 changes: 1 addition & 1 deletion packages/zora/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import {
} from '@rabbitholegg/questdk'

import {
mint,
getSupportedChainIds,
getSupportedTokenAddresses,
mint,
} from './Zora.js'

export const Zora: IActionPlugin = {
Expand Down
8 changes: 5 additions & 3 deletions packages/zora/src/test-setup.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
import { getAddress } from 'viem'
import { createTestCase } from '@rabbitholegg/questdk-plugin-utils'
import {
BASIC_PURCHASE,
BATCH_MINT_ARB,
MINT_BATCH_WITHOUT_FEES,
MINT_WITH_REWARDS,
MINT_WITH_REWARDS_1155,
MINT_BATCH_WITHOUT_FEES,
} from './test-transactions'
import { createTestCase } from '@rabbitholegg/questdk-plugin-utils'
import { getAddress } from 'viem'

export const passingTestCases = [
createTestCase(BASIC_PURCHASE, 'when doing a basic purchase'),
createTestCase(MINT_WITH_REWARDS, 'Minting with rewards'),
createTestCase(MINT_WITH_REWARDS_1155, 'Minting with rewards 1155'),
createTestCase(MINT_BATCH_WITHOUT_FEES, 'When using the batch mint function'),
createTestCase(BATCH_MINT_ARB, 'when using batch mint function on arbitrum'),
createTestCase(MINT_WITH_REWARDS, 'when contractAddress is checksummed', {
contractAddress: getAddress(MINT_WITH_REWARDS.params.contractAddress),
}),
Expand Down
18 changes: 17 additions & 1 deletion packages/zora/src/test-transactions.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { type MintActionParams } from '@rabbitholegg/questdk'
import { type TestParams, Chains } from '@rabbitholegg/questdk-plugin-utils'
import { Chains, type TestParams } from '@rabbitholegg/questdk-plugin-utils'

export const BASIC_PURCHASE: TestParams<MintActionParams> = {
transaction: {
Expand Down Expand Up @@ -70,3 +70,19 @@ export const MINT_BATCH_WITHOUT_FEES: TestParams<MintActionParams> = {
tokenId: 2,
},
}

export const BATCH_MINT_ARB: TestParams<MintActionParams> = {
transaction: {
chainId: 42161, // Optimism
from: '0x1671b592610fb7427ed788b66fa3e9217ff41047',
hash: '0x4c0d898b6f3864332e3e47a3924cad33491b8df0a05590d13175823ee62ef07c',
input:
'0x7c1e2068000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000001e00000000000000000000000000000000000000000000000000000000000000fc0000000000000000000000000000000000000000000000000000000000000000b000000000000000000000000b850c9a71b925237a10dce831911b59849c883e4000000000000000000000000b850c9a71b925237a10dce831911b59849c883e4000000000000000000000000b850c9a71b925237a10dce831911b59849c883e4000000000000000000000000b850c9a71b925237a10dce831911b59849c883e4000000000000000000000000b850c9a71b925237a10dce831911b59849c883e4000000000000000000000000b850c9a71b925237a10dce831911b59849c883e4000000000000000000000000b850c9a71b925237a10dce831911b59849c883e4000000000000000000000000b850c9a71b925237a10dce831911b59849c883e4000000000000000000000000b850c9a71b925237a10dce831911b59849c883e4000000000000000000000000b850c9a71b925237a10dce831911b59849c883e4000000000000000000000000b850c9a71b925237a10dce831911b59849c883e4000000000000000000000000000000000000000000000000000000000000000b0000000000000000000000000000000000000000000000000000000000000160000000000000000000000000000000000000000000000000000000000000028000000000000000000000000000000000000000000000000000000000000003a000000000000000000000000000000000000000000000000000000000000004c000000000000000000000000000000000000000000000000000000000000005e00000000000000000000000000000000000000000000000000000000000000700000000000000000000000000000000000000000000000000000000000000082000000000000000000000000000000000000000000000000000000000000009400000000000000000000000000000000000000000000000000000000000000a600000000000000000000000000000000000000000000000000000000000000b800000000000000000000000000000000000000000000000000000000000000ca000000000000000000000000000000000000000000000000000000000000000e49dbb844d0000000000000000000000001cd1c1f3b8b779b50db23155f2cb244fcca06b210000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000006609dfa1cb75d74f4ff39c8a5057bd111fba5b220000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e49dbb844d0000000000000000000000001cd1c1f3b8b779b50db23155f2cb244fcca06b210000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000006609dfa1cb75d74f4ff39c8a5057bd111fba5b220000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e49dbb844d0000000000000000000000001cd1c1f3b8b779b50db23155f2cb244fcca06b210000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000006609dfa1cb75d74f4ff39c8a5057bd111fba5b220000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e49dbb844d0000000000000000000000001cd1c1f3b8b779b50db23155f2cb244fcca06b210000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000006609dfa1cb75d74f4ff39c8a5057bd111fba5b220000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e49dbb844d0000000000000000000000001cd1c1f3b8b779b50db23155f2cb244fcca06b210000000000000000000000000000000000000000000000000000000000000005000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000006609dfa1cb75d74f4ff39c8a5057bd111fba5b220000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e49dbb844d0000000000000000000000001cd1c1f3b8b779b50db23155f2cb244fcca06b210000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000006609dfa1cb75d74f4ff39c8a5057bd111fba5b220000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e49dbb844d0000000000000000000000001cd1c1f3b8b779b50db23155f2cb244fcca06b210000000000000000000000000000000000000000000000000000000000000007000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000006609dfa1cb75d74f4ff39c8a5057bd111fba5b220000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e49dbb844d0000000000000000000000001cd1c1f3b8b779b50db23155f2cb244fcca06b210000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000006609dfa1cb75d74f4ff39c8a5057bd111fba5b220000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e49dbb844d0000000000000000000000001cd1c1f3b8b779b50db23155f2cb244fcca06b210000000000000000000000000000000000000000000000000000000000000009000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000006609dfa1cb75d74f4ff39c8a5057bd111fba5b220000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e49dbb844d0000000000000000000000001cd1c1f3b8b779b50db23155f2cb244fcca06b21000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000006609dfa1cb75d74f4ff39c8a5057bd111fba5b220000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e49dbb844d0000000000000000000000001cd1c1f3b8b779b50db23155f2cb244fcca06b21000000000000000000000000000000000000000000000000000000000000000b000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000006609dfa1cb75d74f4ff39c8a5057bd111fba5b2200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000b0000000000000000000000000000000000000000000000000002c2ad68fd90000000000000000000000000000000000000000000000000000002c2ad68fd90000000000000000000000000000000000000000000000000000002c2ad68fd90000000000000000000000000000000000000000000000000000002c2ad68fd90000000000000000000000000000000000000000000000000000002c2ad68fd90000000000000000000000000000000000000000000000000000002c2ad68fd90000000000000000000000000000000000000000000000000000002c2ad68fd90000000000000000000000000000000000000000000000000000002c2ad68fd90000000000000000000000000000000000000000000000000000002c2ad68fd90000000000000000000000000000000000000000000000000000002c2ad68fd90000000000000000000000000000000000000000000000000000002c2ad68fd9000',
to: '0xc6899816663891d7493939d74d83cb7f2bbcbb16',
value: '1554000000000000',
},
params: {
chainId: Chains.ARBITRUM_ONE,
contractAddress: '0xb850c9a71b925237a10dce831911b59849c883e4',
},
}
39 changes: 20 additions & 19 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 6cce2ec

Please sign in to comment.