@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
|
@@ -0,0 +1,416 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.totalBidSol = exports.solPerToken = exports.uSolPerTokenBasis = exports.toSol = exports.toUSol = exports.getBidFillAmount = exports.isBidPartiallyFilled = exports.isBidLosing = exports.isBidWinning = exports.createMicroLamports = exports.fetchAuctionWinners = exports.calculateAuctionWinners = exports.findAuctionBids = exports.getAuctionTreeNode = exports.getAllAuctionTreeNodes = exports.lamportsToUlamports = exports.MICRO_LAMPORTS_PER_LAMPORT = void 0;
|
|
4
|
+
const umi_1 = require("@metaplex-foundation/umi");
|
|
5
|
+
const generated_1 = require("./generated");
|
|
6
|
+
const hooked_1 = require("./hooked");
|
|
7
|
+
exports.MICRO_LAMPORTS_PER_LAMPORT = 1000000;
|
|
8
|
+
/**
|
|
9
|
+
* Converts lamports to micro-lamports for auction pricing.
|
|
10
|
+
*
|
|
11
|
+
* Auction bids use micro-lamports (1/1,000,000 of a lamport) for sub-lamport precision.
|
|
12
|
+
* This allows for finer granularity in token pricing.
|
|
13
|
+
*
|
|
14
|
+
* @param lamports - The amount in lamports to convert
|
|
15
|
+
* @returns The equivalent amount in micro-lamports
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```typescript
|
|
19
|
+
* // 0.5 SOL per token = 500,000,000 lamports per token
|
|
20
|
+
* const pricePerToken = lamportsToUlamports(500_000_000);
|
|
21
|
+
*
|
|
22
|
+
* // Use in auction bid
|
|
23
|
+
* await placeAuctionBidV1(umi, {
|
|
24
|
+
* // ... other params
|
|
25
|
+
* pricePerToken,
|
|
26
|
+
* // ...
|
|
27
|
+
* }).sendAndConfirm(umi);
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
function lamportsToUlamports(lamportsInput) {
|
|
31
|
+
return BigInt(lamportsInput) * BigInt(1000000);
|
|
32
|
+
}
|
|
33
|
+
exports.lamportsToUlamports = lamportsToUlamports;
|
|
34
|
+
/**
|
|
35
|
+
* Retrieves all nodes from an auction AVL tree.
|
|
36
|
+
*
|
|
37
|
+
* @param tree - The auction AVL tree to extract nodes from
|
|
38
|
+
* @returns An array of all auction nodes in the tree, in allocation order
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* ```typescript
|
|
42
|
+
* const tree = await fetchAuctionAVLTreeV1(umi, treePda);
|
|
43
|
+
* const allNodes = getAllAuctionTreeNodes(tree);
|
|
44
|
+
* console.log(`Tree contains ${allNodes.length} nodes`);
|
|
45
|
+
* ```
|
|
46
|
+
*/
|
|
47
|
+
function getAllAuctionTreeNodes(tree) {
|
|
48
|
+
const nodes = [];
|
|
49
|
+
for (let i = 0; i < tree.allocator.size; i += 1) {
|
|
50
|
+
nodes.push((0, hooked_1.getAuctionNodeSerializer)().deserialize(tree.rawData, tree.rawDataOffset + i * hooked_1.AUCTION_NODE_SIZE)[0]);
|
|
51
|
+
}
|
|
52
|
+
return nodes;
|
|
53
|
+
}
|
|
54
|
+
exports.getAllAuctionTreeNodes = getAllAuctionTreeNodes;
|
|
55
|
+
/**
|
|
56
|
+
* Retrieves a specific node from an auction AVL tree by its index.
|
|
57
|
+
*
|
|
58
|
+
* @param tree - The auction AVL tree to search in
|
|
59
|
+
* @param index - The 1-based index of the node to retrieve
|
|
60
|
+
* @returns The auction node at the specified index, or null if index is out of bounds
|
|
61
|
+
*
|
|
62
|
+
* @example
|
|
63
|
+
* ```typescript
|
|
64
|
+
* const tree = await fetchAuctionAVLTreeV1(umi, treePda);
|
|
65
|
+
* const node = getAuctionTreeNode(tree, 5);
|
|
66
|
+
* if (node) {
|
|
67
|
+
* console.log(`Node 5 bid: ${node.bid.pricePerToken}`);
|
|
68
|
+
* }
|
|
69
|
+
* ```
|
|
70
|
+
*/
|
|
71
|
+
function getAuctionTreeNode(tree, index) {
|
|
72
|
+
if (index < 1 || index > tree.allocator.size) {
|
|
73
|
+
return null;
|
|
74
|
+
}
|
|
75
|
+
return (0, hooked_1.getAuctionNodeSerializer)().deserialize(tree.rawData, tree.rawDataOffset + (index - 1) * hooked_1.AUCTION_NODE_SIZE)[0];
|
|
76
|
+
}
|
|
77
|
+
exports.getAuctionTreeNode = getAuctionTreeNode;
|
|
78
|
+
/**
|
|
79
|
+
* Finds all bids in the auction tree that meet or exceed the clearing price.
|
|
80
|
+
*
|
|
81
|
+
* Uses an in-order traversal of the AVL tree to efficiently collect qualifying bids.
|
|
82
|
+
* The function traverses from highest to lowest prices and stops when prices fall
|
|
83
|
+
* below the clearing price threshold.
|
|
84
|
+
*
|
|
85
|
+
* @param tree - The auction AVL tree containing all bids
|
|
86
|
+
* @param clearingPriceULamports - The minimum price in micro-lamports for a bid to qualify
|
|
87
|
+
* @returns Array of bids that meet or exceed the clearing price, sorted by price (highest first)
|
|
88
|
+
*
|
|
89
|
+
* @example
|
|
90
|
+
* ```typescript
|
|
91
|
+
* const tree = await fetchAuctionAVLTreeV1(umi, treePda);
|
|
92
|
+
* const clearingPrice = lamportsToMicroLamports(1_000_000); // 0.001 SOL
|
|
93
|
+
* const qualifyingBids = findAuctionBids(tree, clearingPrice);
|
|
94
|
+
* ```
|
|
95
|
+
*/
|
|
96
|
+
function findAuctionBids(tree, clearingPriceULamports) {
|
|
97
|
+
const bids = [];
|
|
98
|
+
// Use in-order traversal to collect winners efficiently
|
|
99
|
+
// Since AVL tree is sorted, we can traverse from highest to lowest
|
|
100
|
+
function collectBids(nodeIndex) {
|
|
101
|
+
if (nodeIndex === hooked_1.AUCTION_SENTINEL) {
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
const [node] = (0, hooked_1.getAuctionNodeSerializer)().deserialize(tree.rawData, tree.rawDataOffset + (nodeIndex - 1) * hooked_1.AUCTION_NODE_SIZE);
|
|
105
|
+
if (!node || node.bid.priceUlamports === 0n) {
|
|
106
|
+
// Skip deleted/inactive nodes
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
// Always traverse right subtree first (higher prices)
|
|
110
|
+
// The right subtree might have matching bids even if current node doesn't
|
|
111
|
+
collectBids(node.right);
|
|
112
|
+
if (node.bid.priceUlamports >= clearingPriceULamports) {
|
|
113
|
+
bids.push(node.bid);
|
|
114
|
+
// Traverse left subtree to find bids of the same price
|
|
115
|
+
collectBids(node.left);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
// Start traversal from root
|
|
119
|
+
collectBids(tree.allocator.root);
|
|
120
|
+
return bids;
|
|
121
|
+
}
|
|
122
|
+
exports.findAuctionBids = findAuctionBids;
|
|
123
|
+
/**
|
|
124
|
+
* Calculates the winning bids for an auction based on clearing price and token allocation.
|
|
125
|
+
*
|
|
126
|
+
* This function determines which bids win tokens in the auction by:
|
|
127
|
+
* 1. Finding all bids at or above the clearing price
|
|
128
|
+
* 2. Sorting them by price (highest first) and bid number (earliest first for ties)
|
|
129
|
+
* 3. Allocating tokens until the supply is exhausted
|
|
130
|
+
*
|
|
131
|
+
* @param tree - The auction AVL tree containing all bids
|
|
132
|
+
* @param clearingPriceULamports - The clearing price in micro-lamports
|
|
133
|
+
* @param tokenAllocation - The total number of tokens available for distribution
|
|
134
|
+
* @returns Array of winning bids in order of priority
|
|
135
|
+
*
|
|
136
|
+
* @example
|
|
137
|
+
* ```typescript
|
|
138
|
+
* const tree = await fetchAuctionAVLTreeV1(umi, treePda);
|
|
139
|
+
* const clearingPrice = lamportsToMicroLamports(500_000_000); // 0.5 SOL
|
|
140
|
+
* const tokenSupply = 1_000_000n;
|
|
141
|
+
* const winners = calculateAuctionWinners(tree, clearingPrice, tokenSupply);
|
|
142
|
+
* ```
|
|
143
|
+
*/
|
|
144
|
+
function calculateAuctionWinners(tree, clearingPriceULamports, tokenAllocation) {
|
|
145
|
+
const bids = findAuctionBids(tree, clearingPriceULamports);
|
|
146
|
+
bids.sort((a, b) => {
|
|
147
|
+
if (a.priceUlamports === b.priceUlamports) {
|
|
148
|
+
if (a.bidNumber === b.bidNumber)
|
|
149
|
+
return 0;
|
|
150
|
+
return a.bidNumber < b.bidNumber ? -1 : 1;
|
|
151
|
+
}
|
|
152
|
+
return a.priceUlamports > b.priceUlamports ? -1 : 1;
|
|
153
|
+
});
|
|
154
|
+
const winners = [];
|
|
155
|
+
let remainingTokens = tokenAllocation;
|
|
156
|
+
while (remainingTokens > 0n) {
|
|
157
|
+
const bid = bids.shift();
|
|
158
|
+
if (!bid) {
|
|
159
|
+
break;
|
|
160
|
+
}
|
|
161
|
+
winners.push(bid);
|
|
162
|
+
remainingTokens -= bid.tokenQuantity;
|
|
163
|
+
}
|
|
164
|
+
return winners;
|
|
165
|
+
}
|
|
166
|
+
exports.calculateAuctionWinners = calculateAuctionWinners;
|
|
167
|
+
/**
|
|
168
|
+
* Fetches all winning bids from an auction bucket.
|
|
169
|
+
*
|
|
170
|
+
* This async function retrieves the auction tree associated with a bucket
|
|
171
|
+
* and calculates the winning bids based on the bucket's clearing price
|
|
172
|
+
* and token allocation.
|
|
173
|
+
*
|
|
174
|
+
* @param umi - Umi context containing RPC, programs, and eddsa for Solana interaction
|
|
175
|
+
* @param auction - The auction bucket containing clearing price and allocation info
|
|
176
|
+
* @returns Promise resolving to an array of winning bids
|
|
177
|
+
* @throws Error if the auction tree is not found
|
|
178
|
+
*
|
|
179
|
+
* @example
|
|
180
|
+
* ```typescript
|
|
181
|
+
* const auctionBucket = await fetchAuctionBucketV1(umi, bucketPda);
|
|
182
|
+
* const winners = await getAuctionWinners(umi, auctionBucket);
|
|
183
|
+
* console.log(`${winners.length} winning bids found`);
|
|
184
|
+
* ```
|
|
185
|
+
*/
|
|
186
|
+
async function fetchAuctionWinners(umi, auction) {
|
|
187
|
+
const treePda = (0, generated_1.findAuctionAVLTreeV1Pda)(umi, {
|
|
188
|
+
bucket: auction.publicKey,
|
|
189
|
+
});
|
|
190
|
+
const tree = await (0, generated_1.safeFetchAuctionAVLTreeV1)(umi, treePda[0]);
|
|
191
|
+
if (!tree) {
|
|
192
|
+
throw new Error('Auction tree not found');
|
|
193
|
+
}
|
|
194
|
+
// Use the clearing price from the auction bucket
|
|
195
|
+
const { clearingPriceUlamports, tokenAllocation } = auction;
|
|
196
|
+
return calculateAuctionWinners(tree, clearingPriceUlamports, tokenAllocation);
|
|
197
|
+
}
|
|
198
|
+
exports.fetchAuctionWinners = fetchAuctionWinners;
|
|
199
|
+
/**
|
|
200
|
+
* Creates a MicroSolAmount from either a bigint or an existing MicroSolAmount.
|
|
201
|
+
*
|
|
202
|
+
* @param amount - The amount as bigint or MicroSolAmount
|
|
203
|
+
* @returns A MicroSolAmount object
|
|
204
|
+
* @internal
|
|
205
|
+
*/
|
|
206
|
+
function createMicroLamports(amount) {
|
|
207
|
+
return typeof amount === 'bigint' ? (0, umi_1.microLamports)(amount) : amount;
|
|
208
|
+
}
|
|
209
|
+
exports.createMicroLamports = createMicroLamports;
|
|
210
|
+
/**
|
|
211
|
+
* Determines if a bid is winning based on the auction's clearing price and bid number.
|
|
212
|
+
*
|
|
213
|
+
* A bid is considered winning if:
|
|
214
|
+
* - Its price exceeds the clearing price, OR
|
|
215
|
+
* - Its price equals the clearing price AND its bid number is at or before the clearing price bid number
|
|
216
|
+
*
|
|
217
|
+
* @param auction - The auction bucket with clearing price and clearing price bid number
|
|
218
|
+
* @param bid - The bid to check with price per token and bid number
|
|
219
|
+
* @returns True if the bid is winning, false otherwise
|
|
220
|
+
*
|
|
221
|
+
* @example
|
|
222
|
+
* ```typescript
|
|
223
|
+
* const auction = await fetchAuctionBucketV1(umi, auctionPda);
|
|
224
|
+
* const bid = await fetchAuctionBidV1(umi, bidPda);
|
|
225
|
+
* const isWinner = isBidWinning(auction, bid); // true (price exceeds clearing)
|
|
226
|
+
* ```
|
|
227
|
+
*/
|
|
228
|
+
function isBidWinning(auction, bid) {
|
|
229
|
+
const priceUlamports = createMicroLamports(bid.priceUlamports);
|
|
230
|
+
const clearingPrice = createMicroLamports(auction.clearingPriceUlamports);
|
|
231
|
+
if ((0, umi_1.isGreaterThanAmount)(priceUlamports, clearingPrice)) {
|
|
232
|
+
return true;
|
|
233
|
+
}
|
|
234
|
+
if ((0, umi_1.isEqualToAmount)(priceUlamports, clearingPrice) &&
|
|
235
|
+
bid.bidNumber <= auction.clearingPriceBidNumber) {
|
|
236
|
+
return true;
|
|
237
|
+
}
|
|
238
|
+
return false;
|
|
239
|
+
}
|
|
240
|
+
exports.isBidWinning = isBidWinning;
|
|
241
|
+
/**
|
|
242
|
+
* Determines if a bid is losing (not winning) in the auction.
|
|
243
|
+
*
|
|
244
|
+
* This is the inverse of isBidWinning - a bid is losing if it doesn't meet
|
|
245
|
+
* the criteria for winning.
|
|
246
|
+
*
|
|
247
|
+
* @param auction - The auction bucket with clearing price and clearing price bid number
|
|
248
|
+
* @param bid - The bid to check with price per token and bid number
|
|
249
|
+
* @returns True if the bid is losing, false if winning
|
|
250
|
+
*
|
|
251
|
+
* @example
|
|
252
|
+
* ```typescript
|
|
253
|
+
* const auction = await fetchAuctionBucketV1(umi, auctionPda);
|
|
254
|
+
* const bid = await fetchAuctionBidV1(umi, bidPda);
|
|
255
|
+
* const isLoser = isBidLosing(auction, bid); // true (price below clearing)
|
|
256
|
+
* ```
|
|
257
|
+
*/
|
|
258
|
+
function isBidLosing(auction, bid) {
|
|
259
|
+
return !isBidWinning(auction, bid);
|
|
260
|
+
}
|
|
261
|
+
exports.isBidLosing = isBidLosing;
|
|
262
|
+
/**
|
|
263
|
+
* Determines if a bid is partially filled at the clearing price.
|
|
264
|
+
*
|
|
265
|
+
* A bid is considered partially filled when:
|
|
266
|
+
* - The bid is at the clearing price (bid number matches clearing price bid number)
|
|
267
|
+
* - The bid requests more tokens than are available at the clearing price
|
|
268
|
+
*
|
|
269
|
+
* This occurs when the auction's token supply is exhausted at the clearing price,
|
|
270
|
+
* causing the last bid at that price to receive only a portion of their requested tokens.
|
|
271
|
+
*
|
|
272
|
+
* @param auctionBucket - The auction bucket with clearing price bid number and allocation
|
|
273
|
+
* @param bid - The bid to check with bid number and requested token quantity
|
|
274
|
+
* @returns True if the bid is partially filled, false if fully filled or not at clearing price
|
|
275
|
+
*
|
|
276
|
+
* @example
|
|
277
|
+
* ```typescript
|
|
278
|
+
* const auction = await fetchAuctionBucketV1(umi, auctionPda);
|
|
279
|
+
* const bid = await fetchAuctionBidV1(umi, bidPda);
|
|
280
|
+
* const isPartial = isBidPartiallyFilled(auction, bid); // true (partial fill at clearing price)
|
|
281
|
+
* ```
|
|
282
|
+
*/
|
|
283
|
+
function isBidPartiallyFilled(auctionBucket, bid) {
|
|
284
|
+
if (auctionBucket.clearingPriceBidNumber === bid.bidNumber &&
|
|
285
|
+
bid.tokenQuantity > auctionBucket.clearingPriceAllocation) {
|
|
286
|
+
return true;
|
|
287
|
+
}
|
|
288
|
+
return false;
|
|
289
|
+
}
|
|
290
|
+
exports.isBidPartiallyFilled = isBidPartiallyFilled;
|
|
291
|
+
/**
|
|
292
|
+
* Calculates the actual token amount a bid will receive.
|
|
293
|
+
*
|
|
294
|
+
* Returns either the partial fill amount (if bid is at clearing price) or
|
|
295
|
+
* the full token quantity requested by the bid.
|
|
296
|
+
*
|
|
297
|
+
* @param bid - The bid with bid number and requested token quantity
|
|
298
|
+
* @param auctionBucket - The auction bucket with clearing price info
|
|
299
|
+
* @returns The actual number of tokens the bid will receive
|
|
300
|
+
*
|
|
301
|
+
* @example
|
|
302
|
+
* ```typescript
|
|
303
|
+
* const bid = await fetchAuctionBidV1(umi, bidPda);
|
|
304
|
+
* const auction = await fetchAuctionBucketV1(umi, auctionPda);
|
|
305
|
+
* const fillAmount = getBidFillAmount(bid, auction); // 50000n (partial fill)
|
|
306
|
+
* ```
|
|
307
|
+
*/
|
|
308
|
+
function getBidFillAmount(auctionBucket, bid) {
|
|
309
|
+
return isBidPartiallyFilled(auctionBucket, bid)
|
|
310
|
+
? auctionBucket.clearingPriceAllocation
|
|
311
|
+
: bid.tokenQuantity;
|
|
312
|
+
}
|
|
313
|
+
exports.getBidFillAmount = getBidFillAmount;
|
|
314
|
+
/**
|
|
315
|
+
* Converts SOL amount to micro-SOL (µSOL) amount.
|
|
316
|
+
*
|
|
317
|
+
* @param sol - The amount in SOL (lamports)
|
|
318
|
+
* @returns The equivalent amount in micro-SOL (micro-lamports)
|
|
319
|
+
*
|
|
320
|
+
* @example
|
|
321
|
+
* ```typescript
|
|
322
|
+
* const solAmount = lamports(1_000_000_000); // 1 SOL
|
|
323
|
+
* const microSolAmount = toUSol(solAmount); // 1,000,000,000,000,000 µSOL
|
|
324
|
+
* ```
|
|
325
|
+
*/
|
|
326
|
+
function toUSol(sol) {
|
|
327
|
+
return (0, umi_1.microLamports)(sol.basisPoints * BigInt(exports.MICRO_LAMPORTS_PER_LAMPORT));
|
|
328
|
+
}
|
|
329
|
+
exports.toUSol = toUSol;
|
|
330
|
+
/**
|
|
331
|
+
* Converts micro-SOL (µSOL) amount to SOL amount.
|
|
332
|
+
*
|
|
333
|
+
* @param uSol - The amount in micro-SOL (micro-lamports)
|
|
334
|
+
* @returns The equivalent amount in SOL (lamports)
|
|
335
|
+
*
|
|
336
|
+
* @example
|
|
337
|
+
* ```typescript
|
|
338
|
+
* const microSolAmount = microLamports(1_000_000_000_000_000n); // 1,000,000,000,000,000 µSOL
|
|
339
|
+
* const solAmount = toSol(microSolAmount); // 1 SOL
|
|
340
|
+
* ```
|
|
341
|
+
*/
|
|
342
|
+
function toSol(uSol) {
|
|
343
|
+
return (0, umi_1.lamports)((0, umi_1.divideAmount)(uSol, BigInt(exports.MICRO_LAMPORTS_PER_LAMPORT)).basisPoints);
|
|
344
|
+
}
|
|
345
|
+
exports.toSol = toSol;
|
|
346
|
+
/**
|
|
347
|
+
* Calculates the micro-SOL price per token basis unit.
|
|
348
|
+
*
|
|
349
|
+
* Converts a SOL per token price to micro-SOL per smallest token unit,
|
|
350
|
+
* accounting for token decimals. This is used for precise sub-lamport pricing.
|
|
351
|
+
*
|
|
352
|
+
* @param solPerTokenInput - The price in SOL per whole token (or lamports as bigint)
|
|
353
|
+
* @param tokenDecimals - The number of decimal places for the token
|
|
354
|
+
* @returns The price in micro-SOL per token basis unit
|
|
355
|
+
*
|
|
356
|
+
* @example
|
|
357
|
+
* ```typescript
|
|
358
|
+
* // For a token with 6 decimals, priced at 0.5 SOL per token
|
|
359
|
+
* const priceUlamports = lamports(500_000_000); // 0.5 SOL
|
|
360
|
+
* const microSolPerBasis = uSolPerTokenBasis(priceUlamports, 6);
|
|
361
|
+
* // Returns price per smallest token unit (1/1,000,000 of a token)
|
|
362
|
+
* ```
|
|
363
|
+
*/
|
|
364
|
+
function uSolPerTokenBasis(solPerTokenInput, tokenDecimals) {
|
|
365
|
+
return (0, umi_1.divideAmount)(toUSol(typeof solPerTokenInput === 'bigint'
|
|
366
|
+
? (0, umi_1.lamports)(solPerTokenInput)
|
|
367
|
+
: solPerTokenInput), 10 ** tokenDecimals);
|
|
368
|
+
}
|
|
369
|
+
exports.uSolPerTokenBasis = uSolPerTokenBasis;
|
|
370
|
+
/**
|
|
371
|
+
* Converts micro-SOL per token basis unit to SOL per whole token.
|
|
372
|
+
*
|
|
373
|
+
* Takes a price in micro-SOL per smallest token unit and converts it to
|
|
374
|
+
* SOL per whole token, accounting for token decimals.
|
|
375
|
+
*
|
|
376
|
+
* @param ulamportsPerTokenBasis - The price in micro-SOL per token basis unit
|
|
377
|
+
* @param tokenDecimals - The number of decimal places for the token
|
|
378
|
+
* @returns The price in SOL per whole token
|
|
379
|
+
*
|
|
380
|
+
* @example
|
|
381
|
+
* ```typescript
|
|
382
|
+
* // For a token with 6 decimals
|
|
383
|
+
* const microSolPerBasis = microLamports(500n); // Price per smallest unit
|
|
384
|
+
* const solPerWholeToken = solPerToken(microSolPerBasis, 6);
|
|
385
|
+
* // Returns price in SOL for one whole token
|
|
386
|
+
* ```
|
|
387
|
+
*/
|
|
388
|
+
function solPerToken(ulamportsPerTokenBasis, tokenDecimals) {
|
|
389
|
+
return toSol((0, umi_1.multiplyAmount)(createMicroLamports(ulamportsPerTokenBasis), 10 ** tokenDecimals));
|
|
390
|
+
}
|
|
391
|
+
exports.solPerToken = solPerToken;
|
|
392
|
+
/**
|
|
393
|
+
* Calculates the total SOL cost for a bid.
|
|
394
|
+
*
|
|
395
|
+
* Multiplies the micro-SOL price per token basis by the token amount
|
|
396
|
+
* to get the total cost in SOL.
|
|
397
|
+
*
|
|
398
|
+
* @param pricePerTokenBasis - The price in micro-SOL per token basis unit
|
|
399
|
+
* @param tokenAmount - The number of token basis units to purchase
|
|
400
|
+
* @returns The total cost in SOL
|
|
401
|
+
*
|
|
402
|
+
* @example
|
|
403
|
+
* ```typescript
|
|
404
|
+
* // Bidding for 1,000,000 token units at 500 micro-SOL each
|
|
405
|
+
* const pricePerUnit = microLamports(500n);
|
|
406
|
+
* const amount = 1_000_000n;
|
|
407
|
+
* const totalCost = totalBidSol(pricePerUnit, amount);
|
|
408
|
+
* // Returns total SOL needed for the bid
|
|
409
|
+
* ```
|
|
410
|
+
*/
|
|
411
|
+
function totalBidSol(pricePerTokenBasis, tokenAmount) {
|
|
412
|
+
const microLamportsPerToken = (0, umi_1.multiplyAmount)(createMicroLamports(pricePerTokenBasis), tokenAmount);
|
|
413
|
+
return toSol(microLamportsPerToken);
|
|
414
|
+
}
|
|
415
|
+
exports.totalBidSol = totalBidSol;
|
|
416
|
+
//# sourceMappingURL=auction.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
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|
|
2
|
+
/**
|
|
3
|
+
* Calculate the output amount for a given input amount on a bonding curve.
|
|
4
|
+
* This function determines how much of the output asset you'll receive for a given input amount.
|
|
5
|
+
* This function does not take into account fees.
|
|
6
|
+
*
|
|
7
|
+
* @param bucket - The bonding curve bucket containing reserves and parameters
|
|
8
|
+
* @param amountIn - The input amount to swap
|
|
9
|
+
* @param direction - The swap direction (Buy = SOL in, tokens out; Sell = tokens in, SOL out)
|
|
10
|
+
* @returns The output amount you'll receive from the swap
|
|
11
|
+
* @throws Error if the bonding curve type is unsupported or calculation errors occur
|
|
12
|
+
*/
|
|
13
|
+
export declare function getSwapAmountOutForIn(bucket: BondingCurveBucketV1, amountIn: bigint, direction: SwapDirection): bigint;
|
|
14
|
+
/**
|
|
15
|
+
* Calculate the input amount needed to receive a desired output amount on a bonding curve.
|
|
16
|
+
* This function determines how much of the input asset you need to provide to get a specific output amount.
|
|
17
|
+
* This function does not take into account fees.
|
|
18
|
+
*
|
|
19
|
+
* @param bucket - The bonding curve bucket containing reserves and parameters
|
|
20
|
+
* @param amountOut - The desired output amount to receive
|
|
21
|
+
* @param direction - The swap direction (Buy = SOL in, tokens out; Sell = tokens in, SOL out)
|
|
22
|
+
* @returns The input amount required to achieve the desired output
|
|
23
|
+
* @throws Error if the bonding curve type is unsupported or calculation errors occur
|
|
24
|
+
*/
|
|
25
|
+
export declare function getSwapAmountInForOut(bucket: BondingCurveBucketV1, amountOut: bigint, direction: SwapDirection): bigint;
|
|
26
|
+
/**
|
|
27
|
+
* Calculates the complete swap result including fees for a bonding curve swap.
|
|
28
|
+
*
|
|
29
|
+
* @param bucket - The bonding curve bucket
|
|
30
|
+
* @param amountIn - The input amount (before fees)
|
|
31
|
+
* @param swapDirection - The swap direction (Buy = SOL in, tokens out; Sell = tokens in, SOL out)
|
|
32
|
+
* @returns An object containing the actual input amount, fee, and output amount
|
|
33
|
+
* @throws Error if the bucket has insufficient reserves or calculation errors occur
|
|
34
|
+
*/
|
|
35
|
+
export declare function getSwapResult(bucket: BondingCurveBucketV1, amountIn: bigint, swapDirection: SwapDirection): {
|
|
36
|
+
amountIn: bigint;
|
|
37
|
+
fee: bigint;
|
|
38
|
+
amountOut: bigint;
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* Get the current price of the bonding curve.
|
|
42
|
+
*
|
|
43
|
+
* @param bucket - The bonding curve bucket
|
|
44
|
+
* @returns The current price
|
|
45
|
+
*/
|
|
46
|
+
export declare function getCurrentPrice(bucket: BondingCurveBucketV1): bigint;
|