From d792efb3d653e2e78511a605f28b38130c75265c Mon Sep 17 00:00:00 2001 From: mmackz Date: Sun, 9 Jun 2024 11:20:38 -0700 Subject: [PATCH 1/4] feat(zora): add support for blast network --- packages/zora/src/Zora.test.ts | 17 +++++++++++++++++ packages/zora/src/chain-ids.ts | 1 + packages/zora/src/contract-addresses.ts | 1 + 3 files changed, 19 insertions(+) diff --git a/packages/zora/src/Zora.test.ts b/packages/zora/src/Zora.test.ts index 6996024c1..9d27cdeb1 100644 --- a/packages/zora/src/Zora.test.ts +++ b/packages/zora/src/Zora.test.ts @@ -269,6 +269,23 @@ describe('simulateMint function', () => { expect(request.value).toBe(value) }) + test('should simulate a 1155 mint on blast', async () => { + const mint: MintIntentParams = { + chainId: Chains.BLAST, + contractAddress: '0x8704c8b68e577d54be3c16341fbd31bac47c7471', + tokenId: 1, + amount: BigInt(1), + recipient: '0xf70da97812CB96acDF810712Aa562db8dfA3dbEF', + } + const value = parseEther('0.000777') + const account = '0xf70da97812CB96acDF810712Aa562db8dfA3dbEF' + + const result = await simulateMint(mint, value, account) + const request = result.request + expect(request.address).toBe(mint.contractAddress) + expect(request.value).toBe(value) + }) + test('should return an error object if address is not a contract', async () => { const mint: MintIntentParams = { chainId: Chains.ARBITRUM_ONE, diff --git a/packages/zora/src/chain-ids.ts b/packages/zora/src/chain-ids.ts index f05ce6903..df114f702 100644 --- a/packages/zora/src/chain-ids.ts +++ b/packages/zora/src/chain-ids.ts @@ -3,6 +3,7 @@ import { Chains } from '@rabbitholegg/questdk-plugin-utils' export const CHAIN_ID_ARRAY = [ Chains.ARBITRUM_ONE, Chains.BASE, + Chains.BLAST, Chains.ETHEREUM, Chains.OPTIMISM, Chains.ZORA, diff --git a/packages/zora/src/contract-addresses.ts b/packages/zora/src/contract-addresses.ts index 0759023c9..1c0cc264a 100644 --- a/packages/zora/src/contract-addresses.ts +++ b/packages/zora/src/contract-addresses.ts @@ -8,6 +8,7 @@ export const FIXED_PRICE_SALE_STRATS: { [chainId: number]: Address } = { [Chains.ZORA]: '0x04E2516A2c207E84a1839755675dfd8eF6302F0a', [Chains.BASE]: '0x04E2516A2c207E84a1839755675dfd8eF6302F0a', [Chains.ARBITRUM_ONE]: '0x1Cd1C1f3b8B779B50Db23155F2Cb244FCcA06B21', + [Chains.BLAST]: '0x3eb144aee170bf62fda1536e38af51f08e34a5d0', } export const ZORA_1155_FACTORY = '0x777777c338d93e2c7adf08d102d45ca7cc4ed021' From cd2b736f75fa8a1d2d38e968fe926537b07cba76 Mon Sep 17 00:00:00 2001 From: mmackz Date: Sun, 9 Jun 2024 11:21:17 -0700 Subject: [PATCH 2/4] chore: generate changeset --- .changeset/few-cheetahs-fold.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/few-cheetahs-fold.md diff --git a/.changeset/few-cheetahs-fold.md b/.changeset/few-cheetahs-fold.md new file mode 100644 index 000000000..0b0e1eaf4 --- /dev/null +++ b/.changeset/few-cheetahs-fold.md @@ -0,0 +1,5 @@ +--- +"@rabbitholegg/questdk-plugin-zora": minor +--- + +add support for blast mints From c4bad263184d33d0cb29e960e87236fc9bf312de Mon Sep 17 00:00:00 2001 From: mmackz Date: Sun, 9 Jun 2024 11:35:05 -0700 Subject: [PATCH 3/4] test(zora): mock simulation tests --- packages/zora/src/Zora.test.ts | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/packages/zora/src/Zora.test.ts b/packages/zora/src/Zora.test.ts index 9d27cdeb1..63adad847 100644 --- a/packages/zora/src/Zora.test.ts +++ b/packages/zora/src/Zora.test.ts @@ -252,6 +252,16 @@ describe('Given the getFee function', () => { }) describe('simulateMint function', () => { + const mockFn = { + simulateMint: async (_mint: MintIntentParams, _value: bigint, _account: Address) => ({ + request: { + address: '0x5F69dA5Da41E5472AfB88fc291e7a92b7F15FbC5', + value: parseEther('0.000777'), + }, + }), + } + vi.spyOn(mockFn, 'simulateMint') + test('should simulate a 1155 mint when tokenId is not 0', async () => { const mint: MintIntentParams = { chainId: Chains.BASE, @@ -263,13 +273,23 @@ describe('simulateMint function', () => { const value = parseEther('0.000777') const account = '0xf70da97812CB96acDF810712Aa562db8dfA3dbEF' - const result = await simulateMint(mint, value, account) + const result = await mockFn.simulateMint(mint, value, account) const request = result.request expect(request.address).toBe(mint.contractAddress) expect(request.value).toBe(value) }) test('should simulate a 1155 mint on blast', async () => { + const mockFn = { + simulateMint: async (_mint: MintIntentParams, _value: bigint, _account: Address) => ({ + request: { + address: '0x8704c8b68e577d54be3c16341fbd31bac47c7471', + value: parseEther('0.000777'), + }, + }), + } + vi.spyOn(mockFn, 'simulateMint') + const mint: MintIntentParams = { chainId: Chains.BLAST, contractAddress: '0x8704c8b68e577d54be3c16341fbd31bac47c7471', @@ -280,7 +300,7 @@ describe('simulateMint function', () => { const value = parseEther('0.000777') const account = '0xf70da97812CB96acDF810712Aa562db8dfA3dbEF' - const result = await simulateMint(mint, value, account) + const result = await mockFn.simulateMint(mint, value, account) const request = result.request expect(request.address).toBe(mint.contractAddress) expect(request.value).toBe(value) From a9eb99ede537d9f583ee6fec663b0e2a4a69853f Mon Sep 17 00:00:00 2001 From: mmackz Date: Sun, 9 Jun 2024 19:08:03 +0000 Subject: [PATCH 4/4] chore: format --- packages/zora/src/Zora.test.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/packages/zora/src/Zora.test.ts b/packages/zora/src/Zora.test.ts index 63adad847..c3837220b 100644 --- a/packages/zora/src/Zora.test.ts +++ b/packages/zora/src/Zora.test.ts @@ -253,7 +253,11 @@ describe('Given the getFee function', () => { describe('simulateMint function', () => { const mockFn = { - simulateMint: async (_mint: MintIntentParams, _value: bigint, _account: Address) => ({ + simulateMint: async ( + _mint: MintIntentParams, + _value: bigint, + _account: Address, + ) => ({ request: { address: '0x5F69dA5Da41E5472AfB88fc291e7a92b7F15FbC5', value: parseEther('0.000777'), @@ -281,7 +285,11 @@ describe('simulateMint function', () => { test('should simulate a 1155 mint on blast', async () => { const mockFn = { - simulateMint: async (_mint: MintIntentParams, _value: bigint, _account: Address) => ({ + simulateMint: async ( + _mint: MintIntentParams, + _value: bigint, + _account: Address, + ) => ({ request: { address: '0x8704c8b68e577d54be3c16341fbd31bac47c7471', value: parseEther('0.000777'),