@metaplex-foundation/genesis 0.12.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +16 -0
- package/dist/src/allowlist.d.ts +18 -0
- package/dist/src/allowlist.js +50 -0
- package/dist/src/allowlist.js.map +1 -0
- package/dist/src/auction.d.ts +296 -0
- package/dist/src/auction.js +416 -0
- package/dist/src/auction.js.map +1 -0
- package/dist/src/bondingCurveHelpers.d.ts +46 -0
- package/dist/src/bondingCurveHelpers.js +245 -0
- package/dist/src/bondingCurveHelpers.js.map +1 -0
- package/dist/src/fees.d.ts +32 -0
- package/dist/src/fees.js +59 -0
- package/dist/src/fees.js.map +1 -0
- package/dist/src/generated/accounts/auctionAVLTreeV1.d.ts +29 -0
- package/dist/src/generated/accounts/auctionAVLTreeV1.js +77 -0
- package/dist/src/generated/accounts/auctionAVLTreeV1.js.map +1 -0
- package/dist/src/generated/accounts/auctionBidV1.d.ts +76 -0
- package/dist/src/generated/accounts/auctionBidV1.js +107 -0
- package/dist/src/generated/accounts/auctionBidV1.js.map +1 -0
- package/dist/src/generated/accounts/auctionBucketV1.d.ts +146 -0
- package/dist/src/generated/accounts/auctionBucketV1.js +154 -0
- package/dist/src/generated/accounts/auctionBucketV1.js.map +1 -0
- package/dist/src/generated/accounts/bondingCurveBucketV1.d.ts +48 -0
- package/dist/src/generated/accounts/bondingCurveBucketV1.js +97 -0
- package/dist/src/generated/accounts/bondingCurveBucketV1.js.map +1 -0
- package/dist/src/generated/accounts/distributionBucketV1.d.ts +77 -0
- package/dist/src/generated/accounts/distributionBucketV1.js +110 -0
- package/dist/src/generated/accounts/distributionBucketV1.js.map +1 -0
- package/dist/src/generated/accounts/genesisAccountV1.d.ts +59 -0
- package/dist/src/generated/accounts/genesisAccountV1.js +93 -0
- package/dist/src/generated/accounts/genesisAccountV1.js.map +1 -0
- package/dist/src/generated/accounts/index.d.ts +23 -0
- package/dist/src/generated/accounts/index.js +40 -0
- package/dist/src/generated/accounts/index.js.map +1 -0
- package/dist/src/generated/accounts/launchPoolBucketV1.d.ts +113 -0
- package/dist/src/generated/accounts/launchPoolBucketV1.js +134 -0
- package/dist/src/generated/accounts/launchPoolBucketV1.js.map +1 -0
- package/dist/src/generated/accounts/launchPoolDepositV1.d.ts +62 -0
- package/dist/src/generated/accounts/launchPoolDepositV1.js +100 -0
- package/dist/src/generated/accounts/launchPoolDepositV1.js.map +1 -0
- package/dist/src/generated/accounts/meteoraBucketV1.d.ts +74 -0
- package/dist/src/generated/accounts/meteoraBucketV1.js +106 -0
- package/dist/src/generated/accounts/meteoraBucketV1.js.map +1 -0
- package/dist/src/generated/accounts/presaleBucketV1.d.ts +134 -0
- package/dist/src/generated/accounts/presaleBucketV1.js +146 -0
- package/dist/src/generated/accounts/presaleBucketV1.js.map +1 -0
- package/dist/src/generated/accounts/presaleDepositV1.d.ts +59 -0
- package/dist/src/generated/accounts/presaleDepositV1.js +96 -0
- package/dist/src/generated/accounts/presaleDepositV1.js.map +1 -0
- package/dist/src/generated/accounts/pumpBucketV1.d.ts +74 -0
- package/dist/src/generated/accounts/pumpBucketV1.js +106 -0
- package/dist/src/generated/accounts/pumpBucketV1.js.map +1 -0
- package/dist/src/generated/accounts/streamflowBucketV1.d.ts +77 -0
- package/dist/src/generated/accounts/streamflowBucketV1.js +110 -0
- package/dist/src/generated/accounts/streamflowBucketV1.js.map +1 -0
- package/dist/src/generated/accounts/unlockedBucketV1.d.ts +80 -0
- package/dist/src/generated/accounts/unlockedBucketV1.js +110 -0
- package/dist/src/generated/accounts/unlockedBucketV1.js.map +1 -0
- package/dist/src/generated/accounts/vaultBucketV1.d.ts +92 -0
- package/dist/src/generated/accounts/vaultBucketV1.js +118 -0
- package/dist/src/generated/accounts/vaultBucketV1.js.map +1 -0
- package/dist/src/generated/accounts/vaultDepositV1.d.ts +59 -0
- package/dist/src/generated/accounts/vaultDepositV1.js +96 -0
- package/dist/src/generated/accounts/vaultDepositV1.js.map +1 -0
- package/dist/src/generated/errors/genesis.d.ts +816 -0
- package/dist/src/generated/errors/genesis.js +1497 -0
- package/dist/src/generated/errors/genesis.js.map +1 -0
- package/dist/src/generated/errors/index.d.ts +8 -0
- package/dist/src/generated/errors/index.js +25 -0
- package/dist/src/generated/errors/index.js.map +1 -0
- package/dist/src/generated/index.d.ts +13 -0
- package/dist/src/generated/index.js +30 -0
- package/dist/src/generated/index.js.map +1 -0
- package/dist/src/generated/instructions/addAuctionBucketV1.d.ts +72 -0
- package/dist/src/generated/instructions/addAuctionBucketV1.js +166 -0
- package/dist/src/generated/instructions/addAuctionBucketV1.js.map +1 -0
- package/dist/src/generated/instructions/addConstantProductBondingCurveBucketV1.d.ts +58 -0
- package/dist/src/generated/instructions/addConstantProductBondingCurveBucketV1.js +153 -0
- package/dist/src/generated/instructions/addConstantProductBondingCurveBucketV1.js.map +1 -0
- package/dist/src/generated/instructions/addDistributionBucketV1.d.ts +52 -0
- package/dist/src/generated/instructions/addDistributionBucketV1.js +147 -0
- package/dist/src/generated/instructions/addDistributionBucketV1.js.map +1 -0
- package/dist/src/generated/instructions/addLaunchPoolBucketV1.d.ts +63 -0
- package/dist/src/generated/instructions/addLaunchPoolBucketV1.js +154 -0
- package/dist/src/generated/instructions/addLaunchPoolBucketV1.js.map +1 -0
- package/dist/src/generated/instructions/addMeteoraBucketV1.d.ts +48 -0
- package/dist/src/generated/instructions/addMeteoraBucketV1.js +134 -0
- package/dist/src/generated/instructions/addMeteoraBucketV1.js.map +1 -0
- package/dist/src/generated/instructions/addPresaleBucketV1.d.ts +76 -0
- package/dist/src/generated/instructions/addPresaleBucketV1.js +171 -0
- package/dist/src/generated/instructions/addPresaleBucketV1.js.map +1 -0
- package/dist/src/generated/instructions/addPumpBucketV1.d.ts +46 -0
- package/dist/src/generated/instructions/addPumpBucketV1.js +133 -0
- package/dist/src/generated/instructions/addPumpBucketV1.js.map +1 -0
- package/dist/src/generated/instructions/addStreamflowBucketV1.d.ts +53 -0
- package/dist/src/generated/instructions/addStreamflowBucketV1.js +148 -0
- package/dist/src/generated/instructions/addStreamflowBucketV1.js.map +1 -0
- package/dist/src/generated/instructions/addUnlockedBucketV1.d.ts +54 -0
- package/dist/src/generated/instructions/addUnlockedBucketV1.js +148 -0
- package/dist/src/generated/instructions/addUnlockedBucketV1.js.map +1 -0
- package/dist/src/generated/instructions/addVaultBucketV1.d.ts +46 -0
- package/dist/src/generated/instructions/addVaultBucketV1.js +114 -0
- package/dist/src/generated/instructions/addVaultBucketV1.js.map +1 -0
- package/dist/src/generated/instructions/claimAuctionRefundV1.d.ts +38 -0
- package/dist/src/generated/instructions/claimAuctionRefundV1.js +92 -0
- package/dist/src/generated/instructions/claimAuctionRefundV1.js.map +1 -0
- package/dist/src/generated/instructions/claimAuctionTokensV1.d.ts +50 -0
- package/dist/src/generated/instructions/claimAuctionTokensV1.js +146 -0
- package/dist/src/generated/instructions/claimAuctionTokensV1.js.map +1 -0
- package/dist/src/generated/instructions/claimLaunchPoolV1.d.ts +50 -0
- package/dist/src/generated/instructions/claimLaunchPoolV1.js +159 -0
- package/dist/src/generated/instructions/claimLaunchPoolV1.js.map +1 -0
- package/dist/src/generated/instructions/claimPresaleV1.d.ts +50 -0
- package/dist/src/generated/instructions/claimPresaleV1.js +159 -0
- package/dist/src/generated/instructions/claimPresaleV1.js.map +1 -0
- package/dist/src/generated/instructions/claimUnlockedV1.d.ts +50 -0
- package/dist/src/generated/instructions/claimUnlockedV1.js +156 -0
- package/dist/src/generated/instructions/claimUnlockedV1.js.map +1 -0
- package/dist/src/generated/instructions/closeAuctionBidV1.d.ts +40 -0
- package/dist/src/generated/instructions/closeAuctionBidV1.js +101 -0
- package/dist/src/generated/instructions/closeAuctionBidV1.js.map +1 -0
- package/dist/src/generated/instructions/depositLaunchPoolV1.d.ts +52 -0
- package/dist/src/generated/instructions/depositLaunchPoolV1.js +144 -0
- package/dist/src/generated/instructions/depositLaunchPoolV1.js.map +1 -0
- package/dist/src/generated/instructions/depositPresaleV1.d.ts +53 -0
- package/dist/src/generated/instructions/depositPresaleV1.js +149 -0
- package/dist/src/generated/instructions/depositPresaleV1.js.map +1 -0
- package/dist/src/generated/instructions/depositVaultV1.d.ts +42 -0
- package/dist/src/generated/instructions/depositVaultV1.js +111 -0
- package/dist/src/generated/instructions/depositVaultV1.js.map +1 -0
- package/dist/src/generated/instructions/feeOverride.d.ts +38 -0
- package/dist/src/generated/instructions/feeOverride.js +86 -0
- package/dist/src/generated/instructions/feeOverride.js.map +1 -0
- package/dist/src/generated/instructions/finalizeV1.d.ts +37 -0
- package/dist/src/generated/instructions/finalizeV1.js +92 -0
- package/dist/src/generated/instructions/finalizeV1.js.map +1 -0
- package/dist/src/generated/instructions/fundDistributionV1.d.ts +54 -0
- package/dist/src/generated/instructions/fundDistributionV1.js +172 -0
- package/dist/src/generated/instructions/fundDistributionV1.js.map +1 -0
- package/dist/src/generated/instructions/fundOutflowsV1.d.ts +27 -0
- package/dist/src/generated/instructions/fundOutflowsV1.js +75 -0
- package/dist/src/generated/instructions/fundOutflowsV1.js.map +1 -0
- package/dist/src/generated/instructions/graduateToMeteoraV1.d.ts +92 -0
- package/dist/src/generated/instructions/graduateToMeteoraV1.js +244 -0
- package/dist/src/generated/instructions/graduateToMeteoraV1.js.map +1 -0
- package/dist/src/generated/instructions/graduateToPumpV1.d.ts +68 -0
- package/dist/src/generated/instructions/graduateToPumpV1.js +188 -0
- package/dist/src/generated/instructions/graduateToPumpV1.js.map +1 -0
- package/dist/src/generated/instructions/index.d.ts +45 -0
- package/dist/src/generated/instructions/index.js +62 -0
- package/dist/src/generated/instructions/index.js.map +1 -0
- package/dist/src/generated/instructions/initializeV1.d.ts +47 -0
- package/dist/src/generated/instructions/initializeV1.js +124 -0
- package/dist/src/generated/instructions/initializeV1.js.map +1 -0
- package/dist/src/generated/instructions/lockStreamflowV1.d.ts +70 -0
- package/dist/src/generated/instructions/lockStreamflowV1.js +210 -0
- package/dist/src/generated/instructions/lockStreamflowV1.js.map +1 -0
- package/dist/src/generated/instructions/placeAuctionBidV1.d.ts +56 -0
- package/dist/src/generated/instructions/placeAuctionBidV1.js +155 -0
- package/dist/src/generated/instructions/placeAuctionBidV1.js.map +1 -0
- package/dist/src/generated/instructions/refundVaultDepositV1.d.ts +33 -0
- package/dist/src/generated/instructions/refundVaultDepositV1.js +78 -0
- package/dist/src/generated/instructions/refundVaultDepositV1.js.map +1 -0
- package/dist/src/generated/instructions/setBondingCurvePausedStateV1.d.ts +31 -0
- package/dist/src/generated/instructions/setBondingCurvePausedStateV1.js +67 -0
- package/dist/src/generated/instructions/setBondingCurvePausedStateV1.js.map +1 -0
- package/dist/src/generated/instructions/storeInflowsV1.d.ts +35 -0
- package/dist/src/generated/instructions/storeInflowsV1.js +92 -0
- package/dist/src/generated/instructions/storeInflowsV1.js.map +1 -0
- package/dist/src/generated/instructions/swapBondingCurveV1.d.ts +55 -0
- package/dist/src/generated/instructions/swapBondingCurveV1.js +155 -0
- package/dist/src/generated/instructions/swapBondingCurveV1.js.map +1 -0
- package/dist/src/generated/instructions/swapVaultToBondingCurveV1.d.ts +61 -0
- package/dist/src/generated/instructions/swapVaultToBondingCurveV1.js +171 -0
- package/dist/src/generated/instructions/swapVaultToBondingCurveV1.js.map +1 -0
- package/dist/src/generated/instructions/updateLaunchPoolDepositV1.d.ts +48 -0
- package/dist/src/generated/instructions/updateLaunchPoolDepositV1.js +131 -0
- package/dist/src/generated/instructions/updateLaunchPoolDepositV1.js.map +1 -0
- package/dist/src/generated/instructions/updatePresaleDepositV1.d.ts +49 -0
- package/dist/src/generated/instructions/updatePresaleDepositV1.js +136 -0
- package/dist/src/generated/instructions/updatePresaleDepositV1.js.map +1 -0
- package/dist/src/generated/instructions/withdrawLaunchPoolV1.d.ts +46 -0
- package/dist/src/generated/instructions/withdrawLaunchPoolV1.js +126 -0
- package/dist/src/generated/instructions/withdrawLaunchPoolV1.js.map +1 -0
- package/dist/src/generated/instructions/withdrawPresaleV1.d.ts +44 -0
- package/dist/src/generated/instructions/withdrawPresaleV1.js +121 -0
- package/dist/src/generated/instructions/withdrawPresaleV1.js.map +1 -0
- package/dist/src/generated/instructions/withdrawVaultV1.d.ts +40 -0
- package/dist/src/generated/instructions/withdrawVaultV1.js +102 -0
- package/dist/src/generated/instructions/withdrawVaultV1.js.map +1 -0
- package/dist/src/generated/programs/genesis.d.ts +12 -0
- package/dist/src/generated/programs/genesis.js +37 -0
- package/dist/src/generated/programs/genesis.js.map +1 -0
- package/dist/src/generated/programs/index.d.ts +8 -0
- package/dist/src/generated/programs/index.js +25 -0
- package/dist/src/generated/programs/index.js.map +1 -0
- package/dist/src/generated/shared/index.d.ts +53 -0
- package/dist/src/generated/shared/index.js +71 -0
- package/dist/src/generated/shared/index.js.map +1 -0
- package/dist/src/generated/types/auctionAVLTreeV1AccountData.d.ts +22 -0
- package/dist/src/generated/types/auctionAVLTreeV1AccountData.js +22 -0
- package/dist/src/generated/types/auctionAVLTreeV1AccountData.js.map +1 -0
- package/dist/src/generated/types/auctionBucketState.d.ts +17 -0
- package/dist/src/generated/types/auctionBucketState.js +26 -0
- package/dist/src/generated/types/auctionBucketState.js.map +1 -0
- package/dist/src/generated/types/baseAllocator.d.ts +13 -0
- package/dist/src/generated/types/baseAllocator.js +18 -0
- package/dist/src/generated/types/baseAllocator.js.map +1 -0
- package/dist/src/generated/types/bondingCurveBucketState.d.ts +17 -0
- package/dist/src/generated/types/bondingCurveBucketState.js +26 -0
- package/dist/src/generated/types/bondingCurveBucketState.js.map +1 -0
- package/dist/src/generated/types/bondingCurveBucketV1AccountData.d.ts +57 -0
- package/dist/src/generated/types/bondingCurveBucketV1AccountData.js +39 -0
- package/dist/src/generated/types/bondingCurveBucketV1AccountData.js.map +1 -0
- package/dist/src/generated/types/bondingCurveType.d.ts +13 -0
- package/dist/src/generated/types/bondingCurveType.js +22 -0
- package/dist/src/generated/types/bondingCurveType.js.map +1 -0
- package/dist/src/generated/types/bucketEntry.d.ts +26 -0
- package/dist/src/generated/types/bucketEntry.js +24 -0
- package/dist/src/generated/types/bucketEntry.js.map +1 -0
- package/dist/src/generated/types/constantProductBondingCurveParameters.d.ts +17 -0
- package/dist/src/generated/types/constantProductBondingCurveParameters.js +19 -0
- package/dist/src/generated/types/constantProductBondingCurveParameters.js.map +1 -0
- package/dist/src/generated/types/createInstructionArgs.d.ts +46 -0
- package/dist/src/generated/types/createInstructionArgs.js +33 -0
- package/dist/src/generated/types/createInstructionArgs.js.map +1 -0
- package/dist/src/generated/types/createInstructionData.d.ts +13 -0
- package/dist/src/generated/types/createInstructionData.js +16 -0
- package/dist/src/generated/types/createInstructionData.js.map +1 -0
- package/dist/src/generated/types/createMetadataAccountV3InstructionArgs.d.ts +20 -0
- package/dist/src/generated/types/createMetadataAccountV3InstructionArgs.js +21 -0
- package/dist/src/generated/types/createMetadataAccountV3InstructionArgs.js.map +1 -0
- package/dist/src/generated/types/createMetadataAccountV3InstructionData.d.ts +13 -0
- package/dist/src/generated/types/createMetadataAccountV3InstructionData.js +16 -0
- package/dist/src/generated/types/createMetadataAccountV3InstructionData.js.map +1 -0
- package/dist/src/generated/types/createPoolInstructionArgs.d.ts +19 -0
- package/dist/src/generated/types/createPoolInstructionArgs.js +20 -0
- package/dist/src/generated/types/createPoolInstructionArgs.js.map +1 -0
- package/dist/src/generated/types/createPoolInstructionData.d.ts +13 -0
- package/dist/src/generated/types/createPoolInstructionData.js +16 -0
- package/dist/src/generated/types/createPoolInstructionData.js.map +1 -0
- package/dist/src/generated/types/dataV2.d.ts +19 -0
- package/dist/src/generated/types/dataV2.js +24 -0
- package/dist/src/generated/types/dataV2.js.map +1 -0
- package/dist/src/generated/types/distributionBucketState.d.ts +16 -0
- package/dist/src/generated/types/distributionBucketState.js +25 -0
- package/dist/src/generated/types/distributionBucketState.js.map +1 -0
- package/dist/src/generated/types/feeDiscriminants.d.ts +14 -0
- package/dist/src/generated/types/feeDiscriminants.js +23 -0
- package/dist/src/generated/types/feeDiscriminants.js.map +1 -0
- package/dist/src/generated/types/feeOverrideType.d.ts +16 -0
- package/dist/src/generated/types/feeOverrideType.js +25 -0
- package/dist/src/generated/types/feeOverrideType.js.map +1 -0
- package/dist/src/generated/types/index.d.ts +38 -0
- package/dist/src/generated/types/index.js +55 -0
- package/dist/src/generated/types/index.js.map +1 -0
- package/dist/src/generated/types/initializePermissionlessConstantProductPoolWithConfigInstructionArgs.d.ts +17 -0
- package/dist/src/generated/types/initializePermissionlessConstantProductPoolWithConfigInstructionArgs.js +21 -0
- package/dist/src/generated/types/initializePermissionlessConstantProductPoolWithConfigInstructionArgs.js.map +1 -0
- package/dist/src/generated/types/initializePermissionlessConstantProductPoolWithConfigInstructionData.d.ts +13 -0
- package/dist/src/generated/types/initializePermissionlessConstantProductPoolWithConfigInstructionData.js +18 -0
- package/dist/src/generated/types/initializePermissionlessConstantProductPoolWithConfigInstructionData.js.map +1 -0
- package/dist/src/generated/types/initializeVault.d.ts +13 -0
- package/dist/src/generated/types/initializeVault.js +16 -0
- package/dist/src/generated/types/initializeVault.js.map +1 -0
- package/dist/src/generated/types/key.d.ts +29 -0
- package/dist/src/generated/types/key.js +36 -0
- package/dist/src/generated/types/key.js.map +1 -0
- package/dist/src/generated/types/launchPoolBucketState.d.ts +17 -0
- package/dist/src/generated/types/launchPoolBucketState.js +26 -0
- package/dist/src/generated/types/launchPoolBucketState.js.map +1 -0
- package/dist/src/generated/types/linearBpsSchedule.d.ts +23 -0
- package/dist/src/generated/types/linearBpsSchedule.js +22 -0
- package/dist/src/generated/types/linearBpsSchedule.js.map +1 -0
- package/dist/src/generated/types/meteoraBucketState.d.ts +15 -0
- package/dist/src/generated/types/meteoraBucketState.js +24 -0
- package/dist/src/generated/types/meteoraBucketState.js.map +1 -0
- package/dist/src/generated/types/presaleBucketState.d.ts +17 -0
- package/dist/src/generated/types/presaleBucketState.js +26 -0
- package/dist/src/generated/types/presaleBucketState.js.map +1 -0
- package/dist/src/generated/types/pumpBucketState.d.ts +15 -0
- package/dist/src/generated/types/pumpBucketState.js +24 -0
- package/dist/src/generated/types/pumpBucketState.js.map +1 -0
- package/dist/src/generated/types/schedule.d.ts +22 -0
- package/dist/src/generated/types/schedule.js +34 -0
- package/dist/src/generated/types/schedule.js.map +1 -0
- package/dist/src/generated/types/streamflowBucketState.d.ts +16 -0
- package/dist/src/generated/types/streamflowBucketState.js +25 -0
- package/dist/src/generated/types/streamflowBucketState.js.map +1 -0
- package/dist/src/generated/types/streamflowConfig.d.ts +43 -0
- package/dist/src/generated/types/streamflowConfig.js +32 -0
- package/dist/src/generated/types/streamflowConfig.js.map +1 -0
- package/dist/src/generated/types/swapDirection.d.ts +14 -0
- package/dist/src/generated/types/swapDirection.js +23 -0
- package/dist/src/generated/types/swapDirection.js.map +1 -0
- package/dist/src/generated/types/unlockedBucketState.d.ts +16 -0
- package/dist/src/generated/types/unlockedBucketState.js +25 -0
- package/dist/src/generated/types/unlockedBucketState.js.map +1 -0
- package/dist/src/generated/types/vaultBucketState.d.ts +17 -0
- package/dist/src/generated/types/vaultBucketState.js +26 -0
- package/dist/src/generated/types/vaultBucketState.js.map +1 -0
- package/dist/src/hooked/auctionAVLTreeV1.d.ts +41 -0
- package/dist/src/hooked/auctionAVLTreeV1.js +72 -0
- package/dist/src/hooked/auctionAVLTreeV1.js.map +1 -0
- package/dist/src/hooked/bondingCurveBucketV1AccountData.d.ts +10 -0
- package/dist/src/hooked/bondingCurveBucketV1AccountData.js +28 -0
- package/dist/src/hooked/bondingCurveBucketV1AccountData.js.map +1 -0
- package/dist/src/hooked/index.d.ts +2 -0
- package/dist/src/hooked/index.js +19 -0
- package/dist/src/hooked/index.js.map +1 -0
- package/dist/src/index.d.ts +14 -0
- package/dist/src/index.js +33 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/merkleTree.d.ts +13 -0
- package/dist/src/merkleTree.js +92 -0
- package/dist/src/merkleTree.js.map +1 -0
- package/dist/src/meteora.d.ts +11 -0
- package/dist/src/meteora.js +66 -0
- package/dist/src/meteora.js.map +1 -0
- package/dist/src/plugin.d.ts +2 -0
- package/dist/src/plugin.js +11 -0
- package/dist/src/plugin.js.map +1 -0
- package/dist/src/pumpAmm.d.ts +6 -0
- package/dist/src/pumpAmm.js +28 -0
- package/dist/src/pumpAmm.js.map +1 -0
- package/dist/src/schedule.d.ts +15 -0
- package/dist/src/schedule.js +79 -0
- package/dist/src/schedule.js.map +1 -0
- package/dist/src/streamflow.d.ts +7 -0
- package/dist/src/streamflow.js +22 -0
- package/dist/src/streamflow.js.map +1 -0
- package/dist/src/utils/bigInt.d.ts +1 -0
- package/dist/src/utils/bigInt.js +8 -0
- package/dist/src/utils/bigInt.js.map +1 -0
- package/package.json +71 -0
package/README.md
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# JavaScript client for Genesis
|
|
2
|
+
|
|
3
|
+
A Umi-compatible JavaScript library for the project.
|
|
4
|
+
|
|
5
|
+
## Getting started
|
|
6
|
+
|
|
7
|
+
1. First, if you're not already using Umi, [follow these instructions to install the Umi framework](https://github.com/metaplex-foundation/umi/blob/main/docs/installation.md).
|
|
8
|
+
2. Next, install this library using the package manager of your choice.
|
|
9
|
+
```sh
|
|
10
|
+
npm install @metaplex-foundation/genesis
|
|
11
|
+
```
|
|
12
|
+
2. Finally, register the library with your Umi instance like so.
|
|
13
|
+
```ts
|
|
14
|
+
import { genesis } from '@metaplex-foundation/genesis';
|
|
15
|
+
umi.use(genesis());
|
|
16
|
+
```
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { PublicKey } from '@metaplex-foundation/umi';
|
|
2
|
+
import { PresaleBucketV1 } from './generated';
|
|
3
|
+
export type AllowlistMember = {
|
|
4
|
+
address: PublicKey;
|
|
5
|
+
};
|
|
6
|
+
export declare function prepareAllowlist(recipients: Array<AllowlistMember>): {
|
|
7
|
+
root: Uint8Array;
|
|
8
|
+
proofs: Uint8Array[][];
|
|
9
|
+
treeHeight: number;
|
|
10
|
+
};
|
|
11
|
+
export declare function getAllowlistLeafBytes(recipient: AllowlistMember): Uint8Array;
|
|
12
|
+
/**
|
|
13
|
+
* Computes the minimum Merkle tree height required to accommodate the given
|
|
14
|
+
* number of leaves. The height is defined as the number of internal layers
|
|
15
|
+
* above the leaves (i.e. a tree with a single leaf has height 0).
|
|
16
|
+
*/
|
|
17
|
+
export declare function computeTreeHeight(leavesCount: number): number;
|
|
18
|
+
export declare function isAllowlistActive(presaleBucket: PresaleBucketV1): boolean;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isAllowlistActive = exports.computeTreeHeight = exports.getAllowlistLeafBytes = exports.prepareAllowlist = void 0;
|
|
4
|
+
const umi_1 = require("@metaplex-foundation/umi");
|
|
5
|
+
const merkleTree_1 = require("./merkleTree");
|
|
6
|
+
function prepareAllowlist(recipients) {
|
|
7
|
+
const leafs = recipients.map(getAllowlistLeafBytes);
|
|
8
|
+
const tree = (0, merkleTree_1.createMerkleTree)(leafs);
|
|
9
|
+
const merkleRoot = (0, merkleTree_1.getRoot)(tree);
|
|
10
|
+
// Calculate the minimum tree height required for the number of recipients.
|
|
11
|
+
const treeHeight = computeTreeHeight(leafs.length);
|
|
12
|
+
return {
|
|
13
|
+
root: merkleRoot,
|
|
14
|
+
proofs: leafs.map((_, i) => (0, merkleTree_1.getProof)(tree, i)),
|
|
15
|
+
treeHeight,
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
exports.prepareAllowlist = prepareAllowlist;
|
|
19
|
+
function getAllowlistLeafBytes(recipient) {
|
|
20
|
+
const pubkey = (0, umi_1.publicKey)(recipient.address);
|
|
21
|
+
const pubkeyBytes = (0, umi_1.publicKeyBytes)(pubkey);
|
|
22
|
+
return pubkeyBytes;
|
|
23
|
+
}
|
|
24
|
+
exports.getAllowlistLeafBytes = getAllowlistLeafBytes;
|
|
25
|
+
/**
|
|
26
|
+
* Computes the minimum Merkle tree height required to accommodate the given
|
|
27
|
+
* number of leaves. The height is defined as the number of internal layers
|
|
28
|
+
* above the leaves (i.e. a tree with a single leaf has height 0).
|
|
29
|
+
*/
|
|
30
|
+
function computeTreeHeight(leavesCount) {
|
|
31
|
+
if (leavesCount <= 1)
|
|
32
|
+
return 0;
|
|
33
|
+
// Double the capacity at each level. Using log2 to calculate the number of doublings required.
|
|
34
|
+
return Math.ceil(Math.log2(leavesCount));
|
|
35
|
+
}
|
|
36
|
+
exports.computeTreeHeight = computeTreeHeight;
|
|
37
|
+
function isAllowlistActive(presaleBucket) {
|
|
38
|
+
if (!presaleBucket.hasAllowlist) {
|
|
39
|
+
return false;
|
|
40
|
+
}
|
|
41
|
+
if (presaleBucket.allowlistEnd < BigInt(Date.now() * 1000)) {
|
|
42
|
+
return false;
|
|
43
|
+
}
|
|
44
|
+
if (presaleBucket.isAllowlistSolCapReached) {
|
|
45
|
+
return false;
|
|
46
|
+
}
|
|
47
|
+
return true;
|
|
48
|
+
}
|
|
49
|
+
exports.isAllowlistActive = isAllowlistActive;
|
|
50
|
+
//# sourceMappingURL=allowlist.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"allowlist.js","sourceRoot":"","sources":["../../src/allowlist.ts"],"names":[],"mappings":";;;AAAA,kDAAgF;AAChF,6CAAmE;AAOnE,SAAgB,gBAAgB,CAAC,UAAkC;IACjE,MAAM,KAAK,GAAG,UAAU,CAAC,GAAG,CAAC,qBAAqB,CAAC,CAAC;IACpD,MAAM,IAAI,GAAG,IAAA,6BAAgB,EAAC,KAAK,CAAC,CAAC;IACrC,MAAM,UAAU,GAAG,IAAA,oBAAO,EAAC,IAAI,CAAC,CAAC;IAEjC,2EAA2E;IAC3E,MAAM,UAAU,GAAG,iBAAiB,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IACnD,OAAO;QACL,IAAI,EAAE,UAAU;QAChB,MAAM,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,IAAA,qBAAQ,EAAC,IAAI,EAAE,CAAC,CAAC,CAAC;QAC9C,UAAU;KACX,CAAC;AACJ,CAAC;AAZD,4CAYC;AAED,SAAgB,qBAAqB,CAAC,SAA0B;IAC9D,MAAM,MAAM,GAAG,IAAA,eAAS,EAAC,SAAS,CAAC,OAAO,CAAC,CAAC;IAC5C,MAAM,WAAW,GAAG,IAAA,oBAAc,EAAC,MAAM,CAAC,CAAC;IAE3C,OAAO,WAAW,CAAC;AACrB,CAAC;AALD,sDAKC;AAED;;;;GAIG;AACH,SAAgB,iBAAiB,CAAC,WAAmB;IACnD,IAAI,WAAW,IAAI,CAAC;QAAE,OAAO,CAAC,CAAC;IAE/B,+FAA+F;IAC/F,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC;AAC3C,CAAC;AALD,8CAKC;AAED,SAAgB,iBAAiB,CAAC,aAA8B;IAC9D,IAAI,CAAC,aAAa,CAAC,YAAY,EAAE;QAC/B,OAAO,KAAK,CAAC;KACd;IAED,IAAI,aAAa,CAAC,YAAY,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,EAAE;QAC1D,OAAO,KAAK,CAAC;KACd;IAED,IAAI,aAAa,CAAC,wBAAwB,EAAE;QAC1C,OAAO,KAAK,CAAC;KACd;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AAdD,8CAcC"}
|
|
@@ -0,0 +1,296 @@
|
|
|
1
|
+
import { Context, MicroSolAmount, SolAmount } from '@metaplex-foundation/umi';
|
|
2
|
+
import { AuctionAVLTreeV1, AuctionBucketV1 } from './generated';
|
|
3
|
+
import { AuctionNode, TreeBid } from './hooked';
|
|
4
|
+
export declare const MICRO_LAMPORTS_PER_LAMPORT = 1000000;
|
|
5
|
+
/**
|
|
6
|
+
* Converts lamports to micro-lamports for auction pricing.
|
|
7
|
+
*
|
|
8
|
+
* Auction bids use micro-lamports (1/1,000,000 of a lamport) for sub-lamport precision.
|
|
9
|
+
* This allows for finer granularity in token pricing.
|
|
10
|
+
*
|
|
11
|
+
* @param lamports - The amount in lamports to convert
|
|
12
|
+
* @returns The equivalent amount in micro-lamports
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```typescript
|
|
16
|
+
* // 0.5 SOL per token = 500,000,000 lamports per token
|
|
17
|
+
* const pricePerToken = lamportsToUlamports(500_000_000);
|
|
18
|
+
*
|
|
19
|
+
* // Use in auction bid
|
|
20
|
+
* await placeAuctionBidV1(umi, {
|
|
21
|
+
* // ... other params
|
|
22
|
+
* pricePerToken,
|
|
23
|
+
* // ...
|
|
24
|
+
* }).sendAndConfirm(umi);
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
export declare function lamportsToUlamports(lamportsInput: number | bigint): bigint;
|
|
28
|
+
/**
|
|
29
|
+
* Retrieves all nodes from an auction AVL tree.
|
|
30
|
+
*
|
|
31
|
+
* @param tree - The auction AVL tree to extract nodes from
|
|
32
|
+
* @returns An array of all auction nodes in the tree, in allocation order
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* ```typescript
|
|
36
|
+
* const tree = await fetchAuctionAVLTreeV1(umi, treePda);
|
|
37
|
+
* const allNodes = getAllAuctionTreeNodes(tree);
|
|
38
|
+
* console.log(`Tree contains ${allNodes.length} nodes`);
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
41
|
+
export declare function getAllAuctionTreeNodes(tree: AuctionAVLTreeV1): AuctionNode[];
|
|
42
|
+
/**
|
|
43
|
+
* Retrieves a specific node from an auction AVL tree by its index.
|
|
44
|
+
*
|
|
45
|
+
* @param tree - The auction AVL tree to search in
|
|
46
|
+
* @param index - The 1-based index of the node to retrieve
|
|
47
|
+
* @returns The auction node at the specified index, or null if index is out of bounds
|
|
48
|
+
*
|
|
49
|
+
* @example
|
|
50
|
+
* ```typescript
|
|
51
|
+
* const tree = await fetchAuctionAVLTreeV1(umi, treePda);
|
|
52
|
+
* const node = getAuctionTreeNode(tree, 5);
|
|
53
|
+
* if (node) {
|
|
54
|
+
* console.log(`Node 5 bid: ${node.bid.pricePerToken}`);
|
|
55
|
+
* }
|
|
56
|
+
* ```
|
|
57
|
+
*/
|
|
58
|
+
export declare function getAuctionTreeNode(tree: AuctionAVLTreeV1, index: number): AuctionNode | null;
|
|
59
|
+
/**
|
|
60
|
+
* Finds all bids in the auction tree that meet or exceed the clearing price.
|
|
61
|
+
*
|
|
62
|
+
* Uses an in-order traversal of the AVL tree to efficiently collect qualifying bids.
|
|
63
|
+
* The function traverses from highest to lowest prices and stops when prices fall
|
|
64
|
+
* below the clearing price threshold.
|
|
65
|
+
*
|
|
66
|
+
* @param tree - The auction AVL tree containing all bids
|
|
67
|
+
* @param clearingPriceULamports - The minimum price in micro-lamports for a bid to qualify
|
|
68
|
+
* @returns Array of bids that meet or exceed the clearing price, sorted by price (highest first)
|
|
69
|
+
*
|
|
70
|
+
* @example
|
|
71
|
+
* ```typescript
|
|
72
|
+
* const tree = await fetchAuctionAVLTreeV1(umi, treePda);
|
|
73
|
+
* const clearingPrice = lamportsToMicroLamports(1_000_000); // 0.001 SOL
|
|
74
|
+
* const qualifyingBids = findAuctionBids(tree, clearingPrice);
|
|
75
|
+
* ```
|
|
76
|
+
*/
|
|
77
|
+
export declare function findAuctionBids(tree: AuctionAVLTreeV1, clearingPriceULamports: bigint): TreeBid[];
|
|
78
|
+
/**
|
|
79
|
+
* Calculates the winning bids for an auction based on clearing price and token allocation.
|
|
80
|
+
*
|
|
81
|
+
* This function determines which bids win tokens in the auction by:
|
|
82
|
+
* 1. Finding all bids at or above the clearing price
|
|
83
|
+
* 2. Sorting them by price (highest first) and bid number (earliest first for ties)
|
|
84
|
+
* 3. Allocating tokens until the supply is exhausted
|
|
85
|
+
*
|
|
86
|
+
* @param tree - The auction AVL tree containing all bids
|
|
87
|
+
* @param clearingPriceULamports - The clearing price in micro-lamports
|
|
88
|
+
* @param tokenAllocation - The total number of tokens available for distribution
|
|
89
|
+
* @returns Array of winning bids in order of priority
|
|
90
|
+
*
|
|
91
|
+
* @example
|
|
92
|
+
* ```typescript
|
|
93
|
+
* const tree = await fetchAuctionAVLTreeV1(umi, treePda);
|
|
94
|
+
* const clearingPrice = lamportsToMicroLamports(500_000_000); // 0.5 SOL
|
|
95
|
+
* const tokenSupply = 1_000_000n;
|
|
96
|
+
* const winners = calculateAuctionWinners(tree, clearingPrice, tokenSupply);
|
|
97
|
+
* ```
|
|
98
|
+
*/
|
|
99
|
+
export declare function calculateAuctionWinners(tree: AuctionAVLTreeV1, clearingPriceULamports: bigint, tokenAllocation: bigint): TreeBid[];
|
|
100
|
+
/**
|
|
101
|
+
* Fetches all winning bids from an auction bucket.
|
|
102
|
+
*
|
|
103
|
+
* This async function retrieves the auction tree associated with a bucket
|
|
104
|
+
* and calculates the winning bids based on the bucket's clearing price
|
|
105
|
+
* and token allocation.
|
|
106
|
+
*
|
|
107
|
+
* @param umi - Umi context containing RPC, programs, and eddsa for Solana interaction
|
|
108
|
+
* @param auction - The auction bucket containing clearing price and allocation info
|
|
109
|
+
* @returns Promise resolving to an array of winning bids
|
|
110
|
+
* @throws Error if the auction tree is not found
|
|
111
|
+
*
|
|
112
|
+
* @example
|
|
113
|
+
* ```typescript
|
|
114
|
+
* const auctionBucket = await fetchAuctionBucketV1(umi, bucketPda);
|
|
115
|
+
* const winners = await getAuctionWinners(umi, auctionBucket);
|
|
116
|
+
* console.log(`${winners.length} winning bids found`);
|
|
117
|
+
* ```
|
|
118
|
+
*/
|
|
119
|
+
export declare function fetchAuctionWinners(umi: Pick<Context, 'eddsa' | 'rpc' | 'programs'>, auction: AuctionBucketV1): Promise<TreeBid[]>;
|
|
120
|
+
export type MicroSolInput = bigint | MicroSolAmount;
|
|
121
|
+
/**
|
|
122
|
+
* Creates a MicroSolAmount from either a bigint or an existing MicroSolAmount.
|
|
123
|
+
*
|
|
124
|
+
* @param amount - The amount as bigint or MicroSolAmount
|
|
125
|
+
* @returns A MicroSolAmount object
|
|
126
|
+
* @internal
|
|
127
|
+
*/
|
|
128
|
+
export declare function createMicroLamports(amount: MicroSolInput): MicroSolAmount;
|
|
129
|
+
export type AuctionBucketV1Input = Omit<AuctionBucketV1, 'clearingPriceUlamports' | 'minPriceUlamports'> & {
|
|
130
|
+
clearingPriceUlamports: MicroSolInput;
|
|
131
|
+
minPriceUlamports: MicroSolInput;
|
|
132
|
+
};
|
|
133
|
+
export type BidInput = Omit<TreeBid, 'priceUlamports'> & {
|
|
134
|
+
priceUlamports: MicroSolInput;
|
|
135
|
+
};
|
|
136
|
+
/**
|
|
137
|
+
* Determines if a bid is winning based on the auction's clearing price and bid number.
|
|
138
|
+
*
|
|
139
|
+
* A bid is considered winning if:
|
|
140
|
+
* - Its price exceeds the clearing price, OR
|
|
141
|
+
* - Its price equals the clearing price AND its bid number is at or before the clearing price bid number
|
|
142
|
+
*
|
|
143
|
+
* @param auction - The auction bucket with clearing price and clearing price bid number
|
|
144
|
+
* @param bid - The bid to check with price per token and bid number
|
|
145
|
+
* @returns True if the bid is winning, false otherwise
|
|
146
|
+
*
|
|
147
|
+
* @example
|
|
148
|
+
* ```typescript
|
|
149
|
+
* const auction = await fetchAuctionBucketV1(umi, auctionPda);
|
|
150
|
+
* const bid = await fetchAuctionBidV1(umi, bidPda);
|
|
151
|
+
* const isWinner = isBidWinning(auction, bid); // true (price exceeds clearing)
|
|
152
|
+
* ```
|
|
153
|
+
*/
|
|
154
|
+
export declare function isBidWinning(auction: Pick<AuctionBucketV1Input, 'clearingPriceBidNumber' | 'clearingPriceUlamports'>, bid: Pick<BidInput, 'bidNumber' | 'priceUlamports'>): boolean;
|
|
155
|
+
/**
|
|
156
|
+
* Determines if a bid is losing (not winning) in the auction.
|
|
157
|
+
*
|
|
158
|
+
* This is the inverse of isBidWinning - a bid is losing if it doesn't meet
|
|
159
|
+
* the criteria for winning.
|
|
160
|
+
*
|
|
161
|
+
* @param auction - The auction bucket with clearing price and clearing price bid number
|
|
162
|
+
* @param bid - The bid to check with price per token and bid number
|
|
163
|
+
* @returns True if the bid is losing, false if winning
|
|
164
|
+
*
|
|
165
|
+
* @example
|
|
166
|
+
* ```typescript
|
|
167
|
+
* const auction = await fetchAuctionBucketV1(umi, auctionPda);
|
|
168
|
+
* const bid = await fetchAuctionBidV1(umi, bidPda);
|
|
169
|
+
* const isLoser = isBidLosing(auction, bid); // true (price below clearing)
|
|
170
|
+
* ```
|
|
171
|
+
*/
|
|
172
|
+
export declare function isBidLosing(auction: Pick<AuctionBucketV1Input, 'clearingPriceUlamports' | 'clearingPriceBidNumber'>, bid: Pick<BidInput, 'priceUlamports' | 'bidNumber'>): boolean;
|
|
173
|
+
/**
|
|
174
|
+
* Determines if a bid is partially filled at the clearing price.
|
|
175
|
+
*
|
|
176
|
+
* A bid is considered partially filled when:
|
|
177
|
+
* - The bid is at the clearing price (bid number matches clearing price bid number)
|
|
178
|
+
* - The bid requests more tokens than are available at the clearing price
|
|
179
|
+
*
|
|
180
|
+
* This occurs when the auction's token supply is exhausted at the clearing price,
|
|
181
|
+
* causing the last bid at that price to receive only a portion of their requested tokens.
|
|
182
|
+
*
|
|
183
|
+
* @param auctionBucket - The auction bucket with clearing price bid number and allocation
|
|
184
|
+
* @param bid - The bid to check with bid number and requested token quantity
|
|
185
|
+
* @returns True if the bid is partially filled, false if fully filled or not at clearing price
|
|
186
|
+
*
|
|
187
|
+
* @example
|
|
188
|
+
* ```typescript
|
|
189
|
+
* const auction = await fetchAuctionBucketV1(umi, auctionPda);
|
|
190
|
+
* const bid = await fetchAuctionBidV1(umi, bidPda);
|
|
191
|
+
* const isPartial = isBidPartiallyFilled(auction, bid); // true (partial fill at clearing price)
|
|
192
|
+
* ```
|
|
193
|
+
*/
|
|
194
|
+
export declare function isBidPartiallyFilled(auctionBucket: Pick<AuctionBucketV1Input, 'clearingPriceBidNumber' | 'clearingPriceAllocation'>, bid: Pick<BidInput, 'bidNumber' | 'tokenQuantity'>): boolean;
|
|
195
|
+
/**
|
|
196
|
+
* Calculates the actual token amount a bid will receive.
|
|
197
|
+
*
|
|
198
|
+
* Returns either the partial fill amount (if bid is at clearing price) or
|
|
199
|
+
* the full token quantity requested by the bid.
|
|
200
|
+
*
|
|
201
|
+
* @param bid - The bid with bid number and requested token quantity
|
|
202
|
+
* @param auctionBucket - The auction bucket with clearing price info
|
|
203
|
+
* @returns The actual number of tokens the bid will receive
|
|
204
|
+
*
|
|
205
|
+
* @example
|
|
206
|
+
* ```typescript
|
|
207
|
+
* const bid = await fetchAuctionBidV1(umi, bidPda);
|
|
208
|
+
* const auction = await fetchAuctionBucketV1(umi, auctionPda);
|
|
209
|
+
* const fillAmount = getBidFillAmount(bid, auction); // 50000n (partial fill)
|
|
210
|
+
* ```
|
|
211
|
+
*/
|
|
212
|
+
export declare function getBidFillAmount(auctionBucket: Pick<AuctionBucketV1Input, 'clearingPriceBidNumber' | 'clearingPriceAllocation'>, bid: Pick<BidInput, 'bidNumber' | 'tokenQuantity'>): bigint;
|
|
213
|
+
/**
|
|
214
|
+
* Converts SOL amount to micro-SOL (µSOL) amount.
|
|
215
|
+
*
|
|
216
|
+
* @param sol - The amount in SOL (lamports)
|
|
217
|
+
* @returns The equivalent amount in micro-SOL (micro-lamports)
|
|
218
|
+
*
|
|
219
|
+
* @example
|
|
220
|
+
* ```typescript
|
|
221
|
+
* const solAmount = lamports(1_000_000_000); // 1 SOL
|
|
222
|
+
* const microSolAmount = toUSol(solAmount); // 1,000,000,000,000,000 µSOL
|
|
223
|
+
* ```
|
|
224
|
+
*/
|
|
225
|
+
export declare function toUSol(sol: SolAmount): MicroSolAmount;
|
|
226
|
+
/**
|
|
227
|
+
* Converts micro-SOL (µSOL) amount to SOL amount.
|
|
228
|
+
*
|
|
229
|
+
* @param uSol - The amount in micro-SOL (micro-lamports)
|
|
230
|
+
* @returns The equivalent amount in SOL (lamports)
|
|
231
|
+
*
|
|
232
|
+
* @example
|
|
233
|
+
* ```typescript
|
|
234
|
+
* const microSolAmount = microLamports(1_000_000_000_000_000n); // 1,000,000,000,000,000 µSOL
|
|
235
|
+
* const solAmount = toSol(microSolAmount); // 1 SOL
|
|
236
|
+
* ```
|
|
237
|
+
*/
|
|
238
|
+
export declare function toSol(uSol: MicroSolAmount): SolAmount;
|
|
239
|
+
/**
|
|
240
|
+
* Calculates the micro-SOL price per token basis unit.
|
|
241
|
+
*
|
|
242
|
+
* Converts a SOL per token price to micro-SOL per smallest token unit,
|
|
243
|
+
* accounting for token decimals. This is used for precise sub-lamport pricing.
|
|
244
|
+
*
|
|
245
|
+
* @param solPerTokenInput - The price in SOL per whole token (or lamports as bigint)
|
|
246
|
+
* @param tokenDecimals - The number of decimal places for the token
|
|
247
|
+
* @returns The price in micro-SOL per token basis unit
|
|
248
|
+
*
|
|
249
|
+
* @example
|
|
250
|
+
* ```typescript
|
|
251
|
+
* // For a token with 6 decimals, priced at 0.5 SOL per token
|
|
252
|
+
* const priceUlamports = lamports(500_000_000); // 0.5 SOL
|
|
253
|
+
* const microSolPerBasis = uSolPerTokenBasis(priceUlamports, 6);
|
|
254
|
+
* // Returns price per smallest token unit (1/1,000,000 of a token)
|
|
255
|
+
* ```
|
|
256
|
+
*/
|
|
257
|
+
export declare function uSolPerTokenBasis(solPerTokenInput: SolAmount | bigint, tokenDecimals: number): MicroSolAmount;
|
|
258
|
+
/**
|
|
259
|
+
* Converts micro-SOL per token basis unit to SOL per whole token.
|
|
260
|
+
*
|
|
261
|
+
* Takes a price in micro-SOL per smallest token unit and converts it to
|
|
262
|
+
* SOL per whole token, accounting for token decimals.
|
|
263
|
+
*
|
|
264
|
+
* @param ulamportsPerTokenBasis - The price in micro-SOL per token basis unit
|
|
265
|
+
* @param tokenDecimals - The number of decimal places for the token
|
|
266
|
+
* @returns The price in SOL per whole token
|
|
267
|
+
*
|
|
268
|
+
* @example
|
|
269
|
+
* ```typescript
|
|
270
|
+
* // For a token with 6 decimals
|
|
271
|
+
* const microSolPerBasis = microLamports(500n); // Price per smallest unit
|
|
272
|
+
* const solPerWholeToken = solPerToken(microSolPerBasis, 6);
|
|
273
|
+
* // Returns price in SOL for one whole token
|
|
274
|
+
* ```
|
|
275
|
+
*/
|
|
276
|
+
export declare function solPerToken(ulamportsPerTokenBasis: MicroSolInput, tokenDecimals: number): SolAmount;
|
|
277
|
+
/**
|
|
278
|
+
* Calculates the total SOL cost for a bid.
|
|
279
|
+
*
|
|
280
|
+
* Multiplies the micro-SOL price per token basis by the token amount
|
|
281
|
+
* to get the total cost in SOL.
|
|
282
|
+
*
|
|
283
|
+
* @param pricePerTokenBasis - The price in micro-SOL per token basis unit
|
|
284
|
+
* @param tokenAmount - The number of token basis units to purchase
|
|
285
|
+
* @returns The total cost in SOL
|
|
286
|
+
*
|
|
287
|
+
* @example
|
|
288
|
+
* ```typescript
|
|
289
|
+
* // Bidding for 1,000,000 token units at 500 micro-SOL each
|
|
290
|
+
* const pricePerUnit = microLamports(500n);
|
|
291
|
+
* const amount = 1_000_000n;
|
|
292
|
+
* const totalCost = totalBidSol(pricePerUnit, amount);
|
|
293
|
+
* // Returns total SOL needed for the bid
|
|
294
|
+
* ```
|
|
295
|
+
*/
|
|
296
|
+
export declare function totalBidSol(pricePerTokenBasis: MicroSolInput, tokenAmount: bigint): SolAmount;
|