Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into matthew/boost-4257-up…
Browse files Browse the repository at this point in the history
…date-zora-to-use-referral-param
  • Loading branch information
mmackz committed Jul 16, 2024
2 parents 2d568ea + 8e8428a commit ba2329a
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 6 deletions.
5 changes: 5 additions & 0 deletions .changeset/silent-fireants-grab.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rabbitholegg/questdk-plugin-utils": minor
---

allow referral to be optional in MintIntentParams
5 changes: 5 additions & 0 deletions .changeset/two-comics-explain.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rabbitholegg/questdk-plugin-soundxyz": minor
---

use referral param in validation and mint simulation
9 changes: 8 additions & 1 deletion packages/soundxyz/src/Soundxyz.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,12 @@ import {
mint,
simulateMint,
} from './Soundxyz'
import { SUPERMINTER, SUPERMINTER_V2, SUPERMINTER_V2_ABI } from './constants'
import {
SUPERMINTER,
SUPERMINTER_V2,
SUPERMINTER_V2_ABI,
ZORA_DEPLOYER_ADDRESS,
} from './constants'
import {
OP_SUPERMINTER_V2,
failingTestCases,
Expand Down Expand Up @@ -175,6 +180,7 @@ describe('simulateMint function', () => {
contractAddress: '0xdf71F2F15bCcDC7c7A89F01dd45cDE5A43F7e79f',
amount: BigInt(1),
recipient: '0xf70da97812CB96acDF810712Aa562db8dfA3dbEF',
referral: ZORA_DEPLOYER_ADDRESS,
}
const value = parseEther('0.000777')
const account = '0xf70da97812CB96acDF810712Aa562db8dfA3dbEF'
Expand All @@ -191,6 +197,7 @@ describe('simulateMint function', () => {
contractAddress: '0x0c418874315698096ecA7ce0e1Dccf0A517DC9DE',
amount: BigInt(1),
recipient: '0xf70da97812CB96acDF810712Aa562db8dfA3dbEF',
referral: ZORA_DEPLOYER_ADDRESS,
}
const value = parseEther('0.000777')
const account = '0xf70da97812CB96acDF810712Aa562db8dfA3dbEF'
Expand Down
9 changes: 5 additions & 4 deletions packages/soundxyz/src/Soundxyz.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ import {
export const mint = async (
mint: MintActionParams,
): Promise<TransactionFilter> => {
const { chainId, contractAddress, amount, recipient, tokenId } = mint
const { chainId, contractAddress, amount, recipient, tokenId, referral } =
mint

return compressJson({
chainId,
Expand All @@ -53,6 +54,7 @@ export const mint = async (
quantity: formatAmount(amount),
tier: tokenId,
to: recipient, // Can be given as gift, so recipient will not always match sender
affiliate: referral,
},
},
})
Expand Down Expand Up @@ -102,9 +104,8 @@ export const simulateMint = async (
value: bigint,
account?: Address,
client?: PublicClient,
creatorAddress?: Address,
): Promise<SimulateContractReturnType> => {
const { contractAddress, recipient, tokenId, amount } = mint
const { contractAddress, recipient, tokenId, amount, referral } = mint
const _client = (client ??
createPublicClient({
chain: chainIdToViemChain(mint.chainId),
Expand Down Expand Up @@ -132,7 +133,7 @@ export const simulateMint = async (
signedClaimTicket: 0,
signedDeadline: 0,
signature: zeroHash,
affiliate: creatorAddress ?? ZORA_DEPLOYER_ADDRESS,
affiliate: referral ?? ZORA_DEPLOYER_ADDRESS,
affiliateProof: [zeroHash],
attributionId: 0,
}
Expand Down
4 changes: 3 additions & 1 deletion packages/utils/src/types/intents.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import type { MintActionParams } from './actions'
import type { Address } from 'viem'
export type MintIntentParams = Required<
Omit<MintActionParams, 'amount' | 'tokenId'>
Omit<MintActionParams, 'amount' | 'tokenId' | 'referral'>
> & {
amount: bigint
tokenId?: number
referral?: Address
}
export type IntentParams = MintIntentParams

0 comments on commit ba2329a

Please sign in to comment.