Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified .amman/genesis.so
Binary file not shown.
2 changes: 1 addition & 1 deletion .github/workflows/onRelease.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: latest
node-version: 24
registry-url: https://registry.npmjs.org
- name: Install npm >= 11.5.1
run: npm install -g "npm@>=11.5.1"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
strategy:
matrix:
os: ['ubuntu-latest']
node_version: [lts/-1, lts/*, latest]
node_version: [lts/-1, lts/*, 24]
fail-fast: false
runs-on: ${{ matrix.os }}
steps:
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"@ledgerhq/hw-transport": "^6.31.4",
"@ledgerhq/hw-transport-node-hid-singleton": "^6.31.5",
"@metaplex-foundation/digital-asset-standard-api": "^2.0.0",
"@metaplex-foundation/genesis": "^0.18.0",
"@metaplex-foundation/genesis": "^0.20.5",
"@metaplex-foundation/mpl-bubblegum": "^5.0.2",
"@metaplex-foundation/mpl-core": "^1.4.0",
"@metaplex-foundation/mpl-core-candy-machine": "^0.3.0",
Expand Down
10 changes: 5 additions & 5 deletions pnpm-lock.yaml

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

61 changes: 52 additions & 9 deletions src/commands/genesis/bucket/add-launch-pool.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import {
addLaunchPoolBucketV2,
setLaunchPoolBucketV2Behaviors,
safeFetchGenesisAccountV2,
findLaunchPoolBucketV2Pda,
createClaimSchedule,
} from '@metaplex-foundation/genesis'
import { publicKey, some, none } from '@metaplex-foundation/umi'
import { Args, Flags } from '@oclif/core'
Expand Down Expand Up @@ -196,14 +198,13 @@ Use Unix timestamps for absolute times.`
// Parse optional ClaimSchedule
const parseClaimSchedule = (json: string) => {
const parsed = JSON.parse(json)
return {
return createClaimSchedule({
startTime: BigInt(parsed.startTime),
endTime: BigInt(parsed.endTime),
period: BigInt(parsed.period),
cliffTime: BigInt(parsed.cliffTime),
cliffAmountBps: Number(parsed.cliffAmountBps),
reserved: new Array(7).fill(0),
}
})
}

// Parse optional Allowlist
Expand All @@ -219,7 +220,7 @@ Use Unix timestamps for absolute times.`
}
}

// Build the add bucket transaction
// Build the add bucket transaction (without endBehaviors to stay within tx size limit)
spinner.text = 'Adding launch pool bucket...'
const transaction = addLaunchPoolBucketV2(this.context.umi, {
genesisAccount: genesisAddress,
Expand Down Expand Up @@ -258,18 +259,48 @@ Use Unix timestamps for absolute times.`
minimumQuoteTokenThreshold: flags.minimumQuoteTokenThreshold
? some({ amount: BigInt(flags.minimumQuoteTokenThreshold) })
: none(),
endBehaviors,
endBehaviors: [],
})

const result = await umiSendAndConfirmTransaction(this.context.umi, transaction)

// Get the bucket PDA
// Compute bucket PDA once for reuse
const [bucketPda] = findLaunchPoolBucketV2Pda(this.context.umi, {
genesisAccount: genesisAddress,
bucketIndex,
})

spinner.succeed('Launch pool bucket added successfully!')
const result = await umiSendAndConfirmTransaction(this.context.umi, transaction)

// Set end behaviors in a separate transaction if provided
let behaviorsSignature: string | undefined
let behaviorsError: unknown
if (endBehaviors.length > 0) {
try {
spinner.text = 'Setting end behaviors...'
const setBehaviorsTx = setLaunchPoolBucketV2Behaviors(this.context.umi, {
genesisAccount: genesisAddress,
bucket: bucketPda,
authority: this.context.signer,
payer: this.context.payer,
padding: new Array(3).fill(0),
endBehaviors,
})

const behaviorsResult = await umiSendAndConfirmTransaction(this.context.umi, setBehaviorsTx)
behaviorsSignature = txSignatureToString(behaviorsResult.transaction.signature as Uint8Array)
} catch (error) {
behaviorsError = error
}
}

if (behaviorsError) {
spinner.warn('Bucket created but failed to set end behaviors')
this.warn(
`End behaviors were not set. Run setLaunchPoolBucketV2Behaviors manually for bucket ${bucketPda}.\n` +
`Error: ${behaviorsError instanceof Error ? behaviorsError.message : String(behaviorsError)}`
)
} else {
spinner.succeed('Launch pool bucket added successfully!')
}

this.log('')
this.logSuccess(`Launch Pool Bucket Added`)
Expand All @@ -296,6 +327,18 @@ Use Unix timestamps for absolute times.`
'transaction'
)
)
if (behaviorsSignature) {
this.log('')
this.log(`Behaviors Transaction: ${behaviorsSignature}`)
this.log(
generateExplorerUrl(
this.context.explorer,
this.context.chain,
behaviorsSignature,
'transaction'
)
)
}

} catch (error) {
spinner.fail('Failed to add launch pool bucket')
Expand Down
1 change: 1 addition & 0 deletions src/commands/genesis/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export default class Genesis extends Command {
this.log('')
this.log('Subcommand groups:')
this.log(' genesis bucket Manage buckets (add-launch-pool, add-presale, add-unlocked, fetch)')
this.log(' genesis launch Create and register launches via the Genesis API')
this.log(' genesis presale Presale deposit and claim commands')
this.log('')
this.log('Run "mplx genesis <command> --help" for more information about a command.')
Expand Down
Loading