@whetstone-research/doppler-sdk 0.0.24 → 1.0.0
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 +69 -0
- package/dist/chunk-3LTCKCJC.js +319 -0
- package/dist/chunk-3LTCKCJC.js.map +1 -0
- package/dist/chunk-PZ5AY32C.js +9 -0
- package/dist/{chunk-4XN6DQBW.js.map → chunk-PZ5AY32C.js.map} +1 -1
- package/dist/chunk-RO6R66OM.js +974 -0
- package/dist/chunk-RO6R66OM.js.map +1 -0
- package/dist/evm/index.d.ts +8533 -0
- package/dist/evm/index.js +15055 -0
- package/dist/evm/index.js.map +1 -0
- package/dist/oracle-BSvZ6pxp.d.ts +820 -0
- package/dist/pda-RVIHNLRP.js +4 -0
- package/dist/pda-RVIHNLRP.js.map +1 -0
- package/dist/solana/index.d.ts +2495 -0
- package/dist/solana/index.js +2209 -0
- package/dist/solana/index.js.map +1 -0
- package/dist/solana/react/index.d.ts +1046 -0
- package/dist/solana/react/index.js +1436 -0
- package/dist/solana/react/index.js.map +1 -0
- package/package.json +36 -20
- package/dist/DopplerSDK.d.mts +0 -106
- package/dist/DopplerSDK.d.ts +0 -106
- package/dist/DopplerSDK.js +0 -53
- package/dist/DopplerSDK.js.map +0 -1
- package/dist/DopplerSDK.mjs +0 -44
- package/dist/DopplerSDK.mjs.map +0 -1
- package/dist/abis/bytecodes/derc20.d.mts +0 -3
- package/dist/abis/bytecodes/derc20.d.ts +0 -3
- package/dist/abis/bytecodes/derc20.js +0 -9
- package/dist/abis/bytecodes/derc20.js.map +0 -1
- package/dist/abis/bytecodes/derc20.mjs +0 -3
- package/dist/abis/bytecodes/derc20.mjs.map +0 -1
- package/dist/abis/bytecodes/derc2080.d.mts +0 -3
- package/dist/abis/bytecodes/derc2080.d.ts +0 -3
- package/dist/abis/bytecodes/derc2080.js +0 -9
- package/dist/abis/bytecodes/derc2080.js.map +0 -1
- package/dist/abis/bytecodes/derc2080.mjs +0 -3
- package/dist/abis/bytecodes/derc2080.mjs.map +0 -1
- package/dist/abis/bytecodes/doppler.d.mts +0 -3
- package/dist/abis/bytecodes/doppler.d.ts +0 -3
- package/dist/abis/bytecodes/doppler.js +0 -9
- package/dist/abis/bytecodes/doppler.js.map +0 -1
- package/dist/abis/bytecodes/doppler.mjs +0 -3
- package/dist/abis/bytecodes/doppler.mjs.map +0 -1
- package/dist/abis/bytecodes/dopplerDN404.d.mts +0 -3
- package/dist/abis/bytecodes/dopplerDN404.d.ts +0 -3
- package/dist/abis/bytecodes/dopplerDN404.js +0 -9
- package/dist/abis/bytecodes/dopplerDN404.js.map +0 -1
- package/dist/abis/bytecodes/dopplerDN404.mjs +0 -3
- package/dist/abis/bytecodes/dopplerDN404.mjs.map +0 -1
- package/dist/abis/bytecodes/stateView.d.mts +0 -3
- package/dist/abis/bytecodes/stateView.d.ts +0 -3
- package/dist/abis/bytecodes/stateView.js +0 -9
- package/dist/abis/bytecodes/stateView.js.map +0 -1
- package/dist/abis/bytecodes/stateView.mjs +0 -3
- package/dist/abis/bytecodes/stateView.mjs.map +0 -1
- package/dist/abis/bytecodes.d.mts +0 -5
- package/dist/abis/bytecodes.d.ts +0 -5
- package/dist/abis/bytecodes.js +0 -33
- package/dist/abis/bytecodes.js.map +0 -1
- package/dist/abis/bytecodes.mjs +0 -8
- package/dist/abis/bytecodes.mjs.map +0 -1
- package/dist/abis/index.d.mts +0 -3871
- package/dist/abis/index.d.ts +0 -3871
- package/dist/abis/index.js +0 -130
- package/dist/abis/index.js.map +0 -1
- package/dist/abis/index.mjs +0 -9
- package/dist/abis/index.mjs.map +0 -1
- package/dist/addresses.d.mts +0 -69
- package/dist/addresses.d.ts +0 -69
- package/dist/addresses.js +0 -29
- package/dist/addresses.js.map +0 -1
- package/dist/addresses.mjs +0 -4
- package/dist/addresses.mjs.map +0 -1
- package/dist/builders/DynamicAuctionBuilder.d.mts +0 -138
- package/dist/builders/DynamicAuctionBuilder.d.ts +0 -138
- package/dist/builders/DynamicAuctionBuilder.js +0 -35
- package/dist/builders/DynamicAuctionBuilder.js.map +0 -1
- package/dist/builders/DynamicAuctionBuilder.mjs +0 -26
- package/dist/builders/DynamicAuctionBuilder.mjs.map +0 -1
- package/dist/builders/MulticurveBuilder.d.mts +0 -196
- package/dist/builders/MulticurveBuilder.d.ts +0 -196
- package/dist/builders/MulticurveBuilder.js +0 -35
- package/dist/builders/MulticurveBuilder.js.map +0 -1
- package/dist/builders/MulticurveBuilder.mjs +0 -26
- package/dist/builders/MulticurveBuilder.mjs.map +0 -1
- package/dist/builders/StaticAuctionBuilder.d.mts +0 -131
- package/dist/builders/StaticAuctionBuilder.d.ts +0 -131
- package/dist/builders/StaticAuctionBuilder.js +0 -35
- package/dist/builders/StaticAuctionBuilder.js.map +0 -1
- package/dist/builders/StaticAuctionBuilder.mjs +0 -26
- package/dist/builders/StaticAuctionBuilder.mjs.map +0 -1
- package/dist/builders/index.d.mts +0 -8
- package/dist/builders/index.d.ts +0 -8
- package/dist/builders/index.js +0 -62
- package/dist/builders/index.js.map +0 -1
- package/dist/builders/index.mjs +0 -29
- package/dist/builders/index.mjs.map +0 -1
- package/dist/builders/shared.d.mts +0 -115
- package/dist/builders/shared.d.ts +0 -115
- package/dist/builders/shared.js +0 -46
- package/dist/builders/shared.js.map +0 -1
- package/dist/builders/shared.mjs +0 -25
- package/dist/builders/shared.mjs.map +0 -1
- package/dist/chunk-25GEBO3B.mjs +0 -219
- package/dist/chunk-25GEBO3B.mjs.map +0 -1
- package/dist/chunk-2A3B3NVB.js +0 -737
- package/dist/chunk-2A3B3NVB.js.map +0 -1
- package/dist/chunk-3NMGCQJ4.mjs +0 -6
- package/dist/chunk-3NMGCQJ4.mjs.map +0 -1
- package/dist/chunk-44CYUEPG.js +0 -377
- package/dist/chunk-44CYUEPG.js.map +0 -1
- package/dist/chunk-4VWQNNNW.js +0 -233
- package/dist/chunk-4VWQNNNW.js.map +0 -1
- package/dist/chunk-4XN6DQBW.js +0 -4
- package/dist/chunk-5GQJRNFL.mjs +0 -40
- package/dist/chunk-5GQJRNFL.mjs.map +0 -1
- package/dist/chunk-5JHXBDZD.js +0 -265
- package/dist/chunk-5JHXBDZD.js.map +0 -1
- package/dist/chunk-5TQOT6CW.js +0 -8
- package/dist/chunk-5TQOT6CW.js.map +0 -1
- package/dist/chunk-65CESA3J.js +0 -46
- package/dist/chunk-65CESA3J.js.map +0 -1
- package/dist/chunk-6BQY5EPB.js +0 -144
- package/dist/chunk-6BQY5EPB.js.map +0 -1
- package/dist/chunk-6H6X3VTZ.js +0 -18
- package/dist/chunk-6H6X3VTZ.js.map +0 -1
- package/dist/chunk-7A4DBBXA.js +0 -311
- package/dist/chunk-7A4DBBXA.js.map +0 -1
- package/dist/chunk-7M57PU6V.js +0 -28
- package/dist/chunk-7M57PU6V.js.map +0 -1
- package/dist/chunk-7ZUV6WPX.mjs +0 -3
- package/dist/chunk-7ZUV6WPX.mjs.map +0 -1
- package/dist/chunk-A2CJYRRQ.js +0 -330
- package/dist/chunk-A2CJYRRQ.js.map +0 -1
- package/dist/chunk-ABT6AT7C.mjs +0 -16
- package/dist/chunk-ABT6AT7C.mjs.map +0 -1
- package/dist/chunk-BK3S6SVR.js +0 -2707
- package/dist/chunk-BK3S6SVR.js.map +0 -1
- package/dist/chunk-BQZTELUX.js +0 -45
- package/dist/chunk-BQZTELUX.js.map +0 -1
- package/dist/chunk-CFAAYL5M.mjs +0 -26
- package/dist/chunk-CFAAYL5M.mjs.map +0 -1
- package/dist/chunk-CFXXUZJY.js +0 -275
- package/dist/chunk-CFXXUZJY.js.map +0 -1
- package/dist/chunk-CWTGQAOG.mjs +0 -72
- package/dist/chunk-CWTGQAOG.mjs.map +0 -1
- package/dist/chunk-DCWF3EMP.js +0 -171
- package/dist/chunk-DCWF3EMP.js.map +0 -1
- package/dist/chunk-DOUF6NON.mjs +0 -3
- package/dist/chunk-DOUF6NON.mjs.map +0 -1
- package/dist/chunk-DQJXCZU2.mjs +0 -318
- package/dist/chunk-DQJXCZU2.mjs.map +0 -1
- package/dist/chunk-DSYPZETD.js +0 -4
- package/dist/chunk-DSYPZETD.js.map +0 -1
- package/dist/chunk-F2BYG63D.mjs +0 -145
- package/dist/chunk-F2BYG63D.mjs.map +0 -1
- package/dist/chunk-FNUBKONK.js +0 -291
- package/dist/chunk-FNUBKONK.js.map +0 -1
- package/dist/chunk-FOESYJP3.mjs +0 -3
- package/dist/chunk-FOESYJP3.mjs.map +0 -1
- package/dist/chunk-FXTGIKQG.mjs +0 -3
- package/dist/chunk-FXTGIKQG.mjs.map +0 -1
- package/dist/chunk-GSBQIVME.mjs +0 -278
- package/dist/chunk-GSBQIVME.mjs.map +0 -1
- package/dist/chunk-H3B54PFV.mjs +0 -17
- package/dist/chunk-H3B54PFV.mjs.map +0 -1
- package/dist/chunk-HJFVRV47.js +0 -120
- package/dist/chunk-HJFVRV47.js.map +0 -1
- package/dist/chunk-IIM2CSDQ.js +0 -147
- package/dist/chunk-IIM2CSDQ.js.map +0 -1
- package/dist/chunk-IUTIHSLH.mjs +0 -295
- package/dist/chunk-IUTIHSLH.mjs.map +0 -1
- package/dist/chunk-IUZ3BBQP.mjs +0 -117
- package/dist/chunk-IUZ3BBQP.mjs.map +0 -1
- package/dist/chunk-IWJOPXYN.mjs +0 -96
- package/dist/chunk-IWJOPXYN.mjs.map +0 -1
- package/dist/chunk-IX4V4UGW.mjs +0 -141
- package/dist/chunk-IX4V4UGW.mjs.map +0 -1
- package/dist/chunk-J62YDWIK.js +0 -8
- package/dist/chunk-J62YDWIK.js.map +0 -1
- package/dist/chunk-JIKAD4YL.js +0 -4
- package/dist/chunk-JIKAD4YL.js.map +0 -1
- package/dist/chunk-JLUOFAE4.mjs +0 -2531
- package/dist/chunk-JLUOFAE4.mjs.map +0 -1
- package/dist/chunk-KAZQJ24E.mjs +0 -59
- package/dist/chunk-KAZQJ24E.mjs.map +0 -1
- package/dist/chunk-KHUE77HC.js +0 -81
- package/dist/chunk-KHUE77HC.js.map +0 -1
- package/dist/chunk-KOAC3BBP.mjs +0 -11
- package/dist/chunk-KOAC3BBP.mjs.map +0 -1
- package/dist/chunk-LW3CYA27.mjs +0 -2705
- package/dist/chunk-LW3CYA27.mjs.map +0 -1
- package/dist/chunk-MEA2C5YX.js +0 -143
- package/dist/chunk-MEA2C5YX.js.map +0 -1
- package/dist/chunk-MU56HCUI.js +0 -2556
- package/dist/chunk-MU56HCUI.js.map +0 -1
- package/dist/chunk-OCIY7QEJ.mjs +0 -169
- package/dist/chunk-OCIY7QEJ.mjs.map +0 -1
- package/dist/chunk-OHA5KJ2M.mjs +0 -6
- package/dist/chunk-OHA5KJ2M.mjs.map +0 -1
- package/dist/chunk-P25HBGP5.mjs +0 -3
- package/dist/chunk-P25HBGP5.mjs.map +0 -1
- package/dist/chunk-P563HTVU.js +0 -164
- package/dist/chunk-P563HTVU.js.map +0 -1
- package/dist/chunk-P7CHGWY7.js +0 -4
- package/dist/chunk-P7CHGWY7.js.map +0 -1
- package/dist/chunk-PGYTMRP3.js +0 -277
- package/dist/chunk-PGYTMRP3.js.map +0 -1
- package/dist/chunk-QAPQGDWK.js +0 -8
- package/dist/chunk-QAPQGDWK.js.map +0 -1
- package/dist/chunk-QHBKRUBY.mjs +0 -328
- package/dist/chunk-QHBKRUBY.mjs.map +0 -1
- package/dist/chunk-QOYI7WCH.js +0 -120
- package/dist/chunk-QOYI7WCH.js.map +0 -1
- package/dist/chunk-QRTABC4Z.js +0 -8
- package/dist/chunk-QRTABC4Z.js.map +0 -1
- package/dist/chunk-QSQGLWNY.mjs +0 -3
- package/dist/chunk-QSQGLWNY.mjs.map +0 -1
- package/dist/chunk-QUBD6HUZ.mjs +0 -735
- package/dist/chunk-QUBD6HUZ.mjs.map +0 -1
- package/dist/chunk-RDTIXP6S.mjs +0 -263
- package/dist/chunk-RDTIXP6S.mjs.map +0 -1
- package/dist/chunk-RLOZWHRR.js +0 -320
- package/dist/chunk-RLOZWHRR.js.map +0 -1
- package/dist/chunk-RV64M4Q6.mjs +0 -3
- package/dist/chunk-RV64M4Q6.mjs.map +0 -1
- package/dist/chunk-SWWLOD7Q.mjs +0 -6
- package/dist/chunk-SWWLOD7Q.mjs.map +0 -1
- package/dist/chunk-T3UA4MJL.js +0 -4
- package/dist/chunk-T3UA4MJL.js.map +0 -1
- package/dist/chunk-TEWAXP5C.mjs +0 -162
- package/dist/chunk-TEWAXP5C.mjs.map +0 -1
- package/dist/chunk-THEIRDGE.mjs +0 -273
- package/dist/chunk-THEIRDGE.mjs.map +0 -1
- package/dist/chunk-U3GOWK6J.mjs +0 -6
- package/dist/chunk-U3GOWK6J.mjs.map +0 -1
- package/dist/chunk-UPVKABAV.js +0 -19
- package/dist/chunk-UPVKABAV.js.map +0 -1
- package/dist/chunk-VEIVYUYF.js +0 -4
- package/dist/chunk-VEIVYUYF.js.map +0 -1
- package/dist/chunk-VKSD3KXF.mjs +0 -275
- package/dist/chunk-VKSD3KXF.mjs.map +0 -1
- package/dist/chunk-VYSOAGRU.mjs +0 -6
- package/dist/chunk-VYSOAGRU.mjs.map +0 -1
- package/dist/chunk-WDC53TM7.mjs +0 -305
- package/dist/chunk-WDC53TM7.mjs.map +0 -1
- package/dist/chunk-WKWP42TD.mjs +0 -39
- package/dist/chunk-WKWP42TD.mjs.map +0 -1
- package/dist/chunk-WNUB3UTT.js +0 -241
- package/dist/chunk-WNUB3UTT.js.map +0 -1
- package/dist/chunk-WNWK2QMU.mjs +0 -375
- package/dist/chunk-WNWK2QMU.mjs.map +0 -1
- package/dist/chunk-WQHTNL5L.js +0 -4
- package/dist/chunk-WQHTNL5L.js.map +0 -1
- package/dist/chunk-WZF5XNBC.js +0 -297
- package/dist/chunk-WZF5XNBC.js.map +0 -1
- package/dist/chunk-X3UMAHOJ.js +0 -4
- package/dist/chunk-X3UMAHOJ.js.map +0 -1
- package/dist/chunk-XMFOZYNI.js +0 -8
- package/dist/chunk-XMFOZYNI.js.map +0 -1
- package/dist/chunk-XNMXN5SZ.mjs +0 -3
- package/dist/chunk-XNMXN5SZ.mjs.map +0 -1
- package/dist/chunk-XSJTASPK.js +0 -13
- package/dist/chunk-XSJTASPK.js.map +0 -1
- package/dist/chunk-YBK6EBA5.mjs +0 -239
- package/dist/chunk-YBK6EBA5.mjs.map +0 -1
- package/dist/chunk-YYLD3AJ7.js +0 -61
- package/dist/chunk-YYLD3AJ7.js.map +0 -1
- package/dist/chunk-ZEDJUNC6.mjs +0 -115
- package/dist/chunk-ZEDJUNC6.mjs.map +0 -1
- package/dist/constants.d.mts +0 -91
- package/dist/constants.d.ts +0 -91
- package/dist/constants.js +0 -196
- package/dist/constants.js.map +0 -1
- package/dist/constants.mjs +0 -3
- package/dist/constants.mjs.map +0 -1
- package/dist/deployments.generated.d.mts +0 -275
- package/dist/deployments.generated.d.ts +0 -275
- package/dist/deployments.generated.js +0 -12
- package/dist/deployments.generated.js.map +0 -1
- package/dist/deployments.generated.mjs +0 -3
- package/dist/deployments.generated.mjs.map +0 -1
- package/dist/entities/DopplerFactory.d.mts +0 -272
- package/dist/entities/DopplerFactory.d.ts +0 -272
- package/dist/entities/DopplerFactory.js +0 -34
- package/dist/entities/DopplerFactory.js.map +0 -1
- package/dist/entities/DopplerFactory.mjs +0 -25
- package/dist/entities/DopplerFactory.mjs.map +0 -1
- package/dist/entities/auction/DynamicAuction.d.mts +0 -72
- package/dist/entities/auction/DynamicAuction.d.ts +0 -72
- package/dist/entities/auction/DynamicAuction.js +0 -21
- package/dist/entities/auction/DynamicAuction.js.map +0 -1
- package/dist/entities/auction/DynamicAuction.mjs +0 -12
- package/dist/entities/auction/DynamicAuction.mjs.map +0 -1
- package/dist/entities/auction/MulticurvePool.d.mts +0 -78
- package/dist/entities/auction/MulticurvePool.d.ts +0 -78
- package/dist/entities/auction/MulticurvePool.js +0 -24
- package/dist/entities/auction/MulticurvePool.js.map +0 -1
- package/dist/entities/auction/MulticurvePool.mjs +0 -15
- package/dist/entities/auction/MulticurvePool.mjs.map +0 -1
- package/dist/entities/auction/RehypeDopplerHook.d.mts +0 -57
- package/dist/entities/auction/RehypeDopplerHook.d.ts +0 -57
- package/dist/entities/auction/RehypeDopplerHook.js +0 -34
- package/dist/entities/auction/RehypeDopplerHook.js.map +0 -1
- package/dist/entities/auction/RehypeDopplerHook.mjs +0 -25
- package/dist/entities/auction/RehypeDopplerHook.mjs.map +0 -1
- package/dist/entities/auction/RehypeDopplerHookMigrator.d.mts +0 -48
- package/dist/entities/auction/RehypeDopplerHookMigrator.d.ts +0 -48
- package/dist/entities/auction/RehypeDopplerHookMigrator.js +0 -34
- package/dist/entities/auction/RehypeDopplerHookMigrator.js.map +0 -1
- package/dist/entities/auction/RehypeDopplerHookMigrator.mjs +0 -25
- package/dist/entities/auction/RehypeDopplerHookMigrator.mjs.map +0 -1
- package/dist/entities/auction/StaticAuction.d.mts +0 -44
- package/dist/entities/auction/StaticAuction.d.ts +0 -44
- package/dist/entities/auction/StaticAuction.js +0 -21
- package/dist/entities/auction/StaticAuction.js.map +0 -1
- package/dist/entities/auction/StaticAuction.mjs +0 -12
- package/dist/entities/auction/StaticAuction.mjs.map +0 -1
- package/dist/entities/auction/index.d.mts +0 -9
- package/dist/entities/auction/index.d.ts +0 -9
- package/dist/entities/auction/index.js +0 -55
- package/dist/entities/auction/index.js.map +0 -1
- package/dist/entities/auction/index.mjs +0 -30
- package/dist/entities/auction/index.mjs.map +0 -1
- package/dist/entities/quoter/Quoter.d.mts +0 -150
- package/dist/entities/quoter/Quoter.d.ts +0 -150
- package/dist/entities/quoter/Quoter.js +0 -21
- package/dist/entities/quoter/Quoter.js.map +0 -1
- package/dist/entities/quoter/Quoter.mjs +0 -12
- package/dist/entities/quoter/Quoter.mjs.map +0 -1
- package/dist/entities/quoter/index.d.mts +0 -5
- package/dist/entities/quoter/index.d.ts +0 -5
- package/dist/entities/quoter/index.js +0 -22
- package/dist/entities/quoter/index.js.map +0 -1
- package/dist/entities/quoter/index.mjs +0 -13
- package/dist/entities/quoter/index.mjs.map +0 -1
- package/dist/entities/token/derc20/Derc20.d.mts +0 -102
- package/dist/entities/token/derc20/Derc20.d.ts +0 -102
- package/dist/entities/token/derc20/Derc20.js +0 -19
- package/dist/entities/token/derc20/Derc20.js.map +0 -1
- package/dist/entities/token/derc20/Derc20.mjs +0 -10
- package/dist/entities/token/derc20/Derc20.mjs.map +0 -1
- package/dist/entities/token/derc20/index.d.mts +0 -5
- package/dist/entities/token/derc20/index.d.ts +0 -5
- package/dist/entities/token/derc20/index.js +0 -20
- package/dist/entities/token/derc20/index.js.map +0 -1
- package/dist/entities/token/derc20/index.mjs +0 -11
- package/dist/entities/token/derc20/index.mjs.map +0 -1
- package/dist/entities/token/eth/Eth.d.mts +0 -54
- package/dist/entities/token/eth/Eth.d.ts +0 -54
- package/dist/entities/token/eth/Eth.js +0 -12
- package/dist/entities/token/eth/Eth.js.map +0 -1
- package/dist/entities/token/eth/Eth.mjs +0 -3
- package/dist/entities/token/eth/Eth.mjs.map +0 -1
- package/dist/entities/token/eth/index.d.mts +0 -5
- package/dist/entities/token/eth/index.d.ts +0 -5
- package/dist/entities/token/eth/index.js +0 -13
- package/dist/entities/token/eth/index.js.map +0 -1
- package/dist/entities/token/eth/index.mjs +0 -4
- package/dist/entities/token/eth/index.mjs.map +0 -1
- package/dist/entities/token/index.d.mts +0 -6
- package/dist/entities/token/index.d.ts +0 -6
- package/dist/entities/token/index.js +0 -27
- package/dist/entities/token/index.js.map +0 -1
- package/dist/entities/token/index.mjs +0 -14
- package/dist/entities/token/index.mjs.map +0 -1
- package/dist/index.d.mts +0 -39
- package/dist/index.d.ts +0 -39
- package/dist/index.js +0 -587
- package/dist/index.js.map +0 -1
- package/dist/index.mjs +0 -49
- package/dist/index.mjs.map +0 -1
- package/dist/types.d.mts +0 -662
- package/dist/types.d.ts +0 -662
- package/dist/types.js +0 -34
- package/dist/types.js.map +0 -1
- package/dist/types.mjs +0 -5
- package/dist/types.mjs.map +0 -1
- package/dist/utils/airlock.d.mts +0 -11
- package/dist/utils/airlock.d.ts +0 -11
- package/dist/utils/airlock.js +0 -26
- package/dist/utils/airlock.js.map +0 -1
- package/dist/utils/airlock.mjs +0 -5
- package/dist/utils/airlock.mjs.map +0 -1
- package/dist/utils/balanceDelta.d.mts +0 -10
- package/dist/utils/balanceDelta.d.ts +0 -10
- package/dist/utils/balanceDelta.js +0 -12
- package/dist/utils/balanceDelta.js.map +0 -1
- package/dist/utils/balanceDelta.mjs +0 -3
- package/dist/utils/balanceDelta.mjs.map +0 -1
- package/dist/utils/computeOptimalGamma.d.mts +0 -7
- package/dist/utils/computeOptimalGamma.d.ts +0 -7
- package/dist/utils/computeOptimalGamma.js +0 -12
- package/dist/utils/computeOptimalGamma.js.map +0 -1
- package/dist/utils/computeOptimalGamma.mjs +0 -3
- package/dist/utils/computeOptimalGamma.mjs.map +0 -1
- package/dist/utils/dopplerHookMigrator.d.mts +0 -18
- package/dist/utils/dopplerHookMigrator.d.ts +0 -18
- package/dist/utils/dopplerHookMigrator.js +0 -20
- package/dist/utils/dopplerHookMigrator.js.map +0 -1
- package/dist/utils/dopplerHookMigrator.mjs +0 -7
- package/dist/utils/dopplerHookMigrator.mjs.map +0 -1
- package/dist/utils/index.d.mts +0 -14
- package/dist/utils/index.d.ts +0 -14
- package/dist/utils/index.js +0 -197
- package/dist/utils/index.js.map +0 -1
- package/dist/utils/index.mjs +0 -24
- package/dist/utils/index.mjs.map +0 -1
- package/dist/utils/isToken0Expected.d.mts +0 -13
- package/dist/utils/isToken0Expected.d.ts +0 -13
- package/dist/utils/isToken0Expected.js +0 -12
- package/dist/utils/isToken0Expected.js.map +0 -1
- package/dist/utils/isToken0Expected.mjs +0 -3
- package/dist/utils/isToken0Expected.mjs.map +0 -1
- package/dist/utils/marketCapHelpers.d.mts +0 -259
- package/dist/utils/marketCapHelpers.d.ts +0 -259
- package/dist/utils/marketCapHelpers.js +0 -58
- package/dist/utils/marketCapHelpers.js.map +0 -1
- package/dist/utils/marketCapHelpers.mjs +0 -5
- package/dist/utils/marketCapHelpers.mjs.map +0 -1
- package/dist/utils/poolKey.d.mts +0 -17
- package/dist/utils/poolKey.d.ts +0 -17
- package/dist/utils/poolKey.js +0 -12
- package/dist/utils/poolKey.js.map +0 -1
- package/dist/utils/poolKey.mjs +0 -3
- package/dist/utils/poolKey.mjs.map +0 -1
- package/dist/utils/priceHelpers.d.mts +0 -86
- package/dist/utils/priceHelpers.d.ts +0 -86
- package/dist/utils/priceHelpers.js +0 -41
- package/dist/utils/priceHelpers.js.map +0 -1
- package/dist/utils/priceHelpers.mjs +0 -4
- package/dist/utils/priceHelpers.mjs.map +0 -1
- package/dist/utils/tickMath.d.mts +0 -72
- package/dist/utils/tickMath.d.ts +0 -72
- package/dist/utils/tickMath.js +0 -60
- package/dist/utils/tickMath.js.map +0 -1
- package/dist/utils/tickMath.mjs +0 -3
- package/dist/utils/tickMath.mjs.map +0 -1
- package/dist/utils/tokenAddressMiner.d.mts +0 -37
- package/dist/utils/tokenAddressMiner.d.ts +0 -37
- package/dist/utils/tokenAddressMiner.js +0 -19
- package/dist/utils/tokenAddressMiner.js.map +0 -1
- package/dist/utils/tokenAddressMiner.mjs +0 -10
- package/dist/utils/tokenAddressMiner.mjs.map +0 -1
|
@@ -0,0 +1,2495 @@
|
|
|
1
|
+
import { Address, ReadonlyUint8Array, ProgramDerivedAddress, Instruction, TransactionSigner, Rpc, GetAccountInfoApi, FixedSizeDecoder, FixedSizeEncoder, FixedSizeCodec, Encoder, Decoder, Codec, OptionOrNullable, Option } from '@solana/kit';
|
|
2
|
+
import { A as AmmConfig, P as Pool, a as Position, O as OracleState, S as SwapDirection, b as SwapQuote, c as AddLiquidityQuote, R as RemoveLiquidityQuote, M as MarketCapValidationResult, d as MarketCapToCurveParamsInput, C as CurveParams, e as CurveParamsToMarketCapInput, I as InitializeConfigArgs$1, f as InitializePoolArgs, g as InitializeOracleArgs, h as SetFeesArgs, i as SetSentinelArgs, j as SetRouteArgs, T as TransferAdminArgs, k as SwapExactInArgs, l as CreatePositionArgs, m as AddLiquidityArgs, n as RemoveLiquidityArgs, o as CollectFeesArgs, p as CollectProtocolFeesArgs, q as OracleConsultArgs, Q as QuoteToNumeraireArgs, G as GetProgramAccountsRpc } from '../oracle-BSvZ6pxp.js';
|
|
3
|
+
export { u as AddLiquidityEvent, N as AdminTransferredEvent, w as CollectFeesEvent, x as CollectProtocolFeesEvent, H as FeesUpdatedEvent, ab as FetchOracleConfig, a9 as FetchPositionsConfig, r as Observation, J as OracleInitializedEvent, K as OracleUpdatedEvent, ac as OracleWithAddress, U as PausedEvent, y as PoolInitializedEvent, B as PositionClosedEvent, z as PositionCreatedEvent, a8 as PositionValue, aa as PositionWithAddress, v as RemoveLiquidityEvent, L as RouteUpdatedEvent, E as SentinelErrorEvent, D as SentinelInvokedEvent, F as SentinelUpdatedEvent, W as SkimmedEvent, t as SwapEvent, s as TwapResult, V as UnpausedEvent, aj as comparePoolAndOraclePrices, a3 as consultTwap, a1 as fetchOracle, ai as fetchOraclesBatch, _ as fetchPoolPositions, X as fetchPosition, $ as fetchPositionByParams, a0 as fetchPositionsBatch, Y as fetchUserPositions, ae as filterActivePositions, ag as getOracleAddressFromPool, ah as getOracleAge, a7 as getOracleBufferStats, a5 as getOracleDeviation, a2 as getOracleForPool, a4 as getOracleSpotPrices, ad as getPositionAddressFromParams, Z as getPositionValue, a6 as isOracleStale, af as sortPositionsByShares } from '../oracle-BSvZ6pxp.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Program ID for the CPMM AMM (deployed to devnet)
|
|
7
|
+
*/
|
|
8
|
+
declare const PROGRAM_ID: Address;
|
|
9
|
+
/**
|
|
10
|
+
* Program ID for the Sentinel program (deployed to devnet)
|
|
11
|
+
*/
|
|
12
|
+
declare const SENTINEL_PROGRAM_ID: Address;
|
|
13
|
+
/**
|
|
14
|
+
* SPL Token Program ID
|
|
15
|
+
*/
|
|
16
|
+
declare const TOKEN_PROGRAM_ID: Address;
|
|
17
|
+
/**
|
|
18
|
+
* Metaplex Token Metadata Program ID
|
|
19
|
+
*/
|
|
20
|
+
declare const TOKEN_METADATA_PROGRAM_ID: Address;
|
|
21
|
+
/**
|
|
22
|
+
* System Program ID
|
|
23
|
+
*/
|
|
24
|
+
declare const SYSTEM_PROGRAM_ID: Address;
|
|
25
|
+
/** Basis points denominator (10,000 = 100%) */
|
|
26
|
+
declare const BPS_DENOM = 10000n;
|
|
27
|
+
/** Q64.64 fixed-point representation of 1.0 (2^64) */
|
|
28
|
+
declare const Q64_ONE: bigint;
|
|
29
|
+
/** Current account version */
|
|
30
|
+
declare const ACCOUNT_VERSION = 1;
|
|
31
|
+
/** Maximum number of programs in sentinel allowlist */
|
|
32
|
+
declare const MAX_SENTINEL_ALLOWLIST$1 = 32;
|
|
33
|
+
/** Maximum number of oracle observations (TWAP buffer size) */
|
|
34
|
+
declare const MAX_ORACLE_OBSERVATIONS = 64;
|
|
35
|
+
/** Seed for AmmConfig PDA: ['config'] */
|
|
36
|
+
declare const SEED_CONFIG$1 = "config";
|
|
37
|
+
/** Seed prefix for Pool PDA: ['pool', token0_mint, token1_mint] */
|
|
38
|
+
declare const SEED_POOL = "pool";
|
|
39
|
+
/** Seed prefix for pool authority PDA: ['authority', pool] */
|
|
40
|
+
declare const SEED_AUTHORITY = "authority";
|
|
41
|
+
/** Seed prefix for Position PDA: ['position', pool, owner, position_id] */
|
|
42
|
+
declare const SEED_POSITION = "position";
|
|
43
|
+
/** Seed prefix for OracleState PDA: ['oracle', pool] */
|
|
44
|
+
declare const SEED_ORACLE = "oracle";
|
|
45
|
+
/** Seed prefix for protocol position PDA: ['protocol_position', pool] */
|
|
46
|
+
declare const SEED_PROTOCOL_POSITION = "protocol_position";
|
|
47
|
+
/** Sentinel hook: called before swap */
|
|
48
|
+
declare const SF_BEFORE_SWAP$1: number;
|
|
49
|
+
/** Sentinel hook: called after swap */
|
|
50
|
+
declare const SF_AFTER_SWAP$1: number;
|
|
51
|
+
/** Sentinel hook: called before add liquidity */
|
|
52
|
+
declare const SF_BEFORE_ADD_LIQ: number;
|
|
53
|
+
/** Sentinel hook: called after add liquidity */
|
|
54
|
+
declare const SF_AFTER_ADD_LIQ: number;
|
|
55
|
+
/** Sentinel hook: called before remove liquidity */
|
|
56
|
+
declare const SF_BEFORE_REMOVE_LIQ: number;
|
|
57
|
+
/** Sentinel hook: called after remove liquidity */
|
|
58
|
+
declare const SF_AFTER_REMOVE_LIQ: number;
|
|
59
|
+
/** Sentinel return value indicating "no change" to fee parameter */
|
|
60
|
+
declare const SENTINEL_NO_CHANGE$1 = 65535;
|
|
61
|
+
/** Account is read-only (not writable, not signer) */
|
|
62
|
+
declare const ACCOUNT_ROLE_READONLY = 0;
|
|
63
|
+
/** Account is writable (not signer) */
|
|
64
|
+
declare const ACCOUNT_ROLE_WRITABLE = 1;
|
|
65
|
+
/** Account is a signer (not writable) */
|
|
66
|
+
declare const ACCOUNT_ROLE_SIGNER = 2;
|
|
67
|
+
/** Account is both writable and a signer */
|
|
68
|
+
declare const ACCOUNT_ROLE_WRITABLE_SIGNER = 3;
|
|
69
|
+
/**
|
|
70
|
+
* Anchor instruction discriminator (first 8 bytes of SHA256("global:<instruction_name>"))
|
|
71
|
+
* These are computed at build time from the instruction names.
|
|
72
|
+
*/
|
|
73
|
+
declare const INSTRUCTION_DISCRIMINATORS: {
|
|
74
|
+
readonly initializeConfig: Uint8Array<ArrayBuffer>;
|
|
75
|
+
readonly initializePool: Uint8Array<ArrayBuffer>;
|
|
76
|
+
readonly initializeOracle: Uint8Array<ArrayBuffer>;
|
|
77
|
+
readonly createPosition: Uint8Array<ArrayBuffer>;
|
|
78
|
+
readonly addLiquidity: Uint8Array<ArrayBuffer>;
|
|
79
|
+
readonly removeLiquidity: Uint8Array<ArrayBuffer>;
|
|
80
|
+
readonly swapExactIn: Uint8Array<ArrayBuffer>;
|
|
81
|
+
readonly collectFees: Uint8Array<ArrayBuffer>;
|
|
82
|
+
readonly collectProtocolFees: Uint8Array<ArrayBuffer>;
|
|
83
|
+
readonly closePosition: Uint8Array<ArrayBuffer>;
|
|
84
|
+
readonly oracleUpdate: Uint8Array<ArrayBuffer>;
|
|
85
|
+
readonly oracleConsult: Uint8Array<ArrayBuffer>;
|
|
86
|
+
readonly quoteToNumeraire: Uint8Array<ArrayBuffer>;
|
|
87
|
+
readonly setSentinel: Uint8Array<ArrayBuffer>;
|
|
88
|
+
readonly setFees: Uint8Array<ArrayBuffer>;
|
|
89
|
+
readonly setRoute: Uint8Array<ArrayBuffer>;
|
|
90
|
+
readonly transferAdmin: Uint8Array<ArrayBuffer>;
|
|
91
|
+
readonly pause: Uint8Array<ArrayBuffer>;
|
|
92
|
+
readonly unpause: Uint8Array<ArrayBuffer>;
|
|
93
|
+
readonly skim: Uint8Array<ArrayBuffer>;
|
|
94
|
+
};
|
|
95
|
+
/**
|
|
96
|
+
* Anchor account discriminator (first 8 bytes of SHA256("account:<AccountName>"))
|
|
97
|
+
*/
|
|
98
|
+
declare const ACCOUNT_DISCRIMINATORS: {
|
|
99
|
+
readonly AmmConfig: Uint8Array<ArrayBuffer>;
|
|
100
|
+
readonly Pool: Uint8Array<ArrayBuffer>;
|
|
101
|
+
readonly Position: Uint8Array<ArrayBuffer>;
|
|
102
|
+
readonly OracleState: Uint8Array<ArrayBuffer>;
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Borsh serialization/deserialization for CPMM accounts and instructions
|
|
107
|
+
*
|
|
108
|
+
* This module provides encoding/decoding utilities for program accounts
|
|
109
|
+
* and instruction data using Borsh-compatible binary formats.
|
|
110
|
+
*/
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Decode AmmConfig from raw account data (including discriminator)
|
|
114
|
+
*/
|
|
115
|
+
declare function decodeAmmConfig(data: ReadonlyUint8Array): AmmConfig;
|
|
116
|
+
/**
|
|
117
|
+
* Decode Pool from raw account data (including discriminator)
|
|
118
|
+
*/
|
|
119
|
+
declare function decodePool(data: ReadonlyUint8Array): Pool;
|
|
120
|
+
/**
|
|
121
|
+
* Decode Position from raw account data (including discriminator)
|
|
122
|
+
*/
|
|
123
|
+
declare function decodePosition(data: ReadonlyUint8Array): Position;
|
|
124
|
+
/**
|
|
125
|
+
* Decode OracleState from raw account data (including discriminator)
|
|
126
|
+
*/
|
|
127
|
+
declare function decodeOracleState(data: ReadonlyUint8Array): OracleState;
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* Sort two mints into canonical order (token0 < token1 by bytes)
|
|
131
|
+
* This is required for Pool PDA derivation and instruction ordering.
|
|
132
|
+
*
|
|
133
|
+
* @param mintA - First mint address
|
|
134
|
+
* @param mintB - Second mint address
|
|
135
|
+
* @returns Tuple of [token0, token1] in canonical order
|
|
136
|
+
* @throws Error if mints are equal
|
|
137
|
+
*/
|
|
138
|
+
declare function sortMints(mintA: Address, mintB: Address): [Address, Address];
|
|
139
|
+
/**
|
|
140
|
+
* Check if mints are in canonical order
|
|
141
|
+
*/
|
|
142
|
+
declare function areMintsOrdered(mint0: Address, mint1: Address): boolean;
|
|
143
|
+
/**
|
|
144
|
+
* Derive the AmmConfig PDA address
|
|
145
|
+
* Seeds: ['config']
|
|
146
|
+
*/
|
|
147
|
+
declare function getConfigAddress$1(programId?: Address): Promise<ProgramDerivedAddress>;
|
|
148
|
+
/**
|
|
149
|
+
* Derive the Pool PDA address for a token pair
|
|
150
|
+
* Seeds: ['pool', token0_mint, token1_mint]
|
|
151
|
+
*
|
|
152
|
+
* Note: Mints will be automatically sorted if not in canonical order.
|
|
153
|
+
*/
|
|
154
|
+
declare function getPoolAddress(mintA: Address, mintB: Address, programId?: Address): Promise<ProgramDerivedAddress>;
|
|
155
|
+
/**
|
|
156
|
+
* Derive the Pool authority PDA (vault owner)
|
|
157
|
+
* Seeds: ['authority', pool]
|
|
158
|
+
*/
|
|
159
|
+
declare function getPoolAuthorityAddress(pool: Address, programId?: Address): Promise<ProgramDerivedAddress>;
|
|
160
|
+
/**
|
|
161
|
+
* Derive the Position PDA address
|
|
162
|
+
* Seeds: ['position', pool, owner, position_id_le_bytes]
|
|
163
|
+
*/
|
|
164
|
+
declare function getPositionAddress(pool: Address, owner: Address, positionId: bigint, programId?: Address): Promise<ProgramDerivedAddress>;
|
|
165
|
+
/**
|
|
166
|
+
* Derive the OracleState PDA address
|
|
167
|
+
* Seeds: ['oracle', pool]
|
|
168
|
+
*/
|
|
169
|
+
declare function getOracleAddress(pool: Address, programId?: Address): Promise<ProgramDerivedAddress>;
|
|
170
|
+
/**
|
|
171
|
+
* Derive the Protocol Position PDA address
|
|
172
|
+
* Seeds: ['protocol_position', pool]
|
|
173
|
+
*/
|
|
174
|
+
declare function getProtocolPositionAddress(pool: Address, programId?: Address): Promise<ProgramDerivedAddress>;
|
|
175
|
+
/**
|
|
176
|
+
* Derive all PDAs needed for pool initialization
|
|
177
|
+
*/
|
|
178
|
+
declare function getPoolInitAddresses(mintA: Address, mintB: Address, programId?: Address): Promise<{
|
|
179
|
+
token0: Address;
|
|
180
|
+
token1: Address;
|
|
181
|
+
pool: ProgramDerivedAddress;
|
|
182
|
+
authority: ProgramDerivedAddress;
|
|
183
|
+
config: ProgramDerivedAddress;
|
|
184
|
+
protocolPosition: ProgramDerivedAddress;
|
|
185
|
+
}>;
|
|
186
|
+
/**
|
|
187
|
+
* Derive all PDAs needed for swap operation
|
|
188
|
+
*/
|
|
189
|
+
declare function getSwapAddresses(pool: Address, programId?: Address): Promise<{
|
|
190
|
+
config: ProgramDerivedAddress;
|
|
191
|
+
authority: ProgramDerivedAddress;
|
|
192
|
+
oracle: ProgramDerivedAddress;
|
|
193
|
+
}>;
|
|
194
|
+
/**
|
|
195
|
+
* Derive all PDAs needed for liquidity operations
|
|
196
|
+
*/
|
|
197
|
+
declare function getLiquidityAddresses(pool: Address, owner: Address, positionId: bigint, programId?: Address): Promise<{
|
|
198
|
+
config: ProgramDerivedAddress;
|
|
199
|
+
authority: ProgramDerivedAddress;
|
|
200
|
+
position: ProgramDerivedAddress;
|
|
201
|
+
protocolPosition: ProgramDerivedAddress;
|
|
202
|
+
oracle: ProgramDerivedAddress;
|
|
203
|
+
}>;
|
|
204
|
+
|
|
205
|
+
/**
|
|
206
|
+
* Derive Metaplex Token Metadata PDA for a given mint.
|
|
207
|
+
*
|
|
208
|
+
* Seeds: ['metadata', token_metadata_program_id, mint]
|
|
209
|
+
*/
|
|
210
|
+
declare function getMetadataAddress(mint: Address): Promise<ProgramDerivedAddress>;
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* Convert a Q64.64 fixed-point number to a decimal number
|
|
214
|
+
*/
|
|
215
|
+
declare function q64ToNumber(q64: bigint): number;
|
|
216
|
+
/**
|
|
217
|
+
* Convert a decimal number to Q64.64 fixed-point
|
|
218
|
+
*/
|
|
219
|
+
declare function numberToQ64(n: number): bigint;
|
|
220
|
+
/**
|
|
221
|
+
* Multiply two Q64.64 numbers, returning Q64.64 result
|
|
222
|
+
*/
|
|
223
|
+
declare function q64Mul(a: bigint, b: bigint): bigint;
|
|
224
|
+
/**
|
|
225
|
+
* Divide two Q64.64 numbers, returning Q64.64 result
|
|
226
|
+
*/
|
|
227
|
+
declare function q64Div(a: bigint, b: bigint): bigint;
|
|
228
|
+
/**
|
|
229
|
+
* Compute spot price (reserve1/reserve0) as Q64.64
|
|
230
|
+
* Price of token0 denominated in token1
|
|
231
|
+
*/
|
|
232
|
+
declare function computePrice0Q64(reserve0: bigint, reserve1: bigint): bigint;
|
|
233
|
+
/**
|
|
234
|
+
* Compute spot price (reserve0/reserve1) as Q64.64
|
|
235
|
+
* Price of token1 denominated in token0
|
|
236
|
+
*/
|
|
237
|
+
declare function computePrice1Q64(reserve0: bigint, reserve1: bigint): bigint;
|
|
238
|
+
/**
|
|
239
|
+
* Integer square root (floor)
|
|
240
|
+
*/
|
|
241
|
+
declare function isqrt(n: bigint): bigint;
|
|
242
|
+
/**
|
|
243
|
+
* Ceiling division: ceil(a / b)
|
|
244
|
+
*/
|
|
245
|
+
declare function ceilDiv(a: bigint, b: bigint): bigint;
|
|
246
|
+
/**
|
|
247
|
+
* Minimum of two bigints
|
|
248
|
+
*/
|
|
249
|
+
declare function minBigInt(a: bigint, b: bigint): bigint;
|
|
250
|
+
/**
|
|
251
|
+
* Maximum of two bigints
|
|
252
|
+
*/
|
|
253
|
+
declare function maxBigInt(a: bigint, b: bigint): bigint;
|
|
254
|
+
/**
|
|
255
|
+
* Convert a ratio of two bigints to a decimal number using Q64.64 precision
|
|
256
|
+
*/
|
|
257
|
+
declare function ratioToNumber(numerator: bigint, denominator: bigint): number;
|
|
258
|
+
/**
|
|
259
|
+
* Calculate swap output and fees for exact input amount
|
|
260
|
+
*
|
|
261
|
+
* Fee calculation (from spec):
|
|
262
|
+
* - fee_total = floor(amount_in * fee_bps / 10_000)
|
|
263
|
+
* - fee_dist = floor(fee_total * split_bps / 10_000)
|
|
264
|
+
* - fee_comp = fee_total - fee_dist
|
|
265
|
+
* - amount_in_eff = amount_in - fee_total
|
|
266
|
+
*
|
|
267
|
+
* CPMM output:
|
|
268
|
+
* - amount_out = floor(amount_in_eff * reserve_out / (reserve_in + amount_in_eff))
|
|
269
|
+
*/
|
|
270
|
+
declare function getSwapQuote(pool: Pool, amountIn: bigint, direction: SwapDirection): SwapQuote;
|
|
271
|
+
/**
|
|
272
|
+
* Calculate input amount needed for exact output (reverse quote)
|
|
273
|
+
*/
|
|
274
|
+
declare function getSwapQuoteExactOut(pool: Pool, amountOut: bigint, direction: SwapDirection): {
|
|
275
|
+
amountIn: bigint;
|
|
276
|
+
feeTotal: bigint;
|
|
277
|
+
};
|
|
278
|
+
/**
|
|
279
|
+
* Calculate shares and actual amounts for adding liquidity
|
|
280
|
+
*
|
|
281
|
+
* From spec:
|
|
282
|
+
* - If initial: shares = floor_sqrt(amount0 * amount1)
|
|
283
|
+
* - Else: shares = min(amount0 * totalShares / reserve0, amount1 * totalShares / reserve1)
|
|
284
|
+
*/
|
|
285
|
+
declare function getAddLiquidityQuote(pool: Pool, amount0Max: bigint, amount1Max: bigint): AddLiquidityQuote;
|
|
286
|
+
/**
|
|
287
|
+
* Calculate token amounts for removing liquidity
|
|
288
|
+
*
|
|
289
|
+
* From spec:
|
|
290
|
+
* - amount0 = shares * reserve0 / totalShares
|
|
291
|
+
* - amount1 = shares * reserve1 / totalShares
|
|
292
|
+
*/
|
|
293
|
+
declare function getRemoveLiquidityQuote(pool: Pool, sharesIn: bigint): RemoveLiquidityQuote;
|
|
294
|
+
/**
|
|
295
|
+
* Calculate accrued fees for a position
|
|
296
|
+
*
|
|
297
|
+
* From spec:
|
|
298
|
+
* - delta = pool.fee_growth_global - position.fee_growth_last
|
|
299
|
+
* - owed_inc = floor(position.shares * delta / 2^64)
|
|
300
|
+
*/
|
|
301
|
+
declare function calculateAccruedFees(shares: bigint, feeGrowthLastQ64: bigint, feeGrowthGlobalQ64: bigint): bigint;
|
|
302
|
+
/**
|
|
303
|
+
* Calculate pending fees for a position (both tokens)
|
|
304
|
+
*/
|
|
305
|
+
declare function getPendingFees(pool: Pool, position: {
|
|
306
|
+
shares: bigint;
|
|
307
|
+
feeGrowthLast0Q64: bigint;
|
|
308
|
+
feeGrowthLast1Q64: bigint;
|
|
309
|
+
feeOwed0: bigint;
|
|
310
|
+
feeOwed1: bigint;
|
|
311
|
+
}): {
|
|
312
|
+
pending0: bigint;
|
|
313
|
+
pending1: bigint;
|
|
314
|
+
};
|
|
315
|
+
/**
|
|
316
|
+
* Calculate spot price of token0 in terms of token1
|
|
317
|
+
*/
|
|
318
|
+
declare function getSpotPrice0(pool: Pool): number;
|
|
319
|
+
/**
|
|
320
|
+
* Calculate spot price of token1 in terms of token0
|
|
321
|
+
*/
|
|
322
|
+
declare function getSpotPrice1(pool: Pool): number;
|
|
323
|
+
/**
|
|
324
|
+
* Calculate k (constant product invariant)
|
|
325
|
+
*/
|
|
326
|
+
declare function getK(pool: Pool): bigint;
|
|
327
|
+
/**
|
|
328
|
+
* Calculate pool TVL in terms of one token
|
|
329
|
+
* @param pool Pool data
|
|
330
|
+
* @param side 0 = denominate in token0, 1 = denominate in token1
|
|
331
|
+
*/
|
|
332
|
+
declare function getTvl(pool: Pool, side?: 0 | 1): bigint;
|
|
333
|
+
/**
|
|
334
|
+
* Calculate TWAP price from oracle observations
|
|
335
|
+
*
|
|
336
|
+
* TWAP = (cumulative_end - cumulative_start) / (timestamp_end - timestamp_start)
|
|
337
|
+
*/
|
|
338
|
+
declare function calculateTwap(cumulativeStart: bigint, cumulativeEnd: bigint, timestampStart: number, timestampEnd: number): bigint;
|
|
339
|
+
/**
|
|
340
|
+
* Calculate TWAP as a decimal number
|
|
341
|
+
*/
|
|
342
|
+
declare function calculateTwapNumber(cumulativeStart: bigint, cumulativeEnd: bigint, timestampStart: number, timestampEnd: number): number;
|
|
343
|
+
|
|
344
|
+
/**
|
|
345
|
+
* Market cap conversion utilities for Solana token launches.
|
|
346
|
+
*
|
|
347
|
+
* Converts between human-readable market cap values (USD) and the raw
|
|
348
|
+
* curve parameters used by the initializer program.
|
|
349
|
+
*
|
|
350
|
+
* For an XYK bonding curve the marginal spot price at any point is:
|
|
351
|
+
*
|
|
352
|
+
* spotPrice (quote/base, raw units) = (quoteReserve + curveVirtualQuote)
|
|
353
|
+
* / (baseReserve + curveVirtualBase)
|
|
354
|
+
*
|
|
355
|
+
* At launch open (quoteReserve = 0, baseReserve = baseForCurve):
|
|
356
|
+
*
|
|
357
|
+
* spotPrice = curveVirtualQuote / (baseForCurve + curveVirtualBase)
|
|
358
|
+
*
|
|
359
|
+
* Adjusted for decimals and numeraire price:
|
|
360
|
+
*
|
|
361
|
+
* spotPriceUSD = spotPrice * 10^(baseDecimals - quoteDecimals) * numerairePriceUSD
|
|
362
|
+
*
|
|
363
|
+
* Market cap (FDV) is then:
|
|
364
|
+
*
|
|
365
|
+
* marketCap = spotPriceUSD * (baseTotalSupply / 10^baseDecimals)
|
|
366
|
+
*/
|
|
367
|
+
|
|
368
|
+
/**
|
|
369
|
+
* Convert a market cap (USD) and total supply to a per-token price (USD).
|
|
370
|
+
*
|
|
371
|
+
* @example
|
|
372
|
+
* // $1M market cap, 1B tokens with 6 decimals
|
|
373
|
+
* marketCapToTokenPrice(1_000_000, 1_000_000_000n * 10n**6n, 6)
|
|
374
|
+
* // => 0.001
|
|
375
|
+
*/
|
|
376
|
+
declare function marketCapToTokenPrice(marketCapUSD: number, baseTotalSupply: bigint, baseDecimals: number): number;
|
|
377
|
+
/**
|
|
378
|
+
* Validate market cap parameters and return warnings for unusual values.
|
|
379
|
+
* Does not throw — callers can decide whether to surface warnings to users.
|
|
380
|
+
*
|
|
381
|
+
* @example
|
|
382
|
+
* const { valid, warnings } = validateMarketCapParameters(500, supply, 6);
|
|
383
|
+
* if (!valid) console.warn(warnings);
|
|
384
|
+
*/
|
|
385
|
+
declare function validateMarketCapParameters(marketCapUSD: number, baseTotalSupply: bigint, baseDecimals: number): MarketCapValidationResult;
|
|
386
|
+
/**
|
|
387
|
+
* Convert a market cap range (USD) to XYK curve virtual reserve parameters.
|
|
388
|
+
*
|
|
389
|
+
* Returns `{ curveVirtualBase, curveVirtualQuote }` for both the start (open)
|
|
390
|
+
* and end (graduation) prices, ready to pass into `InitializeLaunchArgs`.
|
|
391
|
+
*
|
|
392
|
+
* `baseForCurve` is the number of base tokens allocated to the curve vault
|
|
393
|
+
* (baseTotalSupply - baseForDistribution - baseForLiquidity). It determines
|
|
394
|
+
* the correct initial spot price alongside the virtual reserves.
|
|
395
|
+
*
|
|
396
|
+
* `virtualBase` defaults to `baseForCurve`. A larger value gives finer price
|
|
397
|
+
* granularity at the cost of a proportionally larger `curveVirtualQuote`.
|
|
398
|
+
*
|
|
399
|
+
* @example
|
|
400
|
+
* const totalSupply = 1_000_000_000n * 10n ** 6n;
|
|
401
|
+
* const { start, end } = marketCapToCurveParams({
|
|
402
|
+
* startMarketCapUSD: 100_000,
|
|
403
|
+
* endMarketCapUSD: 5_000_000,
|
|
404
|
+
* baseTotalSupply: totalSupply,
|
|
405
|
+
* baseForCurve: totalSupply, // no distribution or liquidity allocation
|
|
406
|
+
* baseDecimals: 6,
|
|
407
|
+
* quoteDecimals: 9, // SOL
|
|
408
|
+
* numerairePriceUSD: 150,
|
|
409
|
+
* });
|
|
410
|
+
* // Use start.curveVirtualBase / start.curveVirtualQuote in InitializeLaunchArgs
|
|
411
|
+
*/
|
|
412
|
+
declare function marketCapToCurveParams(input: MarketCapToCurveParamsInput): {
|
|
413
|
+
start: CurveParams;
|
|
414
|
+
end: CurveParams;
|
|
415
|
+
};
|
|
416
|
+
/**
|
|
417
|
+
* Convert a single market cap (USD) to XYK curve virtual reserve parameters.
|
|
418
|
+
* Use `marketCapToCurveParams` for a full start/end range.
|
|
419
|
+
*/
|
|
420
|
+
declare function marketCapToSingleCurveParams(marketCapUSD: number, baseTotalSupply: bigint, baseForCurve: bigint, baseDecimals: number, quoteDecimals: number, numerairePriceUSD: number, virtualBase?: bigint): CurveParams;
|
|
421
|
+
/**
|
|
422
|
+
* Derive the current market cap (USD) from live XYK curve state.
|
|
423
|
+
*
|
|
424
|
+
* Pass the virtual reserves from the `Launch` account and the current token
|
|
425
|
+
* vault balances (`baseReserve`, `quoteReserve`) to get the live spot price.
|
|
426
|
+
*
|
|
427
|
+
* @example
|
|
428
|
+
* const launch = await fetchLaunch(connection, launchAddress);
|
|
429
|
+
* const [baseVaultBalance, quoteVaultBalance] = await Promise.all([
|
|
430
|
+
* getTokenAccountBalance(connection, launch.baseVault),
|
|
431
|
+
* getTokenAccountBalance(connection, launch.quoteVault),
|
|
432
|
+
* ]);
|
|
433
|
+
* // baseReserve is the curve-available portion, excluding reserved allocations
|
|
434
|
+
* const baseReserve = baseVaultBalance - launch.baseForDistribution - launch.baseForLiquidity;
|
|
435
|
+
* const mcap = curveParamsToMarketCap({
|
|
436
|
+
* curveVirtualBase: launch.curveVirtualBase,
|
|
437
|
+
* curveVirtualQuote: launch.curveVirtualQuote,
|
|
438
|
+
* baseReserve,
|
|
439
|
+
* quoteReserve: quoteVaultBalance,
|
|
440
|
+
* baseTotalSupply: launch.baseTotalSupply,
|
|
441
|
+
* baseDecimals: 6,
|
|
442
|
+
* quoteDecimals: 9,
|
|
443
|
+
* numerairePriceUSD: 150,
|
|
444
|
+
* });
|
|
445
|
+
*/
|
|
446
|
+
declare function curveParamsToMarketCap(input: CurveParamsToMarketCapInput): number;
|
|
447
|
+
|
|
448
|
+
/**
|
|
449
|
+
* CPMM program error codes
|
|
450
|
+
*
|
|
451
|
+
* These correspond to the CpmmError enum in the on-chain program.
|
|
452
|
+
* Anchor errors start at 6000 (0x1770).
|
|
453
|
+
*/
|
|
454
|
+
declare enum CpmmErrorCode {
|
|
455
|
+
/** Unauthorized - caller lacks required authority */
|
|
456
|
+
Unauthorized = 6000,
|
|
457
|
+
/** Pool is currently locked (reentrancy protection) */
|
|
458
|
+
PoolLocked = 6001,
|
|
459
|
+
/** Invalid fee value (exceeds max or invalid range) */
|
|
460
|
+
InvalidFee = 6002,
|
|
461
|
+
/** Invalid fee split value (exceeds max or invalid range) */
|
|
462
|
+
InvalidFeeSplit = 6003,
|
|
463
|
+
/** Invalid swap direction (must be 0 or 1) */
|
|
464
|
+
InvalidDirection = 6004,
|
|
465
|
+
/** Insufficient liquidity for operation */
|
|
466
|
+
InsufficientLiquidity = 6005,
|
|
467
|
+
/** Output amount less than minimum (slippage exceeded) */
|
|
468
|
+
SlippageExceeded = 6006,
|
|
469
|
+
/** Math operation overflowed */
|
|
470
|
+
MathOverflow = 6007,
|
|
471
|
+
/** Mints not in canonical order */
|
|
472
|
+
InvalidMintOrder = 6008,
|
|
473
|
+
/** Cannot create pool with identical tokens */
|
|
474
|
+
SameMintPair = 6009,
|
|
475
|
+
/** Vault account invalid or mismatch */
|
|
476
|
+
InvalidVault = 6010,
|
|
477
|
+
/** Position account invalid or mismatch */
|
|
478
|
+
InvalidPosition = 6011,
|
|
479
|
+
/** Cannot close position with non-zero shares or fees */
|
|
480
|
+
PositionNotEmpty = 6012,
|
|
481
|
+
/** Invalid route configuration */
|
|
482
|
+
InvalidRoute = 6013,
|
|
483
|
+
/** Not supported in v0.1 */
|
|
484
|
+
NotSupportedInV0_1 = 6014,
|
|
485
|
+
/** Oracle not initialized for this pool */
|
|
486
|
+
OracleNotInitialized = 6015,
|
|
487
|
+
/** Zero shares out */
|
|
488
|
+
ZeroSharesOut = 6016,
|
|
489
|
+
/** Sentinel program rejected the operation */
|
|
490
|
+
SentinelRejected = 6017,
|
|
491
|
+
/** Sentinel CPI call failed */
|
|
492
|
+
SentinelCpiFailed = 6018,
|
|
493
|
+
/** Sentinel program account not provided */
|
|
494
|
+
SentinelProgramNotProvided = 6019,
|
|
495
|
+
/** Sentinel program account is not executable */
|
|
496
|
+
SentinelProgramNotExecutable = 6020,
|
|
497
|
+
/** Sentinel return data missing or wrong program id */
|
|
498
|
+
SentinelReturnDataMissing = 6021,
|
|
499
|
+
/** Sentinel return data invalid length or could not deserialize */
|
|
500
|
+
SentinelReturnDataInvalid = 6022,
|
|
501
|
+
/** Sentinel program not in allowlist */
|
|
502
|
+
SentinelNotAllowlisted = 6023,
|
|
503
|
+
/** Pool has zero shares (no liquidity) */
|
|
504
|
+
TotalSharesZero = 6024,
|
|
505
|
+
/** Amount cannot be zero */
|
|
506
|
+
AmountZero = 6025,
|
|
507
|
+
/** Pool is paused by admin */
|
|
508
|
+
Paused = 6026,
|
|
509
|
+
/** Internal invariant violation */
|
|
510
|
+
InvariantViolation = 6027,
|
|
511
|
+
/** Invalid mint address */
|
|
512
|
+
InvalidMint = 6028,
|
|
513
|
+
/** Invalid input parameter */
|
|
514
|
+
InvalidInput = 6029,
|
|
515
|
+
/** Reentrancy detected */
|
|
516
|
+
Reentrancy = 6030
|
|
517
|
+
}
|
|
518
|
+
/**
|
|
519
|
+
* Human-readable error messages
|
|
520
|
+
*/
|
|
521
|
+
declare const CPMM_ERROR_MESSAGES: Record<CpmmErrorCode, string>;
|
|
522
|
+
/**
|
|
523
|
+
* Custom error class for CPMM program errors
|
|
524
|
+
*/
|
|
525
|
+
declare class CpmmError extends Error {
|
|
526
|
+
readonly code: CpmmErrorCode;
|
|
527
|
+
readonly logs?: string[] | undefined;
|
|
528
|
+
constructor(code: CpmmErrorCode, logs?: string[] | undefined);
|
|
529
|
+
/**
|
|
530
|
+
* Get the error code name
|
|
531
|
+
*/
|
|
532
|
+
get codeName(): string;
|
|
533
|
+
}
|
|
534
|
+
/**
|
|
535
|
+
* Parse error code from transaction logs
|
|
536
|
+
*/
|
|
537
|
+
declare function parseErrorFromLogs(logs: string[]): CpmmError | null;
|
|
538
|
+
/**
|
|
539
|
+
* Check if an error code is a CPMM error
|
|
540
|
+
*/
|
|
541
|
+
declare function isCpmmError(code: number): code is CpmmErrorCode;
|
|
542
|
+
/**
|
|
543
|
+
* Get error message from code
|
|
544
|
+
*/
|
|
545
|
+
declare function getErrorMessage(code: number): string;
|
|
546
|
+
|
|
547
|
+
/**
|
|
548
|
+
* Accounts required for initialize_config instruction
|
|
549
|
+
*/
|
|
550
|
+
interface InitializeConfigAccounts$1 {
|
|
551
|
+
/** AmmConfig account to initialize (writable, PDA: ['config']) */
|
|
552
|
+
config: Address;
|
|
553
|
+
/** Payer for account creation (writable, signer) */
|
|
554
|
+
payer: Address;
|
|
555
|
+
/** System program */
|
|
556
|
+
systemProgram?: Address;
|
|
557
|
+
}
|
|
558
|
+
/**
|
|
559
|
+
* Create an initialize_config instruction
|
|
560
|
+
*
|
|
561
|
+
* Initializes the global AMM configuration singleton. This should only be called once
|
|
562
|
+
* per deployment to set up the admin, fees, and allowlist.
|
|
563
|
+
*
|
|
564
|
+
* @param accounts - Required accounts for initialization
|
|
565
|
+
* @param args - Instruction arguments (admin, numeraireMint, fees, allowlist)
|
|
566
|
+
* @param programId - Program ID (defaults to CPMM program)
|
|
567
|
+
* @returns Instruction to initialize the config
|
|
568
|
+
*
|
|
569
|
+
* @example
|
|
570
|
+
* ```ts
|
|
571
|
+
* const [configAddress] = await getConfigAddress();
|
|
572
|
+
* const ix = createInitializeConfigInstruction(
|
|
573
|
+
* {
|
|
574
|
+
* config: configAddress,
|
|
575
|
+
* payer: payerPublicKey,
|
|
576
|
+
* },
|
|
577
|
+
* {
|
|
578
|
+
* admin: adminPublicKey,
|
|
579
|
+
* numeraireMint: usdcMint,
|
|
580
|
+
* maxSwapFeeBps: 100,
|
|
581
|
+
* maxFeeSplitBps: 5000,
|
|
582
|
+
* maxRouteHops: 3,
|
|
583
|
+
* protocolFeeEnabled: true,
|
|
584
|
+
* protocolFeeBps: 500,
|
|
585
|
+
* sentinelAllowlist: [],
|
|
586
|
+
* }
|
|
587
|
+
* );
|
|
588
|
+
* ```
|
|
589
|
+
*/
|
|
590
|
+
declare function createInitializeConfigInstruction$1(accounts: InitializeConfigAccounts$1, args: InitializeConfigArgs$1, programId?: Address): Instruction;
|
|
591
|
+
|
|
592
|
+
/**
|
|
593
|
+
* Accounts required for initialize_pool instruction
|
|
594
|
+
*/
|
|
595
|
+
interface InitializePoolAccounts {
|
|
596
|
+
/** AmmConfig account (read-only) */
|
|
597
|
+
config: Address;
|
|
598
|
+
/** Pool account to initialize (writable, PDA: ['pool', token0_mint, token1_mint]) */
|
|
599
|
+
pool: Address;
|
|
600
|
+
/** Protocol position account (writable, PDA: ['protocol_position', pool]) */
|
|
601
|
+
protocolPosition: Address;
|
|
602
|
+
/** Pool authority PDA (read-only, PDA: ['authority', pool]) */
|
|
603
|
+
authority: Address;
|
|
604
|
+
/** Vault for token0 (writable signer - pass TransactionSigner to include signer in instruction) */
|
|
605
|
+
vault0: Address | TransactionSigner;
|
|
606
|
+
/** Vault for token1 (writable signer - pass TransactionSigner to include signer in instruction) */
|
|
607
|
+
vault1: Address | TransactionSigner;
|
|
608
|
+
/** Token0 mint (read-only, must be lexicographically smaller) */
|
|
609
|
+
token0Mint: Address;
|
|
610
|
+
/** Token1 mint (read-only, must be lexicographically larger) */
|
|
611
|
+
token1Mint: Address;
|
|
612
|
+
/** Payer for account creation (writable signer - pass TransactionSigner to include signer in instruction) */
|
|
613
|
+
payer: Address | TransactionSigner;
|
|
614
|
+
/** SPL Token program */
|
|
615
|
+
tokenProgram?: Address;
|
|
616
|
+
/** System program */
|
|
617
|
+
systemProgram?: Address;
|
|
618
|
+
/** Rent sysvar */
|
|
619
|
+
rent: Address;
|
|
620
|
+
}
|
|
621
|
+
/**
|
|
622
|
+
* Create an initialize_pool instruction
|
|
623
|
+
*
|
|
624
|
+
* Initializes a new trading pool for a token pair. The mints must be in canonical order
|
|
625
|
+
* (token0 < token1 by bytes). Use sortMints() to ensure proper ordering.
|
|
626
|
+
*
|
|
627
|
+
* @param accounts - Required accounts for pool initialization
|
|
628
|
+
* @param args - Instruction arguments (mintA, mintB, fees, liquidityMeasureSide, numeraire override)
|
|
629
|
+
* @param programId - Program ID (defaults to CPMM program)
|
|
630
|
+
* @returns Instruction to initialize the pool
|
|
631
|
+
*
|
|
632
|
+
* @example
|
|
633
|
+
* ```ts
|
|
634
|
+
* const addresses = await getPoolInitAddresses(mintA, mintB);
|
|
635
|
+
* const ix = createInitializePoolInstruction(
|
|
636
|
+
* {
|
|
637
|
+
* config: addresses.config[0],
|
|
638
|
+
* pool: addresses.pool[0],
|
|
639
|
+
* protocolPosition: addresses.protocolPosition[0],
|
|
640
|
+
* authority: addresses.authority[0],
|
|
641
|
+
* vault0: vault0Keypair.publicKey,
|
|
642
|
+
* vault1: vault1Keypair.publicKey,
|
|
643
|
+
* token0Mint: addresses.token0,
|
|
644
|
+
* token1Mint: addresses.token1,
|
|
645
|
+
* payer: payerPublicKey,
|
|
646
|
+
* rent: SYSVAR_RENT_PUBKEY,
|
|
647
|
+
* },
|
|
648
|
+
* {
|
|
649
|
+
* mintA: mintA,
|
|
650
|
+
* mintB: mintB,
|
|
651
|
+
* initialSwapFeeBps: 30,
|
|
652
|
+
* initialFeeSplitBps: 5000,
|
|
653
|
+
* liquidityMeasureSide: 0,
|
|
654
|
+
* numeraireMintOverride: null,
|
|
655
|
+
* }
|
|
656
|
+
* );
|
|
657
|
+
* ```
|
|
658
|
+
*/
|
|
659
|
+
declare function createInitializePoolInstruction(accounts: InitializePoolAccounts, args: InitializePoolArgs, programId?: Address): Instruction;
|
|
660
|
+
|
|
661
|
+
/**
|
|
662
|
+
* Accounts required for initialize_oracle instruction
|
|
663
|
+
*/
|
|
664
|
+
interface InitializeOracleAccounts {
|
|
665
|
+
/** AmmConfig account (read-only) */
|
|
666
|
+
config: Address;
|
|
667
|
+
/** Pool account (read-only) */
|
|
668
|
+
pool: Address;
|
|
669
|
+
/** Oracle PDA to initialize (writable, will be created) */
|
|
670
|
+
oracle: Address;
|
|
671
|
+
/** Admin authority (signer, must match config.admin) */
|
|
672
|
+
admin: Address;
|
|
673
|
+
/** Payer for account creation (signer, writable) */
|
|
674
|
+
payer: Address;
|
|
675
|
+
/** System program */
|
|
676
|
+
systemProgram?: Address;
|
|
677
|
+
}
|
|
678
|
+
/**
|
|
679
|
+
* Create an initialize_oracle instruction
|
|
680
|
+
*
|
|
681
|
+
* Initializes a TWAP oracle for a pool. The oracle tracks price movements
|
|
682
|
+
* and stores observations for time-weighted average price calculations.
|
|
683
|
+
*
|
|
684
|
+
* @param accounts - Required accounts for the instruction
|
|
685
|
+
* @param args - Instruction arguments (maxPriceChangeRatioQ64, observationIntervalSec, numObservations)
|
|
686
|
+
* @param programId - Program ID (defaults to CPMM program)
|
|
687
|
+
* @returns Instruction to initialize the oracle
|
|
688
|
+
*
|
|
689
|
+
* @example
|
|
690
|
+
* ```ts
|
|
691
|
+
* const ix = createInitializeOracleInstruction(
|
|
692
|
+
* {
|
|
693
|
+
* config: configAddress,
|
|
694
|
+
* pool: poolAddress,
|
|
695
|
+
* oracle: oracleAddress,
|
|
696
|
+
* admin: adminPublicKey,
|
|
697
|
+
* payer: payerPublicKey,
|
|
698
|
+
* },
|
|
699
|
+
* {
|
|
700
|
+
* maxPriceChangeRatioQ64: 1n << 64n, // 100% max change per slot
|
|
701
|
+
* observationIntervalSec: 60, // 1 minute between observations
|
|
702
|
+
* numObservations: 64, // Must be MAX_ORACLE_OBSERVATIONS
|
|
703
|
+
* }
|
|
704
|
+
* );
|
|
705
|
+
* ```
|
|
706
|
+
*/
|
|
707
|
+
declare function createInitializeOracleInstruction(accounts: InitializeOracleAccounts, args: InitializeOracleArgs, programId?: Address): Instruction;
|
|
708
|
+
|
|
709
|
+
/**
|
|
710
|
+
* Accounts required for set_fees instruction
|
|
711
|
+
*/
|
|
712
|
+
interface SetFeesAccounts {
|
|
713
|
+
/** AmmConfig account (read-only) */
|
|
714
|
+
config: Address;
|
|
715
|
+
/** Pool account (writable) */
|
|
716
|
+
pool: Address;
|
|
717
|
+
/** Admin authority (signer, must match config.admin) */
|
|
718
|
+
admin: Address;
|
|
719
|
+
}
|
|
720
|
+
/**
|
|
721
|
+
* Create a set_fees instruction
|
|
722
|
+
*
|
|
723
|
+
* Admin instruction to update the swap fee and fee split on a pool.
|
|
724
|
+
* Fees will be clamped to the config's max values.
|
|
725
|
+
*
|
|
726
|
+
* @param accounts - Required accounts for setting fees
|
|
727
|
+
* @param args - Instruction arguments (swapFeeBps, feeSplitBps)
|
|
728
|
+
* @param programId - Program ID (defaults to CPMM program)
|
|
729
|
+
* @returns Instruction to set fees
|
|
730
|
+
*
|
|
731
|
+
* @example
|
|
732
|
+
* ```ts
|
|
733
|
+
* const ix = createSetFeesInstruction(
|
|
734
|
+
* {
|
|
735
|
+
* config: configAddress,
|
|
736
|
+
* pool: poolAddress,
|
|
737
|
+
* admin: adminPublicKey,
|
|
738
|
+
* },
|
|
739
|
+
* {
|
|
740
|
+
* swapFeeBps: 30, // 0.30% swap fee
|
|
741
|
+
* feeSplitBps: 5000, // 50% of fees go to LPs (distributable)
|
|
742
|
+
* }
|
|
743
|
+
* );
|
|
744
|
+
* ```
|
|
745
|
+
*/
|
|
746
|
+
declare function createSetFeesInstruction(accounts: SetFeesAccounts, args: SetFeesArgs, programId?: Address): Instruction;
|
|
747
|
+
|
|
748
|
+
/**
|
|
749
|
+
* Accounts required for set_sentinel instruction
|
|
750
|
+
*/
|
|
751
|
+
interface SetSentinelAccounts {
|
|
752
|
+
/** AmmConfig account (read-only) */
|
|
753
|
+
config: Address;
|
|
754
|
+
/** Pool account (writable) */
|
|
755
|
+
pool: Address;
|
|
756
|
+
/** Admin authority (signer, must match config.admin) */
|
|
757
|
+
admin: Address;
|
|
758
|
+
}
|
|
759
|
+
/**
|
|
760
|
+
* Create a set_sentinel instruction
|
|
761
|
+
*
|
|
762
|
+
* Admin instruction to configure a sentinel (hook) program on a pool.
|
|
763
|
+
* The sentinel program must be in the config's allowlist (if the allowlist is non-empty).
|
|
764
|
+
* Use Pubkey::default() to disable the sentinel.
|
|
765
|
+
*
|
|
766
|
+
* @param accounts - Required accounts for setting sentinel
|
|
767
|
+
* @param args - Instruction arguments (sentinelProgram, sentinelFlags)
|
|
768
|
+
* @param programId - Program ID (defaults to CPMM program)
|
|
769
|
+
* @returns Instruction to set sentinel
|
|
770
|
+
*
|
|
771
|
+
* @example
|
|
772
|
+
* ```ts
|
|
773
|
+
* import { SF_BEFORE_SWAP, SF_AFTER_SWAP } from '@cpmm/sdk';
|
|
774
|
+
*
|
|
775
|
+
* const ix = createSetSentinelInstruction(
|
|
776
|
+
* {
|
|
777
|
+
* config: configAddress,
|
|
778
|
+
* pool: poolAddress,
|
|
779
|
+
* admin: adminPublicKey,
|
|
780
|
+
* },
|
|
781
|
+
* {
|
|
782
|
+
* sentinelProgram: sentinelProgramId,
|
|
783
|
+
* sentinelFlags: SF_BEFORE_SWAP | SF_AFTER_SWAP, // Enable both hooks
|
|
784
|
+
* }
|
|
785
|
+
* );
|
|
786
|
+
* ```
|
|
787
|
+
*/
|
|
788
|
+
declare function createSetSentinelInstruction(accounts: SetSentinelAccounts, args: SetSentinelArgs, programId?: Address): Instruction;
|
|
789
|
+
|
|
790
|
+
/**
|
|
791
|
+
* Accounts required for set_route instruction
|
|
792
|
+
*/
|
|
793
|
+
interface SetRouteAccounts {
|
|
794
|
+
/** AmmConfig account (read-only) */
|
|
795
|
+
config: Address;
|
|
796
|
+
/** Pool account (writable) */
|
|
797
|
+
pool: Address;
|
|
798
|
+
/** Next pool in routing chain (optional, required if setting a route) */
|
|
799
|
+
nextPool?: Address;
|
|
800
|
+
/** Admin authority (signer, must match config.admin) */
|
|
801
|
+
admin: Address;
|
|
802
|
+
}
|
|
803
|
+
/**
|
|
804
|
+
* Create a set_route instruction
|
|
805
|
+
*
|
|
806
|
+
* Admin instruction to configure routing for a pool. This allows multi-hop swaps
|
|
807
|
+
* through a chain of pools. The bridge mint must exist in both the current pool
|
|
808
|
+
* and the next pool.
|
|
809
|
+
*
|
|
810
|
+
* To clear routing, pass Pubkey::default() for both routeNextPool and routeBridgeMint.
|
|
811
|
+
*
|
|
812
|
+
* @param accounts - Required accounts for setting route
|
|
813
|
+
* @param args - Instruction arguments (routeNextPool, routeBridgeMint)
|
|
814
|
+
* @param programId - Program ID (defaults to CPMM program)
|
|
815
|
+
* @returns Instruction to set route
|
|
816
|
+
*
|
|
817
|
+
* @example
|
|
818
|
+
* ```ts
|
|
819
|
+
* // Set up routing: Pool A -> Pool B via USDC
|
|
820
|
+
* const ix = createSetRouteInstruction(
|
|
821
|
+
* {
|
|
822
|
+
* config: configAddress,
|
|
823
|
+
* pool: poolAAddress,
|
|
824
|
+
* nextPool: poolBAddress,
|
|
825
|
+
* admin: adminPublicKey,
|
|
826
|
+
* },
|
|
827
|
+
* {
|
|
828
|
+
* routeNextPool: poolBAddress,
|
|
829
|
+
* routeBridgeMint: usdcMint, // Must be in both pools
|
|
830
|
+
* }
|
|
831
|
+
* );
|
|
832
|
+
*
|
|
833
|
+
* // Clear routing
|
|
834
|
+
* const clearIx = createSetRouteInstruction(
|
|
835
|
+
* {
|
|
836
|
+
* config: configAddress,
|
|
837
|
+
* pool: poolAddress,
|
|
838
|
+
* admin: adminPublicKey,
|
|
839
|
+
* },
|
|
840
|
+
* {
|
|
841
|
+
* routeNextPool: address('11111111111111111111111111111111'),
|
|
842
|
+
* routeBridgeMint: address('11111111111111111111111111111111'),
|
|
843
|
+
* }
|
|
844
|
+
* );
|
|
845
|
+
* ```
|
|
846
|
+
*/
|
|
847
|
+
declare function createSetRouteInstruction(accounts: SetRouteAccounts, args: SetRouteArgs, programId?: Address): Instruction;
|
|
848
|
+
|
|
849
|
+
/**
|
|
850
|
+
* Accounts required for pause instruction
|
|
851
|
+
*/
|
|
852
|
+
interface PauseAccounts {
|
|
853
|
+
/** AmmConfig account (writable) */
|
|
854
|
+
config: Address;
|
|
855
|
+
/** Admin authority (signer, must match config.admin) */
|
|
856
|
+
admin: Address;
|
|
857
|
+
}
|
|
858
|
+
/**
|
|
859
|
+
* Create a pause instruction
|
|
860
|
+
*
|
|
861
|
+
* Admin instruction to pause all pool operations globally. When paused,
|
|
862
|
+
* swaps, liquidity additions, and liquidity removals will fail.
|
|
863
|
+
*
|
|
864
|
+
* @param accounts - Required accounts for pausing
|
|
865
|
+
* @param programId - Program ID (defaults to CPMM program)
|
|
866
|
+
* @returns Instruction to pause the AMM
|
|
867
|
+
*
|
|
868
|
+
* @example
|
|
869
|
+
* ```ts
|
|
870
|
+
* const ix = createPauseInstruction({
|
|
871
|
+
* config: configAddress,
|
|
872
|
+
* admin: adminPublicKey,
|
|
873
|
+
* });
|
|
874
|
+
* ```
|
|
875
|
+
*/
|
|
876
|
+
declare function createPauseInstruction(accounts: PauseAccounts, programId?: Address): Instruction;
|
|
877
|
+
|
|
878
|
+
/**
|
|
879
|
+
* Accounts required for unpause instruction
|
|
880
|
+
*/
|
|
881
|
+
interface UnpauseAccounts {
|
|
882
|
+
/** AmmConfig account (writable) */
|
|
883
|
+
config: Address;
|
|
884
|
+
/** Admin authority (signer, must match config.admin) */
|
|
885
|
+
admin: Address;
|
|
886
|
+
}
|
|
887
|
+
/**
|
|
888
|
+
* Create an unpause instruction
|
|
889
|
+
*
|
|
890
|
+
* Admin instruction to unpause all pool operations. This re-enables
|
|
891
|
+
* swaps, liquidity additions, and liquidity removals after a pause.
|
|
892
|
+
*
|
|
893
|
+
* @param accounts - Required accounts for unpausing
|
|
894
|
+
* @param programId - Program ID (defaults to CPMM program)
|
|
895
|
+
* @returns Instruction to unpause the AMM
|
|
896
|
+
*
|
|
897
|
+
* @example
|
|
898
|
+
* ```ts
|
|
899
|
+
* const ix = createUnpauseInstruction({
|
|
900
|
+
* config: configAddress,
|
|
901
|
+
* admin: adminPublicKey,
|
|
902
|
+
* });
|
|
903
|
+
* ```
|
|
904
|
+
*/
|
|
905
|
+
declare function createUnpauseInstruction(accounts: UnpauseAccounts, programId?: Address): Instruction;
|
|
906
|
+
|
|
907
|
+
/**
|
|
908
|
+
* Accounts required for transfer_admin instruction
|
|
909
|
+
*/
|
|
910
|
+
interface TransferAdminAccounts {
|
|
911
|
+
/** AmmConfig account (writable) */
|
|
912
|
+
config: Address;
|
|
913
|
+
/** Current admin authority (signer, must match config.admin) */
|
|
914
|
+
admin: Address;
|
|
915
|
+
}
|
|
916
|
+
/**
|
|
917
|
+
* Create a transfer_admin instruction
|
|
918
|
+
*
|
|
919
|
+
* Admin instruction to transfer administrative authority to a new address.
|
|
920
|
+
* The new admin will have full control over the AMM configuration and all pools.
|
|
921
|
+
*
|
|
922
|
+
* CAUTION: This action is irreversible. Ensure the new admin address is correct
|
|
923
|
+
* and that you have access to it before executing.
|
|
924
|
+
*
|
|
925
|
+
* @param accounts - Required accounts for transferring admin
|
|
926
|
+
* @param args - Instruction arguments (newAdmin)
|
|
927
|
+
* @param programId - Program ID (defaults to CPMM program)
|
|
928
|
+
* @returns Instruction to transfer admin
|
|
929
|
+
*
|
|
930
|
+
* @example
|
|
931
|
+
* ```ts
|
|
932
|
+
* const ix = createTransferAdminInstruction(
|
|
933
|
+
* {
|
|
934
|
+
* config: configAddress,
|
|
935
|
+
* admin: currentAdminPublicKey,
|
|
936
|
+
* },
|
|
937
|
+
* {
|
|
938
|
+
* newAdmin: newAdminPublicKey,
|
|
939
|
+
* }
|
|
940
|
+
* );
|
|
941
|
+
* ```
|
|
942
|
+
*/
|
|
943
|
+
declare function createTransferAdminInstruction(accounts: TransferAdminAccounts, args: TransferAdminArgs, programId?: Address): Instruction;
|
|
944
|
+
|
|
945
|
+
/**
|
|
946
|
+
* Accounts required for skim instruction
|
|
947
|
+
*/
|
|
948
|
+
interface SkimAccounts {
|
|
949
|
+
/** AmmConfig account (read-only) */
|
|
950
|
+
config: Address;
|
|
951
|
+
/** Pool account (read-only) */
|
|
952
|
+
pool: Address;
|
|
953
|
+
/** Admin authority (signer, must match config.admin) */
|
|
954
|
+
admin: Address;
|
|
955
|
+
/** Pool authority PDA (read-only, PDA: ['authority', pool]) */
|
|
956
|
+
authority: Address;
|
|
957
|
+
/** Token0 vault (writable) */
|
|
958
|
+
vault0: Address;
|
|
959
|
+
/** Token1 vault (writable) */
|
|
960
|
+
vault1: Address;
|
|
961
|
+
/** Token0 mint (read-only) */
|
|
962
|
+
token0Mint: Address;
|
|
963
|
+
/** Token1 mint (read-only) */
|
|
964
|
+
token1Mint: Address;
|
|
965
|
+
/** Admin's token0 ATA to receive excess (writable) */
|
|
966
|
+
adminAta0: Address;
|
|
967
|
+
/** Admin's token1 ATA to receive excess (writable) */
|
|
968
|
+
adminAta1: Address;
|
|
969
|
+
/** SPL Token program */
|
|
970
|
+
tokenProgram?: Address;
|
|
971
|
+
}
|
|
972
|
+
/**
|
|
973
|
+
* Create a skim instruction
|
|
974
|
+
*
|
|
975
|
+
* Admin instruction to withdraw excess tokens from pool vaults. This recovers any
|
|
976
|
+
* tokens that were accidentally sent directly to the vault accounts (outside of
|
|
977
|
+
* normal pool operations).
|
|
978
|
+
*
|
|
979
|
+
* Only withdraws tokens in excess of (reserve + unclaimed_fees). Normal pool
|
|
980
|
+
* reserves and LP fees are not affected.
|
|
981
|
+
*
|
|
982
|
+
* @param accounts - Required accounts for skimming
|
|
983
|
+
* @param programId - Program ID (defaults to CPMM program)
|
|
984
|
+
* @returns Instruction to skim excess tokens
|
|
985
|
+
*
|
|
986
|
+
* @example
|
|
987
|
+
* ```ts
|
|
988
|
+
* const ix = createSkimInstruction({
|
|
989
|
+
* config: configAddress,
|
|
990
|
+
* pool: poolAddress,
|
|
991
|
+
* admin: adminPublicKey,
|
|
992
|
+
* authority: authorityAddress,
|
|
993
|
+
* vault0: vault0Address,
|
|
994
|
+
* vault1: vault1Address,
|
|
995
|
+
* token0Mint: mint0,
|
|
996
|
+
* token1Mint: mint1,
|
|
997
|
+
* adminAta0: adminToken0Account,
|
|
998
|
+
* adminAta1: adminToken1Account,
|
|
999
|
+
* });
|
|
1000
|
+
* ```
|
|
1001
|
+
*/
|
|
1002
|
+
declare function createSkimInstruction(accounts: SkimAccounts, programId?: Address): Instruction;
|
|
1003
|
+
|
|
1004
|
+
/**
|
|
1005
|
+
* Accounts required for swap_exact_in instruction
|
|
1006
|
+
*/
|
|
1007
|
+
interface SwapExactInAccounts {
|
|
1008
|
+
/** AmmConfig account (read-only) */
|
|
1009
|
+
config: Address;
|
|
1010
|
+
/** Pool account (writable) */
|
|
1011
|
+
pool: Address;
|
|
1012
|
+
/** Pool authority PDA (read-only) */
|
|
1013
|
+
authority: Address;
|
|
1014
|
+
/** Input token vault (writable) */
|
|
1015
|
+
vaultIn: Address;
|
|
1016
|
+
/** Output token vault (writable) */
|
|
1017
|
+
vaultOut: Address;
|
|
1018
|
+
/** Token0 mint (read-only, for transfer_checked) */
|
|
1019
|
+
token0Mint: Address;
|
|
1020
|
+
/** Token1 mint (read-only, for transfer_checked) */
|
|
1021
|
+
token1Mint: Address;
|
|
1022
|
+
/** User's input token account (writable) */
|
|
1023
|
+
userIn: Address;
|
|
1024
|
+
/** User's output token account (writable) */
|
|
1025
|
+
userOut: Address;
|
|
1026
|
+
/** User authority (signer) */
|
|
1027
|
+
user: Address;
|
|
1028
|
+
/** SPL Token program */
|
|
1029
|
+
tokenProgram?: Address;
|
|
1030
|
+
/** Oracle account (optional, required if updateOracle is true) */
|
|
1031
|
+
oracle?: Address;
|
|
1032
|
+
/** Optional remaining accounts (sentinel program/state, route/oracle data) */
|
|
1033
|
+
remainingAccounts?: Address[];
|
|
1034
|
+
}
|
|
1035
|
+
/**
|
|
1036
|
+
* Create a swap_exact_in instruction
|
|
1037
|
+
*
|
|
1038
|
+
* Swaps an exact input amount for a minimum output amount using the CPMM formula.
|
|
1039
|
+
*
|
|
1040
|
+
* @param accounts - Required accounts for the swap
|
|
1041
|
+
* @param args - Instruction arguments (amountIn, minAmountOut, direction, updateOracle)
|
|
1042
|
+
* @param programId - Program ID (defaults to CPMM program)
|
|
1043
|
+
* @returns Instruction to execute the swap
|
|
1044
|
+
*
|
|
1045
|
+
* @example
|
|
1046
|
+
* ```ts
|
|
1047
|
+
* const ix = createSwapExactInInstruction(
|
|
1048
|
+
* {
|
|
1049
|
+
* config: configAddress,
|
|
1050
|
+
* pool: poolAddress,
|
|
1051
|
+
* authority: authorityAddress,
|
|
1052
|
+
* vaultIn: vault0Address,
|
|
1053
|
+
* vaultOut: vault1Address,
|
|
1054
|
+
* token0Mint: mint0,
|
|
1055
|
+
* token1Mint: mint1,
|
|
1056
|
+
* userIn: userToken0Account,
|
|
1057
|
+
* userOut: userToken1Account,
|
|
1058
|
+
* user: userPublicKey,
|
|
1059
|
+
* },
|
|
1060
|
+
* {
|
|
1061
|
+
* amountIn: 1000000n,
|
|
1062
|
+
* minAmountOut: 990000n,
|
|
1063
|
+
* direction: 0, // token0 -> token1
|
|
1064
|
+
* updateOracle: false,
|
|
1065
|
+
* }
|
|
1066
|
+
* );
|
|
1067
|
+
* ```
|
|
1068
|
+
*/
|
|
1069
|
+
declare function createSwapExactInInstruction(accounts: SwapExactInAccounts, args: SwapExactInArgs, programId?: Address): Instruction;
|
|
1070
|
+
/**
|
|
1071
|
+
* Helper to create swap instruction with simplified parameters
|
|
1072
|
+
*/
|
|
1073
|
+
declare function createSwapInstruction(params: {
|
|
1074
|
+
config: Address;
|
|
1075
|
+
pool: Address;
|
|
1076
|
+
authority: Address;
|
|
1077
|
+
vault0: Address;
|
|
1078
|
+
vault1: Address;
|
|
1079
|
+
token0Mint: Address;
|
|
1080
|
+
token1Mint: Address;
|
|
1081
|
+
userToken0: Address;
|
|
1082
|
+
userToken1: Address;
|
|
1083
|
+
user: Address;
|
|
1084
|
+
amountIn: bigint;
|
|
1085
|
+
minAmountOut: bigint;
|
|
1086
|
+
direction: SwapDirection;
|
|
1087
|
+
oracle?: Address;
|
|
1088
|
+
remainingAccounts?: Address[];
|
|
1089
|
+
updateOracle?: boolean;
|
|
1090
|
+
programId?: Address;
|
|
1091
|
+
}): Instruction;
|
|
1092
|
+
|
|
1093
|
+
/**
|
|
1094
|
+
* Accounts required for create_position instruction
|
|
1095
|
+
*/
|
|
1096
|
+
interface CreatePositionAccounts {
|
|
1097
|
+
/** Pool account (read-only) */
|
|
1098
|
+
pool: Address;
|
|
1099
|
+
/** Position PDA to be created (writable, derived from ['position', pool, owner, position_id]) */
|
|
1100
|
+
position: Address;
|
|
1101
|
+
/** Owner of the position (signer) */
|
|
1102
|
+
owner: Address;
|
|
1103
|
+
/** Payer for rent (signer, writable) */
|
|
1104
|
+
payer: Address;
|
|
1105
|
+
/** System program */
|
|
1106
|
+
systemProgram?: Address;
|
|
1107
|
+
}
|
|
1108
|
+
/**
|
|
1109
|
+
* Create a create_position instruction
|
|
1110
|
+
*
|
|
1111
|
+
* Creates a new liquidity position for a pool. The position is a PDA derived from
|
|
1112
|
+
* the pool, owner, and position ID. Users can have multiple positions per pool
|
|
1113
|
+
* by using different position IDs.
|
|
1114
|
+
*
|
|
1115
|
+
* @param accounts - Required accounts for creating the position
|
|
1116
|
+
* @param args - Instruction arguments (positionId)
|
|
1117
|
+
* @param programId - Program ID (defaults to CPMM program)
|
|
1118
|
+
* @returns Instruction to create a new position
|
|
1119
|
+
*
|
|
1120
|
+
* @example
|
|
1121
|
+
* ```ts
|
|
1122
|
+
* const ix = createCreatePositionInstruction(
|
|
1123
|
+
* {
|
|
1124
|
+
* pool: poolAddress,
|
|
1125
|
+
* position: positionPda,
|
|
1126
|
+
* owner: userPublicKey,
|
|
1127
|
+
* payer: userPublicKey,
|
|
1128
|
+
* },
|
|
1129
|
+
* {
|
|
1130
|
+
* positionId: 0n,
|
|
1131
|
+
* }
|
|
1132
|
+
* );
|
|
1133
|
+
* ```
|
|
1134
|
+
*/
|
|
1135
|
+
declare function createCreatePositionInstruction(accounts: CreatePositionAccounts, args: CreatePositionArgs, programId?: Address): Instruction;
|
|
1136
|
+
|
|
1137
|
+
/**
|
|
1138
|
+
* Accounts required for close_position instruction
|
|
1139
|
+
*/
|
|
1140
|
+
interface ClosePositionAccounts {
|
|
1141
|
+
/** Pool account (read-only) */
|
|
1142
|
+
pool: Address;
|
|
1143
|
+
/** Position account to close (writable) */
|
|
1144
|
+
position: Address;
|
|
1145
|
+
/** Position owner (signer) */
|
|
1146
|
+
owner: Address;
|
|
1147
|
+
/** Recipient for rent lamports (writable) */
|
|
1148
|
+
rentRecipient: Address;
|
|
1149
|
+
}
|
|
1150
|
+
/**
|
|
1151
|
+
* Create a close_position instruction
|
|
1152
|
+
*
|
|
1153
|
+
* Closes an empty position account, returning the rent lamports to the recipient.
|
|
1154
|
+
* The position must have zero shares and zero accrued fees to be closed.
|
|
1155
|
+
*
|
|
1156
|
+
* @param accounts - Required accounts for closing the position
|
|
1157
|
+
* @param programId - Program ID (defaults to CPMM program)
|
|
1158
|
+
* @returns Instruction to close a position
|
|
1159
|
+
*
|
|
1160
|
+
* @example
|
|
1161
|
+
* ```ts
|
|
1162
|
+
* const ix = createClosePositionInstruction({
|
|
1163
|
+
* pool: poolAddress,
|
|
1164
|
+
* position: positionAddress,
|
|
1165
|
+
* owner: userPublicKey,
|
|
1166
|
+
* rentRecipient: userPublicKey,
|
|
1167
|
+
* });
|
|
1168
|
+
* ```
|
|
1169
|
+
*/
|
|
1170
|
+
declare function createClosePositionInstruction(accounts: ClosePositionAccounts, programId?: Address): Instruction;
|
|
1171
|
+
|
|
1172
|
+
/**
|
|
1173
|
+
* Extended AddLiquidity args that include updateOracle flag
|
|
1174
|
+
* (matches the on-chain program's actual args)
|
|
1175
|
+
*/
|
|
1176
|
+
interface AddLiquidityArgsWithOracle extends AddLiquidityArgs {
|
|
1177
|
+
/** Whether to update the oracle (requires oracle account) */
|
|
1178
|
+
updateOracle: boolean;
|
|
1179
|
+
}
|
|
1180
|
+
/**
|
|
1181
|
+
* Accounts required for add_liquidity instruction
|
|
1182
|
+
*/
|
|
1183
|
+
interface AddLiquidityAccounts {
|
|
1184
|
+
/** AmmConfig account (read-only) */
|
|
1185
|
+
config: Address;
|
|
1186
|
+
/** Pool account (writable) */
|
|
1187
|
+
pool: Address;
|
|
1188
|
+
/** User's position account (writable) */
|
|
1189
|
+
position: Address;
|
|
1190
|
+
/** Protocol position for protocol fees (writable) */
|
|
1191
|
+
protocolPosition: Address;
|
|
1192
|
+
/** Position owner (signer) */
|
|
1193
|
+
owner: Address;
|
|
1194
|
+
/** Pool authority PDA (read-only) */
|
|
1195
|
+
authority: Address;
|
|
1196
|
+
/** Pool vault for token0 (writable) */
|
|
1197
|
+
vault0: Address;
|
|
1198
|
+
/** Pool vault for token1 (writable) */
|
|
1199
|
+
vault1: Address;
|
|
1200
|
+
/** Token0 mint (read-only) */
|
|
1201
|
+
token0Mint: Address;
|
|
1202
|
+
/** Token1 mint (read-only) */
|
|
1203
|
+
token1Mint: Address;
|
|
1204
|
+
/** User's token0 account (writable) */
|
|
1205
|
+
user0: Address;
|
|
1206
|
+
/** User's token1 account (writable) */
|
|
1207
|
+
user1: Address;
|
|
1208
|
+
/** SPL Token program */
|
|
1209
|
+
tokenProgram?: Address;
|
|
1210
|
+
/** Oracle account (optional, required if updateOracle is true) */
|
|
1211
|
+
oracle?: Address;
|
|
1212
|
+
/** Optional remaining accounts (sentinel program/state, route/oracle data) */
|
|
1213
|
+
remainingAccounts?: Address[];
|
|
1214
|
+
}
|
|
1215
|
+
/**
|
|
1216
|
+
* Create an add_liquidity instruction
|
|
1217
|
+
*
|
|
1218
|
+
* Adds liquidity to a pool by depositing tokens and receiving LP shares.
|
|
1219
|
+
* For an empty pool (first deposit), the amount of shares is sqrt(amount0 * amount1).
|
|
1220
|
+
* For subsequent deposits, shares are proportional to the smaller ratio of deposit to reserves.
|
|
1221
|
+
*
|
|
1222
|
+
* @param accounts - Required accounts for adding liquidity
|
|
1223
|
+
* @param args - Instruction arguments (amount0Max, amount1Max, minSharesOut, updateOracle)
|
|
1224
|
+
* @param programId - Program ID (defaults to CPMM program)
|
|
1225
|
+
* @returns Instruction to add liquidity
|
|
1226
|
+
*
|
|
1227
|
+
* @example
|
|
1228
|
+
* ```ts
|
|
1229
|
+
* const ix = createAddLiquidityInstruction(
|
|
1230
|
+
* {
|
|
1231
|
+
* config: configAddress,
|
|
1232
|
+
* pool: poolAddress,
|
|
1233
|
+
* position: positionAddress,
|
|
1234
|
+
* protocolPosition: protocolPositionAddress,
|
|
1235
|
+
* owner: userPublicKey,
|
|
1236
|
+
* authority: authorityPda,
|
|
1237
|
+
* vault0: vault0Address,
|
|
1238
|
+
* vault1: vault1Address,
|
|
1239
|
+
* token0Mint: mint0,
|
|
1240
|
+
* token1Mint: mint1,
|
|
1241
|
+
* user0: userToken0Account,
|
|
1242
|
+
* user1: userToken1Account,
|
|
1243
|
+
* },
|
|
1244
|
+
* {
|
|
1245
|
+
* amount0Max: 1000000n,
|
|
1246
|
+
* amount1Max: 1000000n,
|
|
1247
|
+
* minSharesOut: 0n,
|
|
1248
|
+
* updateOracle: false,
|
|
1249
|
+
* }
|
|
1250
|
+
* );
|
|
1251
|
+
* ```
|
|
1252
|
+
*/
|
|
1253
|
+
declare function createAddLiquidityInstruction(accounts: AddLiquidityAccounts, args: AddLiquidityArgsWithOracle, programId?: Address): Instruction;
|
|
1254
|
+
|
|
1255
|
+
/**
|
|
1256
|
+
* Accounts required for remove_liquidity instruction
|
|
1257
|
+
*/
|
|
1258
|
+
interface RemoveLiquidityAccounts {
|
|
1259
|
+
/** AmmConfig account (read-only) */
|
|
1260
|
+
config: Address;
|
|
1261
|
+
/** Pool account (writable) */
|
|
1262
|
+
pool: Address;
|
|
1263
|
+
/** User's position account (writable) */
|
|
1264
|
+
position: Address;
|
|
1265
|
+
/** Protocol position for protocol fees (writable) */
|
|
1266
|
+
protocolPosition: Address;
|
|
1267
|
+
/** Position owner (signer) */
|
|
1268
|
+
owner: Address;
|
|
1269
|
+
/** Pool authority PDA (read-only) */
|
|
1270
|
+
authority: Address;
|
|
1271
|
+
/** Pool vault for token0 (writable) */
|
|
1272
|
+
vault0: Address;
|
|
1273
|
+
/** Pool vault for token1 (writable) */
|
|
1274
|
+
vault1: Address;
|
|
1275
|
+
/** Token0 mint (read-only) */
|
|
1276
|
+
token0Mint: Address;
|
|
1277
|
+
/** Token1 mint (read-only) */
|
|
1278
|
+
token1Mint: Address;
|
|
1279
|
+
/** User's token0 account (writable) */
|
|
1280
|
+
user0: Address;
|
|
1281
|
+
/** User's token1 account (writable) */
|
|
1282
|
+
user1: Address;
|
|
1283
|
+
/** SPL Token program */
|
|
1284
|
+
tokenProgram?: Address;
|
|
1285
|
+
/** Oracle account (optional, required if updateOracle is true) */
|
|
1286
|
+
oracle?: Address;
|
|
1287
|
+
/** Optional remaining accounts (sentinel program/state, route/oracle data) */
|
|
1288
|
+
remainingAccounts?: Address[];
|
|
1289
|
+
}
|
|
1290
|
+
/**
|
|
1291
|
+
* Create a remove_liquidity instruction
|
|
1292
|
+
*
|
|
1293
|
+
* Removes liquidity from a pool by burning LP shares and receiving tokens back.
|
|
1294
|
+
* The amount of tokens received is proportional to the share of the pool being withdrawn.
|
|
1295
|
+
* Also accrues any pending fees to the position before withdrawal.
|
|
1296
|
+
*
|
|
1297
|
+
* @param accounts - Required accounts for removing liquidity
|
|
1298
|
+
* @param args - Instruction arguments (sharesIn, minAmount0Out, minAmount1Out, updateOracle)
|
|
1299
|
+
* @param programId - Program ID (defaults to CPMM program)
|
|
1300
|
+
* @returns Instruction to remove liquidity
|
|
1301
|
+
*
|
|
1302
|
+
* @example
|
|
1303
|
+
* ```ts
|
|
1304
|
+
* const ix = createRemoveLiquidityInstruction(
|
|
1305
|
+
* {
|
|
1306
|
+
* config: configAddress,
|
|
1307
|
+
* pool: poolAddress,
|
|
1308
|
+
* position: positionAddress,
|
|
1309
|
+
* protocolPosition: protocolPositionAddress,
|
|
1310
|
+
* owner: userPublicKey,
|
|
1311
|
+
* authority: authorityPda,
|
|
1312
|
+
* vault0: vault0Address,
|
|
1313
|
+
* vault1: vault1Address,
|
|
1314
|
+
* token0Mint: mint0,
|
|
1315
|
+
* token1Mint: mint1,
|
|
1316
|
+
* user0: userToken0Account,
|
|
1317
|
+
* user1: userToken1Account,
|
|
1318
|
+
* },
|
|
1319
|
+
* {
|
|
1320
|
+
* sharesIn: 500000n,
|
|
1321
|
+
* minAmount0Out: 450000n,
|
|
1322
|
+
* minAmount1Out: 450000n,
|
|
1323
|
+
* updateOracle: false,
|
|
1324
|
+
* }
|
|
1325
|
+
* );
|
|
1326
|
+
* ```
|
|
1327
|
+
*/
|
|
1328
|
+
declare function createRemoveLiquidityInstruction(accounts: RemoveLiquidityAccounts, args: RemoveLiquidityArgs, programId?: Address): Instruction;
|
|
1329
|
+
|
|
1330
|
+
/**
|
|
1331
|
+
* Accounts required for collect_fees instruction
|
|
1332
|
+
*/
|
|
1333
|
+
interface CollectFeesAccounts {
|
|
1334
|
+
/** Pool account (writable) */
|
|
1335
|
+
pool: Address;
|
|
1336
|
+
/** User's position account (writable) */
|
|
1337
|
+
position: Address;
|
|
1338
|
+
/** Position owner (signer) */
|
|
1339
|
+
owner: Address;
|
|
1340
|
+
/** Pool authority PDA (read-only) */
|
|
1341
|
+
authority: Address;
|
|
1342
|
+
/** Pool vault for token0 (writable) */
|
|
1343
|
+
vault0: Address;
|
|
1344
|
+
/** Pool vault for token1 (writable) */
|
|
1345
|
+
vault1: Address;
|
|
1346
|
+
/** Token0 mint (read-only) */
|
|
1347
|
+
token0Mint: Address;
|
|
1348
|
+
/** Token1 mint (read-only) */
|
|
1349
|
+
token1Mint: Address;
|
|
1350
|
+
/** User's token0 account (writable) */
|
|
1351
|
+
user0: Address;
|
|
1352
|
+
/** User's token1 account (writable) */
|
|
1353
|
+
user1: Address;
|
|
1354
|
+
/** SPL Token program */
|
|
1355
|
+
tokenProgram?: Address;
|
|
1356
|
+
}
|
|
1357
|
+
/**
|
|
1358
|
+
* Create a collect_fees instruction
|
|
1359
|
+
*
|
|
1360
|
+
* Collects accrued LP fees from a position. Fees are first accrued from the global
|
|
1361
|
+
* fee growth, then transferred from the pool vaults to the user's token accounts.
|
|
1362
|
+
* You can specify max amounts to partially collect fees.
|
|
1363
|
+
*
|
|
1364
|
+
* @param accounts - Required accounts for collecting fees
|
|
1365
|
+
* @param args - Instruction arguments (max0, max1)
|
|
1366
|
+
* @param programId - Program ID (defaults to CPMM program)
|
|
1367
|
+
* @returns Instruction to collect fees
|
|
1368
|
+
*
|
|
1369
|
+
* @example
|
|
1370
|
+
* ```ts
|
|
1371
|
+
* // Collect all accrued fees
|
|
1372
|
+
* const ix = createCollectFeesInstruction(
|
|
1373
|
+
* {
|
|
1374
|
+
* pool: poolAddress,
|
|
1375
|
+
* position: positionAddress,
|
|
1376
|
+
* owner: userPublicKey,
|
|
1377
|
+
* authority: authorityPda,
|
|
1378
|
+
* vault0: vault0Address,
|
|
1379
|
+
* vault1: vault1Address,
|
|
1380
|
+
* token0Mint: mint0,
|
|
1381
|
+
* token1Mint: mint1,
|
|
1382
|
+
* user0: userToken0Account,
|
|
1383
|
+
* user1: userToken1Account,
|
|
1384
|
+
* },
|
|
1385
|
+
* {
|
|
1386
|
+
* max0: BigInt('18446744073709551615'), // u64::MAX to collect all
|
|
1387
|
+
* max1: BigInt('18446744073709551615'),
|
|
1388
|
+
* }
|
|
1389
|
+
* );
|
|
1390
|
+
* ```
|
|
1391
|
+
*/
|
|
1392
|
+
declare function createCollectFeesInstruction(accounts: CollectFeesAccounts, args: CollectFeesArgs, programId?: Address): Instruction;
|
|
1393
|
+
/**
|
|
1394
|
+
* Convenience constant for collecting all fees (u64::MAX)
|
|
1395
|
+
*/
|
|
1396
|
+
declare const MAX_FEE_AMOUNT: bigint;
|
|
1397
|
+
|
|
1398
|
+
/**
|
|
1399
|
+
* Accounts required for collect_protocol_fees instruction
|
|
1400
|
+
*/
|
|
1401
|
+
interface CollectProtocolFeesAccounts {
|
|
1402
|
+
/** AmmConfig account (read-only) */
|
|
1403
|
+
config: Address;
|
|
1404
|
+
/** Pool account (writable) */
|
|
1405
|
+
pool: Address;
|
|
1406
|
+
/** Protocol position account (writable) */
|
|
1407
|
+
protocolPosition: Address;
|
|
1408
|
+
/** Admin authority (signer) */
|
|
1409
|
+
admin: Address;
|
|
1410
|
+
/** Pool authority PDA (read-only) */
|
|
1411
|
+
authority: Address;
|
|
1412
|
+
/** Pool vault for token0 (writable) */
|
|
1413
|
+
vault0: Address;
|
|
1414
|
+
/** Pool vault for token1 (writable) */
|
|
1415
|
+
vault1: Address;
|
|
1416
|
+
/** Token0 mint (read-only) */
|
|
1417
|
+
token0Mint: Address;
|
|
1418
|
+
/** Token1 mint (read-only) */
|
|
1419
|
+
token1Mint: Address;
|
|
1420
|
+
/** Recipient token0 account (writable) */
|
|
1421
|
+
recipient0: Address;
|
|
1422
|
+
/** Recipient token1 account (writable) */
|
|
1423
|
+
recipient1: Address;
|
|
1424
|
+
/** SPL Token program */
|
|
1425
|
+
tokenProgram?: Address;
|
|
1426
|
+
}
|
|
1427
|
+
/**
|
|
1428
|
+
* Create a collect_protocol_fees instruction
|
|
1429
|
+
*
|
|
1430
|
+
* Collects accrued protocol fees from the protocol position and transfers them
|
|
1431
|
+
* to the configured recipients.
|
|
1432
|
+
*
|
|
1433
|
+
* @param accounts - Required accounts for collecting protocol fees
|
|
1434
|
+
* @param args - Instruction arguments (max0, max1)
|
|
1435
|
+
* @param programId - Program ID (defaults to CPMM program)
|
|
1436
|
+
* @returns Instruction to collect protocol fees
|
|
1437
|
+
*
|
|
1438
|
+
* @example
|
|
1439
|
+
* ```ts
|
|
1440
|
+
* const ix = createCollectProtocolFeesInstruction(
|
|
1441
|
+
* {
|
|
1442
|
+
* config: configAddress,
|
|
1443
|
+
* pool: poolAddress,
|
|
1444
|
+
* protocolPosition: protocolPositionAddress,
|
|
1445
|
+
* admin: adminPublicKey,
|
|
1446
|
+
* authority: authorityPda,
|
|
1447
|
+
* vault0: vault0Address,
|
|
1448
|
+
* vault1: vault1Address,
|
|
1449
|
+
* token0Mint: mint0,
|
|
1450
|
+
* token1Mint: mint1,
|
|
1451
|
+
* recipient0: adminToken0Account,
|
|
1452
|
+
* recipient1: adminToken1Account,
|
|
1453
|
+
* },
|
|
1454
|
+
* {
|
|
1455
|
+
* max0: BigInt('18446744073709551615'),
|
|
1456
|
+
* max1: BigInt('18446744073709551615'),
|
|
1457
|
+
* }
|
|
1458
|
+
* );
|
|
1459
|
+
* ```
|
|
1460
|
+
*/
|
|
1461
|
+
declare function createCollectProtocolFeesInstruction(accounts: CollectProtocolFeesAccounts, args: CollectProtocolFeesArgs, programId?: Address): Instruction;
|
|
1462
|
+
|
|
1463
|
+
/**
|
|
1464
|
+
* Accounts required for oracle_update instruction
|
|
1465
|
+
*/
|
|
1466
|
+
interface OracleUpdateAccounts {
|
|
1467
|
+
/** Pool account (read-only) */
|
|
1468
|
+
pool: Address;
|
|
1469
|
+
/** Oracle PDA to update (writable) */
|
|
1470
|
+
oracle: Address;
|
|
1471
|
+
}
|
|
1472
|
+
/**
|
|
1473
|
+
* Create an oracle_update instruction
|
|
1474
|
+
*
|
|
1475
|
+
* Updates the oracle with the current pool prices. This samples the current
|
|
1476
|
+
* spot price, clamps it according to maxPriceChangeRatioQ64, and records
|
|
1477
|
+
* a new observation if the observation interval has elapsed.
|
|
1478
|
+
*
|
|
1479
|
+
* This instruction is permissionless - anyone can call it to update the oracle.
|
|
1480
|
+
*
|
|
1481
|
+
* @param accounts - Required accounts for the instruction
|
|
1482
|
+
* @param programId - Program ID (defaults to CPMM program)
|
|
1483
|
+
* @returns Instruction to update the oracle
|
|
1484
|
+
*
|
|
1485
|
+
* @example
|
|
1486
|
+
* ```ts
|
|
1487
|
+
* const ix = createOracleUpdateInstruction({
|
|
1488
|
+
* pool: poolAddress,
|
|
1489
|
+
* oracle: oracleAddress,
|
|
1490
|
+
* });
|
|
1491
|
+
* ```
|
|
1492
|
+
*/
|
|
1493
|
+
declare function createOracleUpdateInstruction(accounts: OracleUpdateAccounts, programId?: Address): Instruction;
|
|
1494
|
+
|
|
1495
|
+
/**
|
|
1496
|
+
* Accounts required for oracle_consult instruction
|
|
1497
|
+
*/
|
|
1498
|
+
interface OracleConsultAccounts {
|
|
1499
|
+
/** Pool account (read-only) */
|
|
1500
|
+
pool: Address;
|
|
1501
|
+
/** Oracle PDA to query (read-only) */
|
|
1502
|
+
oracle: Address;
|
|
1503
|
+
}
|
|
1504
|
+
/**
|
|
1505
|
+
* Result returned from oracle_consult via return data
|
|
1506
|
+
*/
|
|
1507
|
+
interface OracleConsultResult {
|
|
1508
|
+
/** TWAP price of token0 in token1 (Q64.64 fixed-point) */
|
|
1509
|
+
price0Q64: bigint;
|
|
1510
|
+
/** TWAP price of token1 in token0 (Q64.64 fixed-point) */
|
|
1511
|
+
price1Q64: bigint;
|
|
1512
|
+
}
|
|
1513
|
+
/**
|
|
1514
|
+
* Decode oracle_consult return data
|
|
1515
|
+
*/
|
|
1516
|
+
declare function decodeOracleConsultResult(data: ReadonlyUint8Array): OracleConsultResult;
|
|
1517
|
+
/**
|
|
1518
|
+
* Create an oracle_consult instruction
|
|
1519
|
+
*
|
|
1520
|
+
* Queries the TWAP price from the oracle over the specified time window.
|
|
1521
|
+
* The result is returned via Solana's return data mechanism.
|
|
1522
|
+
*
|
|
1523
|
+
* Note: To read the result, you must invoke this instruction via CPI or
|
|
1524
|
+
* simulate the transaction and parse the return data.
|
|
1525
|
+
*
|
|
1526
|
+
* @param accounts - Required accounts for the instruction
|
|
1527
|
+
* @param args - Instruction arguments (windowSeconds)
|
|
1528
|
+
* @param programId - Program ID (defaults to CPMM program)
|
|
1529
|
+
* @returns Instruction to consult the oracle
|
|
1530
|
+
*
|
|
1531
|
+
* @example
|
|
1532
|
+
* ```ts
|
|
1533
|
+
* const ix = createOracleConsultInstruction(
|
|
1534
|
+
* {
|
|
1535
|
+
* pool: poolAddress,
|
|
1536
|
+
* oracle: oracleAddress,
|
|
1537
|
+
* },
|
|
1538
|
+
* {
|
|
1539
|
+
* windowSeconds: 300, // 5-minute TWAP
|
|
1540
|
+
* }
|
|
1541
|
+
* );
|
|
1542
|
+
* ```
|
|
1543
|
+
*/
|
|
1544
|
+
declare function createOracleConsultInstruction(accounts: OracleConsultAccounts, args: OracleConsultArgs, programId?: Address): Instruction;
|
|
1545
|
+
|
|
1546
|
+
/**
|
|
1547
|
+
* Accounts required for quote_to_numeraire instruction
|
|
1548
|
+
*/
|
|
1549
|
+
interface QuoteToNumeraireAccounts {
|
|
1550
|
+
/** AmmConfig account (read-only) */
|
|
1551
|
+
config: Address;
|
|
1552
|
+
/** Starting pool for the route (read-only) */
|
|
1553
|
+
startPool: Address;
|
|
1554
|
+
/**
|
|
1555
|
+
* Remaining accounts for routing:
|
|
1556
|
+
* - [pool1?, pool2?, ...]
|
|
1557
|
+
*
|
|
1558
|
+
* Each hop requires the next pool in the route chain.
|
|
1559
|
+
*/
|
|
1560
|
+
remainingAccounts?: Address[];
|
|
1561
|
+
}
|
|
1562
|
+
/**
|
|
1563
|
+
* Result returned from quote_to_numeraire via return data
|
|
1564
|
+
*/
|
|
1565
|
+
interface QuoteToNumeraireResult {
|
|
1566
|
+
/** Amount converted to numeraire (u128) */
|
|
1567
|
+
amountInNumeraire: bigint;
|
|
1568
|
+
/** Final mint reached (should be numeraire) */
|
|
1569
|
+
endMint: Address;
|
|
1570
|
+
/** Number of hops used in the route */
|
|
1571
|
+
hopsUsed: number;
|
|
1572
|
+
}
|
|
1573
|
+
/**
|
|
1574
|
+
* Decode quote_to_numeraire return data
|
|
1575
|
+
*/
|
|
1576
|
+
declare function decodeQuoteToNumeraireResult(data: ReadonlyUint8Array): QuoteToNumeraireResult;
|
|
1577
|
+
/**
|
|
1578
|
+
* Create a quote_to_numeraire instruction
|
|
1579
|
+
*
|
|
1580
|
+
* Converts an amount of one token to its value in the pool's numeraire
|
|
1581
|
+
* via the routing chain using spot pricing. (TWAP is not supported in v0.1.)
|
|
1582
|
+
*
|
|
1583
|
+
* The result is returned via Solana's return data mechanism.
|
|
1584
|
+
*
|
|
1585
|
+
* @param accounts - Required accounts for the instruction
|
|
1586
|
+
* @param args - Instruction arguments (amount, side, maxHops, useTwap, windowSeconds)
|
|
1587
|
+
* @param programId - Program ID (defaults to CPMM program)
|
|
1588
|
+
* @returns Instruction to quote amount in numeraire
|
|
1589
|
+
*
|
|
1590
|
+
* @example
|
|
1591
|
+
* ```ts
|
|
1592
|
+
* // Quote using spot prices (no TWAP)
|
|
1593
|
+
* const ix = createQuoteToNumeraireInstruction(
|
|
1594
|
+
* {
|
|
1595
|
+
* config: configAddress,
|
|
1596
|
+
* startPool: poolAddress,
|
|
1597
|
+
* },
|
|
1598
|
+
* {
|
|
1599
|
+
* amount: 1000000n,
|
|
1600
|
+
* side: 0, // token0
|
|
1601
|
+
* maxHops: 3,
|
|
1602
|
+
* useTwap: false,
|
|
1603
|
+
* windowSeconds: 0,
|
|
1604
|
+
* }
|
|
1605
|
+
* );
|
|
1606
|
+
* ```
|
|
1607
|
+
*/
|
|
1608
|
+
declare function createQuoteToNumeraireInstruction(accounts: QuoteToNumeraireAccounts, args: QuoteToNumeraireArgs, programId?: Address): Instruction;
|
|
1609
|
+
|
|
1610
|
+
/**
|
|
1611
|
+
* Pool fetching and utility functions for the CPMM SDK
|
|
1612
|
+
*/
|
|
1613
|
+
|
|
1614
|
+
/**
|
|
1615
|
+
* Configuration for fetching pools
|
|
1616
|
+
*/
|
|
1617
|
+
interface FetchPoolsConfig {
|
|
1618
|
+
/** Program ID (defaults to CPMM program) */
|
|
1619
|
+
programId?: Address;
|
|
1620
|
+
/** Commitment level */
|
|
1621
|
+
commitment?: 'processed' | 'confirmed' | 'finalized';
|
|
1622
|
+
}
|
|
1623
|
+
/**
|
|
1624
|
+
* Pool with its address
|
|
1625
|
+
*/
|
|
1626
|
+
interface PoolWithAddress {
|
|
1627
|
+
address: Address;
|
|
1628
|
+
account: Pool;
|
|
1629
|
+
}
|
|
1630
|
+
/**
|
|
1631
|
+
* Fetch and decode a single pool account
|
|
1632
|
+
*
|
|
1633
|
+
* @param rpc - Solana RPC client
|
|
1634
|
+
* @param address - Pool account address
|
|
1635
|
+
* @param config - Optional configuration
|
|
1636
|
+
* @returns Decoded pool data or null if not found
|
|
1637
|
+
*
|
|
1638
|
+
* @example
|
|
1639
|
+
* ```ts
|
|
1640
|
+
* const pool = await fetchPool(rpc, poolAddress);
|
|
1641
|
+
* if (pool) {
|
|
1642
|
+
* console.log(`Pool reserves: ${pool.reserve0} / ${pool.reserve1}`);
|
|
1643
|
+
* }
|
|
1644
|
+
* ```
|
|
1645
|
+
*/
|
|
1646
|
+
declare function fetchPool(rpc: Rpc<GetAccountInfoApi>, address: Address, config?: FetchPoolsConfig): Promise<Pool | null>;
|
|
1647
|
+
/**
|
|
1648
|
+
* Fetch all pool accounts for the CPMM program
|
|
1649
|
+
*
|
|
1650
|
+
* Uses getProgramAccounts with a discriminator filter for efficiency.
|
|
1651
|
+
*
|
|
1652
|
+
* @param rpc - Solana RPC client
|
|
1653
|
+
* @param config - Optional configuration
|
|
1654
|
+
* @returns Array of pools with their addresses
|
|
1655
|
+
*
|
|
1656
|
+
* @example
|
|
1657
|
+
* ```ts
|
|
1658
|
+
* const pools = await fetchAllPools(rpc);
|
|
1659
|
+
* console.log(`Found ${pools.length} pools`);
|
|
1660
|
+
* for (const { address, account } of pools) {
|
|
1661
|
+
* console.log(`Pool ${address}: ${account.token0Mint} / ${account.token1Mint}`);
|
|
1662
|
+
* }
|
|
1663
|
+
* ```
|
|
1664
|
+
*/
|
|
1665
|
+
declare function fetchAllPools(rpc: GetProgramAccountsRpc, config?: FetchPoolsConfig): Promise<PoolWithAddress[]>;
|
|
1666
|
+
/**
|
|
1667
|
+
* Find a pool by its token pair mints
|
|
1668
|
+
*
|
|
1669
|
+
* Derives the pool PDA from the mints (automatically sorted) and fetches it.
|
|
1670
|
+
*
|
|
1671
|
+
* @param rpc - Solana RPC client
|
|
1672
|
+
* @param mintA - First token mint
|
|
1673
|
+
* @param mintB - Second token mint
|
|
1674
|
+
* @param config - Optional configuration
|
|
1675
|
+
* @returns Pool data with address, or null if not found
|
|
1676
|
+
*
|
|
1677
|
+
* @example
|
|
1678
|
+
* ```ts
|
|
1679
|
+
* const result = await getPoolByMints(rpc, usdcMint, solMint);
|
|
1680
|
+
* if (result) {
|
|
1681
|
+
* console.log(`Found pool at ${result.address}`);
|
|
1682
|
+
* console.log(`Swap fee: ${result.account.swapFeeBps} bps`);
|
|
1683
|
+
* }
|
|
1684
|
+
* ```
|
|
1685
|
+
*/
|
|
1686
|
+
declare function getPoolByMints(rpc: Rpc<GetAccountInfoApi>, mintA: Address, mintB: Address, config?: FetchPoolsConfig): Promise<PoolWithAddress | null>;
|
|
1687
|
+
/**
|
|
1688
|
+
* Get multiple pools by their addresses in a single batch request
|
|
1689
|
+
*
|
|
1690
|
+
* @param rpc - Solana RPC client
|
|
1691
|
+
* @param addresses - Array of pool addresses to fetch
|
|
1692
|
+
* @param config - Optional configuration
|
|
1693
|
+
* @returns Map of address to pool (missing pools are not included)
|
|
1694
|
+
*
|
|
1695
|
+
* @example
|
|
1696
|
+
* ```ts
|
|
1697
|
+
* const poolMap = await fetchPoolsBatch(rpc, [pool1, pool2, pool3]);
|
|
1698
|
+
* for (const [addr, pool] of poolMap) {
|
|
1699
|
+
* console.log(`Pool ${addr}: TVL = ${pool.reserve0 + pool.reserve1}`);
|
|
1700
|
+
* }
|
|
1701
|
+
* ```
|
|
1702
|
+
*/
|
|
1703
|
+
declare function fetchPoolsBatch(rpc: Rpc<GetAccountInfoApi>, addresses: Address[], config?: FetchPoolsConfig): Promise<Map<Address, Pool>>;
|
|
1704
|
+
/**
|
|
1705
|
+
* Check if a pool exists for a token pair
|
|
1706
|
+
*
|
|
1707
|
+
* @param rpc - Solana RPC client
|
|
1708
|
+
* @param mintA - First token mint
|
|
1709
|
+
* @param mintB - Second token mint
|
|
1710
|
+
* @param config - Optional configuration
|
|
1711
|
+
* @returns true if pool exists, false otherwise
|
|
1712
|
+
*/
|
|
1713
|
+
declare function poolExists(rpc: Rpc<GetAccountInfoApi>, mintA: Address, mintB: Address, config?: FetchPoolsConfig): Promise<boolean>;
|
|
1714
|
+
/**
|
|
1715
|
+
* Get the pool address for a token pair without fetching
|
|
1716
|
+
*
|
|
1717
|
+
* @param mintA - First token mint
|
|
1718
|
+
* @param mintB - Second token mint
|
|
1719
|
+
* @param programId - Program ID (defaults to CPMM program)
|
|
1720
|
+
* @returns Pool address and sorted mints
|
|
1721
|
+
*/
|
|
1722
|
+
declare function getPoolAddressFromMints(mintA: Address, mintB: Address, programId?: Address): Promise<{
|
|
1723
|
+
poolAddress: Address;
|
|
1724
|
+
token0: Address;
|
|
1725
|
+
token1: Address;
|
|
1726
|
+
}>;
|
|
1727
|
+
/**
|
|
1728
|
+
* Filter pools by a specific token mint
|
|
1729
|
+
*
|
|
1730
|
+
* @param pools - Array of pools to filter
|
|
1731
|
+
* @param mint - Token mint to filter by
|
|
1732
|
+
* @returns Pools that contain the specified mint
|
|
1733
|
+
*/
|
|
1734
|
+
declare function filterPoolsByMint(pools: PoolWithAddress[], mint: Address): PoolWithAddress[];
|
|
1735
|
+
/**
|
|
1736
|
+
* Sort pools by total reserves (proxy for TVL)
|
|
1737
|
+
*
|
|
1738
|
+
* @param pools - Array of pools to sort
|
|
1739
|
+
* @param descending - Sort descending (highest first) if true
|
|
1740
|
+
* @returns Sorted array (does not mutate input)
|
|
1741
|
+
*/
|
|
1742
|
+
declare function sortPoolsByReserves(pools: PoolWithAddress[], descending?: boolean): PoolWithAddress[];
|
|
1743
|
+
|
|
1744
|
+
/**
|
|
1745
|
+
* Config fetching and utilities for the CPMM SDK
|
|
1746
|
+
*/
|
|
1747
|
+
|
|
1748
|
+
/**
|
|
1749
|
+
* Fetch and decode the AmmConfig account
|
|
1750
|
+
*
|
|
1751
|
+
* @param rpc - Solana RPC client
|
|
1752
|
+
* @param programId - Program ID (defaults to CPMM program)
|
|
1753
|
+
* @param commitment - Optional commitment level
|
|
1754
|
+
* @returns Decoded config data or null if not found
|
|
1755
|
+
*/
|
|
1756
|
+
declare function fetchConfig(rpc: Rpc<GetAccountInfoApi>, programId?: Address, commitment?: 'processed' | 'confirmed' | 'finalized'): Promise<AmmConfig | null>;
|
|
1757
|
+
/**
|
|
1758
|
+
* Fetch config with its PDA address
|
|
1759
|
+
*/
|
|
1760
|
+
declare function fetchConfigWithAddress(rpc: Rpc<GetAccountInfoApi>, programId?: Address, commitment?: 'processed' | 'confirmed' | 'finalized'): Promise<{
|
|
1761
|
+
address: Address;
|
|
1762
|
+
account: AmmConfig;
|
|
1763
|
+
} | null>;
|
|
1764
|
+
|
|
1765
|
+
/**
|
|
1766
|
+
* Program ID for the Initializer program (devnet in this repo).
|
|
1767
|
+
*
|
|
1768
|
+
* Source of truth: programs/initializer/src/lib.rs
|
|
1769
|
+
*/
|
|
1770
|
+
declare const INITIALIZER_PROGRAM_ID: Address;
|
|
1771
|
+
declare const BPF_LOADER_UPGRADEABLE_PROGRAM_ID: Address;
|
|
1772
|
+
declare const SEED_CONFIG = "config_v3";
|
|
1773
|
+
declare const SEED_LAUNCH = "launch_v3";
|
|
1774
|
+
declare const SEED_LAUNCH_AUTHORITY = "launch_authority_v3";
|
|
1775
|
+
declare const MAX_MIGRATOR_ALLOWLIST = 32;
|
|
1776
|
+
declare const MAX_SENTINEL_ALLOWLIST = 32;
|
|
1777
|
+
declare const MAX_CALLDATA = 256;
|
|
1778
|
+
declare const PHASE_TRADING = 0;
|
|
1779
|
+
declare const PHASE_MIGRATED = 1;
|
|
1780
|
+
declare const PHASE_ABORTED = 2;
|
|
1781
|
+
declare const DIRECTION_BUY = 0;
|
|
1782
|
+
declare const DIRECTION_SELL = 1;
|
|
1783
|
+
declare const CURVE_KIND_XYK = 0;
|
|
1784
|
+
declare const CURVE_PARAMS_FORMAT_XYK_V0 = 0;
|
|
1785
|
+
declare const SF_BEFORE_SWAP: number;
|
|
1786
|
+
declare const SF_AFTER_SWAP: number;
|
|
1787
|
+
declare const SENTINEL_NO_CHANGE = 65535;
|
|
1788
|
+
declare const INITIALIZER_INSTRUCTION_DISCRIMINATORS: {
|
|
1789
|
+
readonly initializeConfig: Uint8Array<ArrayBuffer>;
|
|
1790
|
+
readonly setMigratorAllowlist: Uint8Array<ArrayBuffer>;
|
|
1791
|
+
readonly setSentinelAllowlist: Uint8Array<ArrayBuffer>;
|
|
1792
|
+
readonly initializeLaunch: Uint8Array<ArrayBuffer>;
|
|
1793
|
+
readonly curveSwapExactIn: Uint8Array<ArrayBuffer>;
|
|
1794
|
+
readonly migrateLaunch: Uint8Array<ArrayBuffer>;
|
|
1795
|
+
readonly abortLaunch: Uint8Array<ArrayBuffer>;
|
|
1796
|
+
readonly previewSwapExactIn: Uint8Array<ArrayBuffer>;
|
|
1797
|
+
readonly previewMigration: Uint8Array<ArrayBuffer>;
|
|
1798
|
+
};
|
|
1799
|
+
declare const INITIALIZER_ACCOUNT_DISCRIMINATORS: {
|
|
1800
|
+
readonly InitConfig: Uint8Array<ArrayBuffer>;
|
|
1801
|
+
readonly Launch: Uint8Array<ArrayBuffer>;
|
|
1802
|
+
};
|
|
1803
|
+
|
|
1804
|
+
/**
|
|
1805
|
+
* This code was AUTOGENERATED using the Codama library.
|
|
1806
|
+
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
1807
|
+
* to add features, then rerun Codama to update it.
|
|
1808
|
+
*
|
|
1809
|
+
* @see https://github.com/codama-idl/codama
|
|
1810
|
+
*/
|
|
1811
|
+
|
|
1812
|
+
type InitConfig = {
|
|
1813
|
+
discriminator: ReadonlyUint8Array;
|
|
1814
|
+
admin: Address;
|
|
1815
|
+
migratorAllowlistLen: number;
|
|
1816
|
+
migratorAllowlist: Array<Address>;
|
|
1817
|
+
sentinelAllowlistLen: number;
|
|
1818
|
+
sentinelAllowlist: Array<Address>;
|
|
1819
|
+
bump: number;
|
|
1820
|
+
version: number;
|
|
1821
|
+
reserved: ReadonlyUint8Array;
|
|
1822
|
+
};
|
|
1823
|
+
type InitConfigArgs = {
|
|
1824
|
+
admin: Address;
|
|
1825
|
+
migratorAllowlistLen: number;
|
|
1826
|
+
migratorAllowlist: Array<Address>;
|
|
1827
|
+
sentinelAllowlistLen: number;
|
|
1828
|
+
sentinelAllowlist: Array<Address>;
|
|
1829
|
+
bump: number;
|
|
1830
|
+
version: number;
|
|
1831
|
+
reserved: ReadonlyUint8Array;
|
|
1832
|
+
};
|
|
1833
|
+
/** Gets the encoder for {@link InitConfigArgs} account data. */
|
|
1834
|
+
declare function getInitConfigEncoder(): FixedSizeEncoder<InitConfigArgs>;
|
|
1835
|
+
/** Gets the decoder for {@link InitConfig} account data. */
|
|
1836
|
+
declare function getInitConfigDecoder(): FixedSizeDecoder<InitConfig>;
|
|
1837
|
+
/** Gets the codec for {@link InitConfig} account data. */
|
|
1838
|
+
declare function getInitConfigCodec(): FixedSizeCodec<InitConfigArgs, InitConfig>;
|
|
1839
|
+
|
|
1840
|
+
/**
|
|
1841
|
+
* This code was AUTOGENERATED using the Codama library.
|
|
1842
|
+
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
1843
|
+
* to add features, then rerun Codama to update it.
|
|
1844
|
+
*
|
|
1845
|
+
* @see https://github.com/codama-idl/codama
|
|
1846
|
+
*/
|
|
1847
|
+
|
|
1848
|
+
type CalldataBuf = {
|
|
1849
|
+
len: number;
|
|
1850
|
+
bytes: ReadonlyUint8Array;
|
|
1851
|
+
};
|
|
1852
|
+
type CalldataBufArgs = CalldataBuf;
|
|
1853
|
+
|
|
1854
|
+
/**
|
|
1855
|
+
* This code was AUTOGENERATED using the Codama library.
|
|
1856
|
+
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
1857
|
+
* to add features, then rerun Codama to update it.
|
|
1858
|
+
*
|
|
1859
|
+
* @see https://github.com/codama-idl/codama
|
|
1860
|
+
*/
|
|
1861
|
+
|
|
1862
|
+
type InitializeConfigArgs = {
|
|
1863
|
+
migratorAllowlist: Array<Address>;
|
|
1864
|
+
sentinelAllowlist: Array<Address>;
|
|
1865
|
+
};
|
|
1866
|
+
type InitializeConfigArgsArgs = InitializeConfigArgs;
|
|
1867
|
+
declare function getInitializeConfigArgsEncoder(): Encoder<InitializeConfigArgsArgs>;
|
|
1868
|
+
declare function getInitializeConfigArgsDecoder(): Decoder<InitializeConfigArgs>;
|
|
1869
|
+
declare function getInitializeConfigArgsCodec(): Codec<InitializeConfigArgsArgs, InitializeConfigArgs>;
|
|
1870
|
+
|
|
1871
|
+
/**
|
|
1872
|
+
* This code was AUTOGENERATED using the Codama library.
|
|
1873
|
+
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
1874
|
+
* to add features, then rerun Codama to update it.
|
|
1875
|
+
*
|
|
1876
|
+
* @see https://github.com/codama-idl/codama
|
|
1877
|
+
*/
|
|
1878
|
+
|
|
1879
|
+
type InitializeLaunchArgs = {
|
|
1880
|
+
namespace: Address;
|
|
1881
|
+
launchId: ReadonlyUint8Array;
|
|
1882
|
+
baseDecimals: number;
|
|
1883
|
+
baseTotalSupply: bigint;
|
|
1884
|
+
baseForDistribution: bigint;
|
|
1885
|
+
baseForLiquidity: bigint;
|
|
1886
|
+
curveVirtualBase: bigint;
|
|
1887
|
+
curveVirtualQuote: bigint;
|
|
1888
|
+
curveFeeBps: number;
|
|
1889
|
+
curveKind: number;
|
|
1890
|
+
curveParams: ReadonlyUint8Array;
|
|
1891
|
+
allowBuy: number;
|
|
1892
|
+
allowSell: number;
|
|
1893
|
+
sentinelProgram: Address;
|
|
1894
|
+
sentinelFlags: number;
|
|
1895
|
+
sentinelCalldata: ReadonlyUint8Array;
|
|
1896
|
+
migratorProgram: Address;
|
|
1897
|
+
migratorInitCalldata: ReadonlyUint8Array;
|
|
1898
|
+
migratorMigrateCalldata: ReadonlyUint8Array;
|
|
1899
|
+
/**
|
|
1900
|
+
* Commitment hash for swap/preview sentinel remaining accounts.
|
|
1901
|
+
* Computed as hash(u32_len || pubkey_0 || ... || pubkey_n).
|
|
1902
|
+
*/
|
|
1903
|
+
sentinelRemainingAccountsHash: ReadonlyUint8Array;
|
|
1904
|
+
/**
|
|
1905
|
+
* Commitment hash for migrate remaining accounts.
|
|
1906
|
+
* Computed as hash(u32_len || pubkey_0 || ... || pubkey_n).
|
|
1907
|
+
*/
|
|
1908
|
+
migratorRemainingAccountsHash: ReadonlyUint8Array;
|
|
1909
|
+
/** Token name for on-chain metadata. If empty, metadata creation is skipped. */
|
|
1910
|
+
metadataName: string;
|
|
1911
|
+
/** Token symbol for on-chain metadata. */
|
|
1912
|
+
metadataSymbol: string;
|
|
1913
|
+
/** Metadata JSON URI for on-chain metadata. */
|
|
1914
|
+
metadataUri: string;
|
|
1915
|
+
};
|
|
1916
|
+
type InitializeLaunchArgsArgs = {
|
|
1917
|
+
namespace: Address;
|
|
1918
|
+
launchId: ReadonlyUint8Array;
|
|
1919
|
+
baseDecimals: number;
|
|
1920
|
+
baseTotalSupply: number | bigint;
|
|
1921
|
+
baseForDistribution: number | bigint;
|
|
1922
|
+
baseForLiquidity: number | bigint;
|
|
1923
|
+
curveVirtualBase: number | bigint;
|
|
1924
|
+
curveVirtualQuote: number | bigint;
|
|
1925
|
+
curveFeeBps: number;
|
|
1926
|
+
curveKind: number;
|
|
1927
|
+
curveParams: ReadonlyUint8Array;
|
|
1928
|
+
allowBuy: number;
|
|
1929
|
+
allowSell: number;
|
|
1930
|
+
sentinelProgram: Address;
|
|
1931
|
+
sentinelFlags: number;
|
|
1932
|
+
sentinelCalldata: ReadonlyUint8Array;
|
|
1933
|
+
migratorProgram: Address;
|
|
1934
|
+
migratorInitCalldata: ReadonlyUint8Array;
|
|
1935
|
+
migratorMigrateCalldata: ReadonlyUint8Array;
|
|
1936
|
+
/**
|
|
1937
|
+
* Commitment hash for swap/preview sentinel remaining accounts.
|
|
1938
|
+
* Computed as hash(u32_len || pubkey_0 || ... || pubkey_n).
|
|
1939
|
+
*/
|
|
1940
|
+
sentinelRemainingAccountsHash: ReadonlyUint8Array;
|
|
1941
|
+
/**
|
|
1942
|
+
* Commitment hash for migrate remaining accounts.
|
|
1943
|
+
* Computed as hash(u32_len || pubkey_0 || ... || pubkey_n).
|
|
1944
|
+
*/
|
|
1945
|
+
migratorRemainingAccountsHash: ReadonlyUint8Array;
|
|
1946
|
+
/** Token name for on-chain metadata. If empty, metadata creation is skipped. */
|
|
1947
|
+
metadataName: string;
|
|
1948
|
+
/** Token symbol for on-chain metadata. */
|
|
1949
|
+
metadataSymbol: string;
|
|
1950
|
+
/** Metadata JSON URI for on-chain metadata. */
|
|
1951
|
+
metadataUri: string;
|
|
1952
|
+
};
|
|
1953
|
+
declare function getInitializeLaunchArgsEncoder(): Encoder<InitializeLaunchArgsArgs>;
|
|
1954
|
+
declare function getInitializeLaunchArgsDecoder(): Decoder<InitializeLaunchArgs>;
|
|
1955
|
+
declare function getInitializeLaunchArgsCodec(): Codec<InitializeLaunchArgsArgs, InitializeLaunchArgs>;
|
|
1956
|
+
|
|
1957
|
+
/**
|
|
1958
|
+
* This code was AUTOGENERATED using the Codama library.
|
|
1959
|
+
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
1960
|
+
* to add features, then rerun Codama to update it.
|
|
1961
|
+
*
|
|
1962
|
+
* @see https://github.com/codama-idl/codama
|
|
1963
|
+
*/
|
|
1964
|
+
|
|
1965
|
+
type Launch = {
|
|
1966
|
+
discriminator: ReadonlyUint8Array;
|
|
1967
|
+
authority: Address;
|
|
1968
|
+
namespace: Address;
|
|
1969
|
+
launchId: ReadonlyUint8Array;
|
|
1970
|
+
phase: number;
|
|
1971
|
+
bump: number;
|
|
1972
|
+
launchAuthorityBump: number;
|
|
1973
|
+
pad0: ReadonlyUint8Array;
|
|
1974
|
+
baseMint: Address;
|
|
1975
|
+
quoteMint: Address;
|
|
1976
|
+
baseVault: Address;
|
|
1977
|
+
quoteVault: Address;
|
|
1978
|
+
baseTotalSupply: bigint;
|
|
1979
|
+
baseForDistribution: bigint;
|
|
1980
|
+
baseForLiquidity: bigint;
|
|
1981
|
+
baseForCurve: bigint;
|
|
1982
|
+
curveVirtualBase: bigint;
|
|
1983
|
+
curveVirtualQuote: bigint;
|
|
1984
|
+
curveFeeBps: number;
|
|
1985
|
+
pad1: ReadonlyUint8Array;
|
|
1986
|
+
allowBuy: number;
|
|
1987
|
+
allowSell: number;
|
|
1988
|
+
pad2: ReadonlyUint8Array;
|
|
1989
|
+
sentinelProgram: Address;
|
|
1990
|
+
sentinelFlags: number;
|
|
1991
|
+
pad3: ReadonlyUint8Array;
|
|
1992
|
+
sentinelCalldata: CalldataBuf;
|
|
1993
|
+
migratorProgram: Address;
|
|
1994
|
+
migratorInitCalldata: CalldataBuf;
|
|
1995
|
+
migratorMigrateCalldata: CalldataBuf;
|
|
1996
|
+
curveKind: number;
|
|
1997
|
+
swapLock: number;
|
|
1998
|
+
pad4: ReadonlyUint8Array;
|
|
1999
|
+
curveParams: CalldataBuf;
|
|
2000
|
+
quoteDeposited: bigint;
|
|
2001
|
+
reserved: ReadonlyUint8Array;
|
|
2002
|
+
};
|
|
2003
|
+
type LaunchArgs = {
|
|
2004
|
+
authority: Address;
|
|
2005
|
+
namespace: Address;
|
|
2006
|
+
launchId: ReadonlyUint8Array;
|
|
2007
|
+
phase: number;
|
|
2008
|
+
bump: number;
|
|
2009
|
+
launchAuthorityBump: number;
|
|
2010
|
+
pad0: ReadonlyUint8Array;
|
|
2011
|
+
baseMint: Address;
|
|
2012
|
+
quoteMint: Address;
|
|
2013
|
+
baseVault: Address;
|
|
2014
|
+
quoteVault: Address;
|
|
2015
|
+
baseTotalSupply: number | bigint;
|
|
2016
|
+
baseForDistribution: number | bigint;
|
|
2017
|
+
baseForLiquidity: number | bigint;
|
|
2018
|
+
baseForCurve: number | bigint;
|
|
2019
|
+
curveVirtualBase: number | bigint;
|
|
2020
|
+
curveVirtualQuote: number | bigint;
|
|
2021
|
+
curveFeeBps: number;
|
|
2022
|
+
pad1: ReadonlyUint8Array;
|
|
2023
|
+
allowBuy: number;
|
|
2024
|
+
allowSell: number;
|
|
2025
|
+
pad2: ReadonlyUint8Array;
|
|
2026
|
+
sentinelProgram: Address;
|
|
2027
|
+
sentinelFlags: number;
|
|
2028
|
+
pad3: ReadonlyUint8Array;
|
|
2029
|
+
sentinelCalldata: CalldataBufArgs;
|
|
2030
|
+
migratorProgram: Address;
|
|
2031
|
+
migratorInitCalldata: CalldataBufArgs;
|
|
2032
|
+
migratorMigrateCalldata: CalldataBufArgs;
|
|
2033
|
+
curveKind: number;
|
|
2034
|
+
swapLock: number;
|
|
2035
|
+
pad4: ReadonlyUint8Array;
|
|
2036
|
+
curveParams: CalldataBufArgs;
|
|
2037
|
+
quoteDeposited: number | bigint;
|
|
2038
|
+
reserved: ReadonlyUint8Array;
|
|
2039
|
+
};
|
|
2040
|
+
/** Gets the encoder for {@link LaunchArgs} account data. */
|
|
2041
|
+
declare function getLaunchEncoder(): FixedSizeEncoder<LaunchArgs>;
|
|
2042
|
+
/** Gets the decoder for {@link Launch} account data. */
|
|
2043
|
+
declare function getLaunchDecoder(): FixedSizeDecoder<Launch>;
|
|
2044
|
+
/** Gets the codec for {@link Launch} account data. */
|
|
2045
|
+
declare function getLaunchCodec(): FixedSizeCodec<LaunchArgs, Launch>;
|
|
2046
|
+
|
|
2047
|
+
declare function encodeU64LE(value: bigint): Uint8Array;
|
|
2048
|
+
/**
|
|
2049
|
+
* Derive the InitConfig PDA address.
|
|
2050
|
+
* Seeds: ['config_v3']
|
|
2051
|
+
*/
|
|
2052
|
+
declare function getConfigAddress(programId?: Address): Promise<ProgramDerivedAddress>;
|
|
2053
|
+
/**
|
|
2054
|
+
* Derive the ProgramData PDA for an upgradeable program.
|
|
2055
|
+
* Seeds: [initializer_program_id] with program = BPFLoaderUpgradeable.
|
|
2056
|
+
*/
|
|
2057
|
+
declare function getProgramDataAddress(programId?: Address): Promise<ProgramDerivedAddress>;
|
|
2058
|
+
/**
|
|
2059
|
+
* Derive the Launch PDA address.
|
|
2060
|
+
* Seeds: ['launch_v3', namespace, launch_id_bytes_32]
|
|
2061
|
+
*/
|
|
2062
|
+
declare function getLaunchAddress(namespace: Address, launchId: Uint8Array, programId?: Address): Promise<ProgramDerivedAddress>;
|
|
2063
|
+
/**
|
|
2064
|
+
* Derive the Launch authority PDA address.
|
|
2065
|
+
* Seeds: ['launch_authority_v3', launch]
|
|
2066
|
+
*/
|
|
2067
|
+
declare function getLaunchAuthorityAddress(launch: Address, programId?: Address): Promise<ProgramDerivedAddress>;
|
|
2068
|
+
/**
|
|
2069
|
+
* Convenience helper for the common pattern: embed a u64 into a 32-byte launch_id.
|
|
2070
|
+
*/
|
|
2071
|
+
declare function launchIdFromU64(launchId: bigint): Uint8Array;
|
|
2072
|
+
|
|
2073
|
+
type AddressOrSigner$6 = Address | TransactionSigner;
|
|
2074
|
+
interface InitializeConfigAccounts {
|
|
2075
|
+
admin: AddressOrSigner$6;
|
|
2076
|
+
config: Address;
|
|
2077
|
+
programData: Address;
|
|
2078
|
+
systemProgram?: Address;
|
|
2079
|
+
}
|
|
2080
|
+
declare function createInitializeConfigInstruction(accounts: InitializeConfigAccounts, args: InitializeConfigArgsArgs, programId?: Address): Instruction;
|
|
2081
|
+
|
|
2082
|
+
type AddressOrSigner$5 = Address | TransactionSigner;
|
|
2083
|
+
interface SetMigratorAllowlistAccounts {
|
|
2084
|
+
admin: AddressOrSigner$5;
|
|
2085
|
+
config: Address;
|
|
2086
|
+
}
|
|
2087
|
+
declare function createSetMigratorAllowlistInstruction(accounts: SetMigratorAllowlistAccounts, allowlist: Address[], programId?: Address): Instruction;
|
|
2088
|
+
|
|
2089
|
+
type AddressOrSigner$4 = Address | TransactionSigner;
|
|
2090
|
+
interface SetSentinelAllowlistAccounts {
|
|
2091
|
+
admin: AddressOrSigner$4;
|
|
2092
|
+
config: Address;
|
|
2093
|
+
}
|
|
2094
|
+
declare function createSetSentinelAllowlistInstruction(accounts: SetSentinelAllowlistAccounts, allowlist: Address[], programId?: Address): Instruction;
|
|
2095
|
+
|
|
2096
|
+
type AddressOrSigner$3 = Address | TransactionSigner;
|
|
2097
|
+
interface InitializeLaunchAccounts {
|
|
2098
|
+
config: Address;
|
|
2099
|
+
launch: Address;
|
|
2100
|
+
launchAuthority: Address;
|
|
2101
|
+
baseMint: AddressOrSigner$3;
|
|
2102
|
+
quoteMint: Address;
|
|
2103
|
+
baseVault: AddressOrSigner$3;
|
|
2104
|
+
quoteVault: AddressOrSigner$3;
|
|
2105
|
+
payer: AddressOrSigner$3;
|
|
2106
|
+
authority?: AddressOrSigner$3;
|
|
2107
|
+
migratorProgram?: Address;
|
|
2108
|
+
tokenProgram?: Address;
|
|
2109
|
+
systemProgram?: Address;
|
|
2110
|
+
rent: Address;
|
|
2111
|
+
}
|
|
2112
|
+
declare function createInitializeLaunchInstruction(accounts: InitializeLaunchAccounts, args: InitializeLaunchArgsArgs, programId?: Address): Instruction;
|
|
2113
|
+
|
|
2114
|
+
type AddressOrSigner$2 = Address | TransactionSigner;
|
|
2115
|
+
interface CurveSwapExactInAccounts {
|
|
2116
|
+
config: Address;
|
|
2117
|
+
launch: Address;
|
|
2118
|
+
launchAuthority: Address;
|
|
2119
|
+
baseVault: Address;
|
|
2120
|
+
quoteVault: Address;
|
|
2121
|
+
userBaseAccount: Address;
|
|
2122
|
+
userQuoteAccount: Address;
|
|
2123
|
+
baseMint: Address;
|
|
2124
|
+
quoteMint: Address;
|
|
2125
|
+
user: AddressOrSigner$2;
|
|
2126
|
+
sentinelProgram?: Address;
|
|
2127
|
+
tokenProgram?: Address;
|
|
2128
|
+
}
|
|
2129
|
+
declare function createCurveSwapExactInInstruction(accounts: CurveSwapExactInAccounts, args: {
|
|
2130
|
+
amountIn: bigint;
|
|
2131
|
+
minAmountOut: bigint;
|
|
2132
|
+
direction: number;
|
|
2133
|
+
}, programId?: Address): Instruction;
|
|
2134
|
+
|
|
2135
|
+
type AddressOrSigner$1 = Address | TransactionSigner;
|
|
2136
|
+
interface MigrateLaunchAccounts {
|
|
2137
|
+
config: Address;
|
|
2138
|
+
launch: Address;
|
|
2139
|
+
launchAuthority: Address;
|
|
2140
|
+
baseMint: Address;
|
|
2141
|
+
quoteMint: Address;
|
|
2142
|
+
baseVault: Address;
|
|
2143
|
+
quoteVault: Address;
|
|
2144
|
+
migratorProgram: Address;
|
|
2145
|
+
payer: AddressOrSigner$1;
|
|
2146
|
+
tokenProgram?: Address;
|
|
2147
|
+
systemProgram?: Address;
|
|
2148
|
+
rent: Address;
|
|
2149
|
+
}
|
|
2150
|
+
declare function createMigrateLaunchInstruction(accounts: MigrateLaunchAccounts, programId?: Address): Instruction;
|
|
2151
|
+
|
|
2152
|
+
type AddressOrSigner = Address | TransactionSigner;
|
|
2153
|
+
interface AbortLaunchAccounts {
|
|
2154
|
+
config: Address;
|
|
2155
|
+
launch: Address;
|
|
2156
|
+
launchAuthority: Address;
|
|
2157
|
+
baseVault: Address;
|
|
2158
|
+
quoteVault: Address;
|
|
2159
|
+
authority: AddressOrSigner;
|
|
2160
|
+
authorityBaseAccount: Address;
|
|
2161
|
+
baseMint: Address;
|
|
2162
|
+
tokenProgram?: Address;
|
|
2163
|
+
}
|
|
2164
|
+
declare function createAbortLaunchInstruction(accounts: AbortLaunchAccounts, programId?: Address): Instruction;
|
|
2165
|
+
|
|
2166
|
+
interface PreviewSwapExactInResult {
|
|
2167
|
+
amountOut: bigint;
|
|
2168
|
+
feePaid: bigint;
|
|
2169
|
+
}
|
|
2170
|
+
interface PreviewSwapExactInAccounts {
|
|
2171
|
+
launch: Address;
|
|
2172
|
+
baseVault: Address;
|
|
2173
|
+
quoteVault: Address;
|
|
2174
|
+
sentinelProgram?: Address;
|
|
2175
|
+
}
|
|
2176
|
+
declare function createPreviewSwapExactInInstruction(accounts: PreviewSwapExactInAccounts, args: {
|
|
2177
|
+
amountIn: bigint;
|
|
2178
|
+
direction: number;
|
|
2179
|
+
}, programId?: Address): Instruction;
|
|
2180
|
+
declare function decodePreviewSwapExactInResult(data: Uint8Array): PreviewSwapExactInResult;
|
|
2181
|
+
|
|
2182
|
+
interface PreviewMigrationResult {
|
|
2183
|
+
baseVaultAmount: bigint;
|
|
2184
|
+
quoteVaultAmount: bigint;
|
|
2185
|
+
baseMintSupply: bigint;
|
|
2186
|
+
}
|
|
2187
|
+
interface PreviewMigrationAccounts {
|
|
2188
|
+
launch: Address;
|
|
2189
|
+
baseMint: Address;
|
|
2190
|
+
baseVault: Address;
|
|
2191
|
+
quoteVault: Address;
|
|
2192
|
+
}
|
|
2193
|
+
declare function createPreviewMigrationInstruction(accounts: PreviewMigrationAccounts, programId?: Address): Instruction;
|
|
2194
|
+
declare function decodePreviewMigrationResult(data: Uint8Array): PreviewMigrationResult;
|
|
2195
|
+
|
|
2196
|
+
/**
|
|
2197
|
+
* Launch fetching functions for the Initializer SDK
|
|
2198
|
+
*/
|
|
2199
|
+
|
|
2200
|
+
interface FetchLaunchesConfig {
|
|
2201
|
+
programId?: Address;
|
|
2202
|
+
commitment?: 'processed' | 'confirmed' | 'finalized';
|
|
2203
|
+
}
|
|
2204
|
+
interface LaunchWithAddress {
|
|
2205
|
+
address: Address;
|
|
2206
|
+
account: Launch;
|
|
2207
|
+
}
|
|
2208
|
+
declare function fetchLaunch(rpc: Rpc<GetAccountInfoApi>, address: Address, config?: FetchLaunchesConfig): Promise<Launch | null>;
|
|
2209
|
+
declare function fetchAllLaunches(rpc: GetProgramAccountsRpc, config?: FetchLaunchesConfig): Promise<LaunchWithAddress[]>;
|
|
2210
|
+
/**
|
|
2211
|
+
* Fetch launches filtered by Launch.authority (offset 8).
|
|
2212
|
+
* Note: Permissionless launches have authority == Pubkey::default().
|
|
2213
|
+
*/
|
|
2214
|
+
declare function fetchLaunchesByAuthority(rpc: GetProgramAccountsRpc, authority: Address, config?: FetchLaunchesConfig): Promise<LaunchWithAddress[]>;
|
|
2215
|
+
declare function launchExists(rpc: Rpc<GetAccountInfoApi>, namespace: Address, launchId: Uint8Array, config?: FetchLaunchesConfig): Promise<boolean>;
|
|
2216
|
+
|
|
2217
|
+
type index$1_AbortLaunchAccounts = AbortLaunchAccounts;
|
|
2218
|
+
declare const index$1_BPF_LOADER_UPGRADEABLE_PROGRAM_ID: typeof BPF_LOADER_UPGRADEABLE_PROGRAM_ID;
|
|
2219
|
+
declare const index$1_CURVE_KIND_XYK: typeof CURVE_KIND_XYK;
|
|
2220
|
+
declare const index$1_CURVE_PARAMS_FORMAT_XYK_V0: typeof CURVE_PARAMS_FORMAT_XYK_V0;
|
|
2221
|
+
type index$1_CalldataBuf = CalldataBuf;
|
|
2222
|
+
type index$1_CurveSwapExactInAccounts = CurveSwapExactInAccounts;
|
|
2223
|
+
declare const index$1_DIRECTION_BUY: typeof DIRECTION_BUY;
|
|
2224
|
+
declare const index$1_DIRECTION_SELL: typeof DIRECTION_SELL;
|
|
2225
|
+
type index$1_FetchLaunchesConfig = FetchLaunchesConfig;
|
|
2226
|
+
declare const index$1_INITIALIZER_ACCOUNT_DISCRIMINATORS: typeof INITIALIZER_ACCOUNT_DISCRIMINATORS;
|
|
2227
|
+
declare const index$1_INITIALIZER_INSTRUCTION_DISCRIMINATORS: typeof INITIALIZER_INSTRUCTION_DISCRIMINATORS;
|
|
2228
|
+
declare const index$1_INITIALIZER_PROGRAM_ID: typeof INITIALIZER_PROGRAM_ID;
|
|
2229
|
+
type index$1_InitConfig = InitConfig;
|
|
2230
|
+
type index$1_InitConfigArgs = InitConfigArgs;
|
|
2231
|
+
type index$1_InitializeConfigAccounts = InitializeConfigAccounts;
|
|
2232
|
+
type index$1_InitializeConfigArgs = InitializeConfigArgs;
|
|
2233
|
+
type index$1_InitializeConfigArgsArgs = InitializeConfigArgsArgs;
|
|
2234
|
+
type index$1_InitializeLaunchAccounts = InitializeLaunchAccounts;
|
|
2235
|
+
type index$1_InitializeLaunchArgs = InitializeLaunchArgs;
|
|
2236
|
+
type index$1_InitializeLaunchArgsArgs = InitializeLaunchArgsArgs;
|
|
2237
|
+
type index$1_Launch = Launch;
|
|
2238
|
+
type index$1_LaunchArgs = LaunchArgs;
|
|
2239
|
+
type index$1_LaunchWithAddress = LaunchWithAddress;
|
|
2240
|
+
declare const index$1_MAX_CALLDATA: typeof MAX_CALLDATA;
|
|
2241
|
+
declare const index$1_MAX_MIGRATOR_ALLOWLIST: typeof MAX_MIGRATOR_ALLOWLIST;
|
|
2242
|
+
declare const index$1_MAX_SENTINEL_ALLOWLIST: typeof MAX_SENTINEL_ALLOWLIST;
|
|
2243
|
+
type index$1_MigrateLaunchAccounts = MigrateLaunchAccounts;
|
|
2244
|
+
declare const index$1_PHASE_ABORTED: typeof PHASE_ABORTED;
|
|
2245
|
+
declare const index$1_PHASE_MIGRATED: typeof PHASE_MIGRATED;
|
|
2246
|
+
declare const index$1_PHASE_TRADING: typeof PHASE_TRADING;
|
|
2247
|
+
type index$1_PreviewMigrationAccounts = PreviewMigrationAccounts;
|
|
2248
|
+
type index$1_PreviewMigrationResult = PreviewMigrationResult;
|
|
2249
|
+
type index$1_PreviewSwapExactInAccounts = PreviewSwapExactInAccounts;
|
|
2250
|
+
type index$1_PreviewSwapExactInResult = PreviewSwapExactInResult;
|
|
2251
|
+
declare const index$1_SEED_CONFIG: typeof SEED_CONFIG;
|
|
2252
|
+
declare const index$1_SEED_LAUNCH: typeof SEED_LAUNCH;
|
|
2253
|
+
declare const index$1_SEED_LAUNCH_AUTHORITY: typeof SEED_LAUNCH_AUTHORITY;
|
|
2254
|
+
declare const index$1_SENTINEL_NO_CHANGE: typeof SENTINEL_NO_CHANGE;
|
|
2255
|
+
declare const index$1_SF_AFTER_SWAP: typeof SF_AFTER_SWAP;
|
|
2256
|
+
declare const index$1_SF_BEFORE_SWAP: typeof SF_BEFORE_SWAP;
|
|
2257
|
+
type index$1_SetMigratorAllowlistAccounts = SetMigratorAllowlistAccounts;
|
|
2258
|
+
type index$1_SetSentinelAllowlistAccounts = SetSentinelAllowlistAccounts;
|
|
2259
|
+
declare const index$1_createAbortLaunchInstruction: typeof createAbortLaunchInstruction;
|
|
2260
|
+
declare const index$1_createCurveSwapExactInInstruction: typeof createCurveSwapExactInInstruction;
|
|
2261
|
+
declare const index$1_createInitializeConfigInstruction: typeof createInitializeConfigInstruction;
|
|
2262
|
+
declare const index$1_createInitializeLaunchInstruction: typeof createInitializeLaunchInstruction;
|
|
2263
|
+
declare const index$1_createMigrateLaunchInstruction: typeof createMigrateLaunchInstruction;
|
|
2264
|
+
declare const index$1_createPreviewMigrationInstruction: typeof createPreviewMigrationInstruction;
|
|
2265
|
+
declare const index$1_createPreviewSwapExactInInstruction: typeof createPreviewSwapExactInInstruction;
|
|
2266
|
+
declare const index$1_createSetMigratorAllowlistInstruction: typeof createSetMigratorAllowlistInstruction;
|
|
2267
|
+
declare const index$1_createSetSentinelAllowlistInstruction: typeof createSetSentinelAllowlistInstruction;
|
|
2268
|
+
declare const index$1_decodePreviewMigrationResult: typeof decodePreviewMigrationResult;
|
|
2269
|
+
declare const index$1_decodePreviewSwapExactInResult: typeof decodePreviewSwapExactInResult;
|
|
2270
|
+
declare const index$1_encodeU64LE: typeof encodeU64LE;
|
|
2271
|
+
declare const index$1_fetchAllLaunches: typeof fetchAllLaunches;
|
|
2272
|
+
declare const index$1_fetchLaunch: typeof fetchLaunch;
|
|
2273
|
+
declare const index$1_fetchLaunchesByAuthority: typeof fetchLaunchesByAuthority;
|
|
2274
|
+
declare const index$1_getConfigAddress: typeof getConfigAddress;
|
|
2275
|
+
declare const index$1_getInitConfigCodec: typeof getInitConfigCodec;
|
|
2276
|
+
declare const index$1_getInitConfigDecoder: typeof getInitConfigDecoder;
|
|
2277
|
+
declare const index$1_getInitConfigEncoder: typeof getInitConfigEncoder;
|
|
2278
|
+
declare const index$1_getInitializeConfigArgsCodec: typeof getInitializeConfigArgsCodec;
|
|
2279
|
+
declare const index$1_getInitializeConfigArgsDecoder: typeof getInitializeConfigArgsDecoder;
|
|
2280
|
+
declare const index$1_getInitializeConfigArgsEncoder: typeof getInitializeConfigArgsEncoder;
|
|
2281
|
+
declare const index$1_getInitializeLaunchArgsCodec: typeof getInitializeLaunchArgsCodec;
|
|
2282
|
+
declare const index$1_getInitializeLaunchArgsDecoder: typeof getInitializeLaunchArgsDecoder;
|
|
2283
|
+
declare const index$1_getInitializeLaunchArgsEncoder: typeof getInitializeLaunchArgsEncoder;
|
|
2284
|
+
declare const index$1_getLaunchAddress: typeof getLaunchAddress;
|
|
2285
|
+
declare const index$1_getLaunchAuthorityAddress: typeof getLaunchAuthorityAddress;
|
|
2286
|
+
declare const index$1_getLaunchCodec: typeof getLaunchCodec;
|
|
2287
|
+
declare const index$1_getLaunchDecoder: typeof getLaunchDecoder;
|
|
2288
|
+
declare const index$1_getLaunchEncoder: typeof getLaunchEncoder;
|
|
2289
|
+
declare const index$1_getProgramDataAddress: typeof getProgramDataAddress;
|
|
2290
|
+
declare const index$1_launchExists: typeof launchExists;
|
|
2291
|
+
declare const index$1_launchIdFromU64: typeof launchIdFromU64;
|
|
2292
|
+
declare namespace index$1 {
|
|
2293
|
+
export { type index$1_AbortLaunchAccounts as AbortLaunchAccounts, index$1_BPF_LOADER_UPGRADEABLE_PROGRAM_ID as BPF_LOADER_UPGRADEABLE_PROGRAM_ID, index$1_CURVE_KIND_XYK as CURVE_KIND_XYK, index$1_CURVE_PARAMS_FORMAT_XYK_V0 as CURVE_PARAMS_FORMAT_XYK_V0, type index$1_CalldataBuf as CalldataBuf, type index$1_CurveSwapExactInAccounts as CurveSwapExactInAccounts, index$1_DIRECTION_BUY as DIRECTION_BUY, index$1_DIRECTION_SELL as DIRECTION_SELL, type index$1_FetchLaunchesConfig as FetchLaunchesConfig, index$1_INITIALIZER_ACCOUNT_DISCRIMINATORS as INITIALIZER_ACCOUNT_DISCRIMINATORS, index$1_INITIALIZER_INSTRUCTION_DISCRIMINATORS as INITIALIZER_INSTRUCTION_DISCRIMINATORS, index$1_INITIALIZER_PROGRAM_ID as INITIALIZER_PROGRAM_ID, type index$1_InitConfig as InitConfig, type index$1_InitConfigArgs as InitConfigArgs, type index$1_InitializeConfigAccounts as InitializeConfigAccounts, type index$1_InitializeConfigArgs as InitializeConfigArgs, type index$1_InitializeConfigArgsArgs as InitializeConfigArgsArgs, type index$1_InitializeLaunchAccounts as InitializeLaunchAccounts, type index$1_InitializeLaunchArgs as InitializeLaunchArgs, type index$1_InitializeLaunchArgsArgs as InitializeLaunchArgsArgs, type index$1_Launch as Launch, type index$1_LaunchArgs as LaunchArgs, type index$1_LaunchWithAddress as LaunchWithAddress, index$1_MAX_CALLDATA as MAX_CALLDATA, index$1_MAX_MIGRATOR_ALLOWLIST as MAX_MIGRATOR_ALLOWLIST, index$1_MAX_SENTINEL_ALLOWLIST as MAX_SENTINEL_ALLOWLIST, type index$1_MigrateLaunchAccounts as MigrateLaunchAccounts, index$1_PHASE_ABORTED as PHASE_ABORTED, index$1_PHASE_MIGRATED as PHASE_MIGRATED, index$1_PHASE_TRADING as PHASE_TRADING, type index$1_PreviewMigrationAccounts as PreviewMigrationAccounts, type index$1_PreviewMigrationResult as PreviewMigrationResult, type index$1_PreviewSwapExactInAccounts as PreviewSwapExactInAccounts, type index$1_PreviewSwapExactInResult as PreviewSwapExactInResult, index$1_SEED_CONFIG as SEED_CONFIG, index$1_SEED_LAUNCH as SEED_LAUNCH, index$1_SEED_LAUNCH_AUTHORITY as SEED_LAUNCH_AUTHORITY, index$1_SENTINEL_NO_CHANGE as SENTINEL_NO_CHANGE, index$1_SF_AFTER_SWAP as SF_AFTER_SWAP, index$1_SF_BEFORE_SWAP as SF_BEFORE_SWAP, type index$1_SetMigratorAllowlistAccounts as SetMigratorAllowlistAccounts, type index$1_SetSentinelAllowlistAccounts as SetSentinelAllowlistAccounts, index$1_createAbortLaunchInstruction as createAbortLaunchInstruction, index$1_createCurveSwapExactInInstruction as createCurveSwapExactInInstruction, index$1_createInitializeConfigInstruction as createInitializeConfigInstruction, index$1_createInitializeLaunchInstruction as createInitializeLaunchInstruction, index$1_createMigrateLaunchInstruction as createMigrateLaunchInstruction, index$1_createPreviewMigrationInstruction as createPreviewMigrationInstruction, index$1_createPreviewSwapExactInInstruction as createPreviewSwapExactInInstruction, index$1_createSetMigratorAllowlistInstruction as createSetMigratorAllowlistInstruction, index$1_createSetSentinelAllowlistInstruction as createSetSentinelAllowlistInstruction, index$1_decodePreviewMigrationResult as decodePreviewMigrationResult, index$1_decodePreviewSwapExactInResult as decodePreviewSwapExactInResult, index$1_encodeU64LE as encodeU64LE, index$1_fetchAllLaunches as fetchAllLaunches, index$1_fetchLaunch as fetchLaunch, index$1_fetchLaunchesByAuthority as fetchLaunchesByAuthority, index$1_getConfigAddress as getConfigAddress, index$1_getInitConfigCodec as getInitConfigCodec, index$1_getInitConfigDecoder as getInitConfigDecoder, index$1_getInitConfigEncoder as getInitConfigEncoder, index$1_getInitializeConfigArgsCodec as getInitializeConfigArgsCodec, index$1_getInitializeConfigArgsDecoder as getInitializeConfigArgsDecoder, index$1_getInitializeConfigArgsEncoder as getInitializeConfigArgsEncoder, index$1_getInitializeLaunchArgsCodec as getInitializeLaunchArgsCodec, index$1_getInitializeLaunchArgsDecoder as getInitializeLaunchArgsDecoder, index$1_getInitializeLaunchArgsEncoder as getInitializeLaunchArgsEncoder, index$1_getLaunchAddress as getLaunchAddress, index$1_getLaunchAuthorityAddress as getLaunchAuthorityAddress, index$1_getLaunchCodec as getLaunchCodec, index$1_getLaunchDecoder as getLaunchDecoder, index$1_getLaunchEncoder as getLaunchEncoder, index$1_getProgramDataAddress as getProgramDataAddress, index$1_launchExists as launchExists, index$1_launchIdFromU64 as launchIdFromU64 };
|
|
2294
|
+
}
|
|
2295
|
+
|
|
2296
|
+
/**
|
|
2297
|
+
* This code was AUTOGENERATED using the Codama library.
|
|
2298
|
+
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
2299
|
+
* to add features, then rerun Codama to update it.
|
|
2300
|
+
*
|
|
2301
|
+
* @see https://github.com/codama-idl/codama
|
|
2302
|
+
*/
|
|
2303
|
+
|
|
2304
|
+
/**
|
|
2305
|
+
* Arguments for migrate instruction.
|
|
2306
|
+
* These are deserialized from the migrator_migrate_calldata passed by initializer.
|
|
2307
|
+
*/
|
|
2308
|
+
type MigrateArgs = {
|
|
2309
|
+
/** Base tokens reserved for distribution to recipients */
|
|
2310
|
+
baseForDistribution: bigint;
|
|
2311
|
+
/** Base tokens reserved for CPMM liquidity */
|
|
2312
|
+
baseForLiquidity: bigint;
|
|
2313
|
+
};
|
|
2314
|
+
type MigrateArgsArgs = {
|
|
2315
|
+
/** Base tokens reserved for distribution to recipients */
|
|
2316
|
+
baseForDistribution: number | bigint;
|
|
2317
|
+
/** Base tokens reserved for CPMM liquidity */
|
|
2318
|
+
baseForLiquidity: number | bigint;
|
|
2319
|
+
};
|
|
2320
|
+
declare function getMigrateArgsEncoder(): FixedSizeEncoder<MigrateArgsArgs>;
|
|
2321
|
+
declare function getMigrateArgsDecoder(): FixedSizeDecoder<MigrateArgs>;
|
|
2322
|
+
declare function getMigrateArgsCodec(): FixedSizeCodec<MigrateArgsArgs, MigrateArgs>;
|
|
2323
|
+
|
|
2324
|
+
/**
|
|
2325
|
+
* This code was AUTOGENERATED using the Codama library.
|
|
2326
|
+
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
2327
|
+
* to add features, then rerun Codama to update it.
|
|
2328
|
+
*
|
|
2329
|
+
* @see https://github.com/codama-idl/codama
|
|
2330
|
+
*/
|
|
2331
|
+
|
|
2332
|
+
type Recipient = {
|
|
2333
|
+
wallet: Address;
|
|
2334
|
+
amount: bigint;
|
|
2335
|
+
};
|
|
2336
|
+
type RecipientArgs = {
|
|
2337
|
+
wallet: Address;
|
|
2338
|
+
amount: number | bigint;
|
|
2339
|
+
};
|
|
2340
|
+
declare function getRecipientEncoder(): FixedSizeEncoder<RecipientArgs>;
|
|
2341
|
+
declare function getRecipientDecoder(): FixedSizeDecoder<Recipient>;
|
|
2342
|
+
declare function getRecipientCodec(): FixedSizeCodec<RecipientArgs, Recipient>;
|
|
2343
|
+
|
|
2344
|
+
/**
|
|
2345
|
+
* This code was AUTOGENERATED using the Codama library.
|
|
2346
|
+
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
2347
|
+
* to add features, then rerun Codama to update it.
|
|
2348
|
+
*
|
|
2349
|
+
* @see https://github.com/codama-idl/codama
|
|
2350
|
+
*/
|
|
2351
|
+
|
|
2352
|
+
/**
|
|
2353
|
+
* Arguments for register_launch instruction.
|
|
2354
|
+
* These are deserialized from the migrator_init_calldata passed by initializer.
|
|
2355
|
+
*/
|
|
2356
|
+
type RegisterLaunchArgs = {
|
|
2357
|
+
cpmmConfig: Address;
|
|
2358
|
+
initialSwapFeeBps: number;
|
|
2359
|
+
initialFeeSplitBps: number;
|
|
2360
|
+
recipients: Array<Recipient>;
|
|
2361
|
+
minRaiseQuote: bigint;
|
|
2362
|
+
minMigrationPriceQ64Opt: Option<bigint>;
|
|
2363
|
+
};
|
|
2364
|
+
type RegisterLaunchArgsArgs = {
|
|
2365
|
+
cpmmConfig: Address;
|
|
2366
|
+
initialSwapFeeBps: number;
|
|
2367
|
+
initialFeeSplitBps: number;
|
|
2368
|
+
recipients: Array<RecipientArgs>;
|
|
2369
|
+
minRaiseQuote: number | bigint;
|
|
2370
|
+
minMigrationPriceQ64Opt: OptionOrNullable<number | bigint>;
|
|
2371
|
+
};
|
|
2372
|
+
declare function getRegisterLaunchArgsEncoder(): Encoder<RegisterLaunchArgsArgs>;
|
|
2373
|
+
declare function getRegisterLaunchArgsDecoder(): Decoder<RegisterLaunchArgs>;
|
|
2374
|
+
declare function getRegisterLaunchArgsCodec(): Codec<RegisterLaunchArgsArgs, RegisterLaunchArgs>;
|
|
2375
|
+
|
|
2376
|
+
/**
|
|
2377
|
+
* This code was AUTOGENERATED using the Codama library.
|
|
2378
|
+
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
2379
|
+
* to add features, then rerun Codama to update it.
|
|
2380
|
+
*
|
|
2381
|
+
* @see https://github.com/codama-idl/codama
|
|
2382
|
+
*/
|
|
2383
|
+
|
|
2384
|
+
type CpmmMigratorState = {
|
|
2385
|
+
discriminator: ReadonlyUint8Array;
|
|
2386
|
+
/** The launch this state is associated with */
|
|
2387
|
+
launch: Address;
|
|
2388
|
+
/** Admin who registered this launch (receives unsold curve base tokens) */
|
|
2389
|
+
admin: Address;
|
|
2390
|
+
/** CPMM config to use for pool initialization */
|
|
2391
|
+
cpmmConfig: Address;
|
|
2392
|
+
/** Initial swap fee for the CPMM pool (basis points) */
|
|
2393
|
+
initialSwapFeeBps: number;
|
|
2394
|
+
/** Initial fee split for the CPMM pool (basis points) */
|
|
2395
|
+
initialFeeSplitBps: number;
|
|
2396
|
+
/** Padding for alignment */
|
|
2397
|
+
pad0: ReadonlyUint8Array;
|
|
2398
|
+
/** Recipients for base token distribution at migration */
|
|
2399
|
+
recipients: Array<Recipient>;
|
|
2400
|
+
/** Minimum quote tokens required to migrate */
|
|
2401
|
+
minRaiseQuote: bigint;
|
|
2402
|
+
/** Optional minimum price floor (Q64 fixed point) */
|
|
2403
|
+
minMigrationPriceQ64Opt: Option<bigint>;
|
|
2404
|
+
/** Whether this launch has been migrated */
|
|
2405
|
+
isMigrated: boolean;
|
|
2406
|
+
/** Bump seed for this PDA */
|
|
2407
|
+
bump: number;
|
|
2408
|
+
/** Reserved for future use */
|
|
2409
|
+
reserved: ReadonlyUint8Array;
|
|
2410
|
+
};
|
|
2411
|
+
type CpmmMigratorStateArgs = {
|
|
2412
|
+
/** The launch this state is associated with */
|
|
2413
|
+
launch: Address;
|
|
2414
|
+
/** Admin who registered this launch (receives unsold curve base tokens) */
|
|
2415
|
+
admin: Address;
|
|
2416
|
+
/** CPMM config to use for pool initialization */
|
|
2417
|
+
cpmmConfig: Address;
|
|
2418
|
+
/** Initial swap fee for the CPMM pool (basis points) */
|
|
2419
|
+
initialSwapFeeBps: number;
|
|
2420
|
+
/** Initial fee split for the CPMM pool (basis points) */
|
|
2421
|
+
initialFeeSplitBps: number;
|
|
2422
|
+
/** Padding for alignment */
|
|
2423
|
+
pad0: ReadonlyUint8Array;
|
|
2424
|
+
/** Recipients for base token distribution at migration */
|
|
2425
|
+
recipients: Array<RecipientArgs>;
|
|
2426
|
+
/** Minimum quote tokens required to migrate */
|
|
2427
|
+
minRaiseQuote: number | bigint;
|
|
2428
|
+
/** Optional minimum price floor (Q64 fixed point) */
|
|
2429
|
+
minMigrationPriceQ64Opt: OptionOrNullable<number | bigint>;
|
|
2430
|
+
/** Whether this launch has been migrated */
|
|
2431
|
+
isMigrated: boolean;
|
|
2432
|
+
/** Bump seed for this PDA */
|
|
2433
|
+
bump: number;
|
|
2434
|
+
/** Reserved for future use */
|
|
2435
|
+
reserved: ReadonlyUint8Array;
|
|
2436
|
+
};
|
|
2437
|
+
/** Gets the encoder for {@link CpmmMigratorStateArgs} account data. */
|
|
2438
|
+
declare function getCpmmMigratorStateEncoder(): Encoder<CpmmMigratorStateArgs>;
|
|
2439
|
+
/** Gets the decoder for {@link CpmmMigratorState} account data. */
|
|
2440
|
+
declare function getCpmmMigratorStateDecoder(): Decoder<CpmmMigratorState>;
|
|
2441
|
+
/** Gets the codec for {@link CpmmMigratorState} account data. */
|
|
2442
|
+
declare function getCpmmMigratorStateCodec(): Codec<CpmmMigratorStateArgs, CpmmMigratorState>;
|
|
2443
|
+
|
|
2444
|
+
declare const CPMM_MIGRATOR_PROGRAM_ID: Address;
|
|
2445
|
+
declare const SEED_STATE = "state";
|
|
2446
|
+
declare const MAX_RECIPIENTS = 2;
|
|
2447
|
+
declare const CPMM_MIGRATOR_INSTRUCTION_DISCRIMINATORS: {
|
|
2448
|
+
readonly registerLaunch: Uint8Array<ArrayBuffer>;
|
|
2449
|
+
readonly migrate: Uint8Array<ArrayBuffer>;
|
|
2450
|
+
};
|
|
2451
|
+
declare const CPMM_MIGRATOR_ACCOUNT_DISCRIMINATORS: {
|
|
2452
|
+
readonly CpmmMigratorState: Uint8Array<ArrayBuffer>;
|
|
2453
|
+
};
|
|
2454
|
+
|
|
2455
|
+
declare function getCpmmMigratorStateAddress(launch: Address, programId?: Address): Promise<ProgramDerivedAddress>;
|
|
2456
|
+
|
|
2457
|
+
declare function fetchCpmmMigratorState(rpc: Rpc<GetAccountInfoApi>, address: Address): Promise<CpmmMigratorState | null>;
|
|
2458
|
+
|
|
2459
|
+
declare function encodeRegisterLaunchCalldata(args: RegisterLaunchArgsArgs): Uint8Array;
|
|
2460
|
+
declare function encodeMigrateCalldata(args: MigrateArgsArgs): Uint8Array;
|
|
2461
|
+
|
|
2462
|
+
declare const index_CPMM_MIGRATOR_ACCOUNT_DISCRIMINATORS: typeof CPMM_MIGRATOR_ACCOUNT_DISCRIMINATORS;
|
|
2463
|
+
declare const index_CPMM_MIGRATOR_INSTRUCTION_DISCRIMINATORS: typeof CPMM_MIGRATOR_INSTRUCTION_DISCRIMINATORS;
|
|
2464
|
+
declare const index_CPMM_MIGRATOR_PROGRAM_ID: typeof CPMM_MIGRATOR_PROGRAM_ID;
|
|
2465
|
+
type index_CpmmMigratorState = CpmmMigratorState;
|
|
2466
|
+
type index_CpmmMigratorStateArgs = CpmmMigratorStateArgs;
|
|
2467
|
+
declare const index_MAX_RECIPIENTS: typeof MAX_RECIPIENTS;
|
|
2468
|
+
type index_MigrateArgs = MigrateArgs;
|
|
2469
|
+
type index_MigrateArgsArgs = MigrateArgsArgs;
|
|
2470
|
+
type index_Recipient = Recipient;
|
|
2471
|
+
type index_RecipientArgs = RecipientArgs;
|
|
2472
|
+
type index_RegisterLaunchArgs = RegisterLaunchArgs;
|
|
2473
|
+
type index_RegisterLaunchArgsArgs = RegisterLaunchArgsArgs;
|
|
2474
|
+
declare const index_SEED_STATE: typeof SEED_STATE;
|
|
2475
|
+
declare const index_encodeMigrateCalldata: typeof encodeMigrateCalldata;
|
|
2476
|
+
declare const index_encodeRegisterLaunchCalldata: typeof encodeRegisterLaunchCalldata;
|
|
2477
|
+
declare const index_fetchCpmmMigratorState: typeof fetchCpmmMigratorState;
|
|
2478
|
+
declare const index_getCpmmMigratorStateAddress: typeof getCpmmMigratorStateAddress;
|
|
2479
|
+
declare const index_getCpmmMigratorStateCodec: typeof getCpmmMigratorStateCodec;
|
|
2480
|
+
declare const index_getCpmmMigratorStateDecoder: typeof getCpmmMigratorStateDecoder;
|
|
2481
|
+
declare const index_getCpmmMigratorStateEncoder: typeof getCpmmMigratorStateEncoder;
|
|
2482
|
+
declare const index_getMigrateArgsCodec: typeof getMigrateArgsCodec;
|
|
2483
|
+
declare const index_getMigrateArgsDecoder: typeof getMigrateArgsDecoder;
|
|
2484
|
+
declare const index_getMigrateArgsEncoder: typeof getMigrateArgsEncoder;
|
|
2485
|
+
declare const index_getRecipientCodec: typeof getRecipientCodec;
|
|
2486
|
+
declare const index_getRecipientDecoder: typeof getRecipientDecoder;
|
|
2487
|
+
declare const index_getRecipientEncoder: typeof getRecipientEncoder;
|
|
2488
|
+
declare const index_getRegisterLaunchArgsCodec: typeof getRegisterLaunchArgsCodec;
|
|
2489
|
+
declare const index_getRegisterLaunchArgsDecoder: typeof getRegisterLaunchArgsDecoder;
|
|
2490
|
+
declare const index_getRegisterLaunchArgsEncoder: typeof getRegisterLaunchArgsEncoder;
|
|
2491
|
+
declare namespace index {
|
|
2492
|
+
export { index_CPMM_MIGRATOR_ACCOUNT_DISCRIMINATORS as CPMM_MIGRATOR_ACCOUNT_DISCRIMINATORS, index_CPMM_MIGRATOR_INSTRUCTION_DISCRIMINATORS as CPMM_MIGRATOR_INSTRUCTION_DISCRIMINATORS, index_CPMM_MIGRATOR_PROGRAM_ID as CPMM_MIGRATOR_PROGRAM_ID, type index_CpmmMigratorState as CpmmMigratorState, type index_CpmmMigratorStateArgs as CpmmMigratorStateArgs, index_MAX_RECIPIENTS as MAX_RECIPIENTS, type index_MigrateArgs as MigrateArgs, type index_MigrateArgsArgs as MigrateArgsArgs, type index_Recipient as Recipient, type index_RecipientArgs as RecipientArgs, type index_RegisterLaunchArgs as RegisterLaunchArgs, type index_RegisterLaunchArgsArgs as RegisterLaunchArgsArgs, index_SEED_STATE as SEED_STATE, index_encodeMigrateCalldata as encodeMigrateCalldata, index_encodeRegisterLaunchCalldata as encodeRegisterLaunchCalldata, index_fetchCpmmMigratorState as fetchCpmmMigratorState, index_getCpmmMigratorStateAddress as getCpmmMigratorStateAddress, index_getCpmmMigratorStateCodec as getCpmmMigratorStateCodec, index_getCpmmMigratorStateDecoder as getCpmmMigratorStateDecoder, index_getCpmmMigratorStateEncoder as getCpmmMigratorStateEncoder, index_getMigrateArgsCodec as getMigrateArgsCodec, index_getMigrateArgsDecoder as getMigrateArgsDecoder, index_getMigrateArgsEncoder as getMigrateArgsEncoder, index_getRecipientCodec as getRecipientCodec, index_getRecipientDecoder as getRecipientDecoder, index_getRecipientEncoder as getRecipientEncoder, index_getRegisterLaunchArgsCodec as getRegisterLaunchArgsCodec, index_getRegisterLaunchArgsDecoder as getRegisterLaunchArgsDecoder, index_getRegisterLaunchArgsEncoder as getRegisterLaunchArgsEncoder };
|
|
2493
|
+
}
|
|
2494
|
+
|
|
2495
|
+
export { ACCOUNT_DISCRIMINATORS, ACCOUNT_ROLE_READONLY, ACCOUNT_ROLE_SIGNER, ACCOUNT_ROLE_WRITABLE, ACCOUNT_ROLE_WRITABLE_SIGNER, ACCOUNT_VERSION, type AddLiquidityAccounts, AddLiquidityArgs, type AddLiquidityArgsWithOracle, AddLiquidityQuote, AmmConfig, BPS_DENOM, CPMM_ERROR_MESSAGES, type ClosePositionAccounts, type CollectFeesAccounts, CollectFeesArgs, type CollectProtocolFeesAccounts, CollectProtocolFeesArgs, CpmmError, CpmmErrorCode, type CreatePositionAccounts, CreatePositionArgs, CurveParams, CurveParamsToMarketCapInput, type FetchPoolsConfig, INSTRUCTION_DISCRIMINATORS, type InitializeConfigAccounts$1 as InitializeConfigAccounts, InitializeConfigArgs$1 as InitializeConfigArgs, type InitializeOracleAccounts, InitializeOracleArgs, type InitializePoolAccounts, InitializePoolArgs, MAX_FEE_AMOUNT, MAX_ORACLE_OBSERVATIONS, MAX_SENTINEL_ALLOWLIST$1 as MAX_SENTINEL_ALLOWLIST, MarketCapToCurveParamsInput, MarketCapValidationResult, type OracleConsultAccounts, OracleConsultArgs, type OracleConsultResult, OracleState, type OracleUpdateAccounts, PROGRAM_ID, type PauseAccounts, Pool, type PoolWithAddress, Position, Q64_ONE, type QuoteToNumeraireAccounts, QuoteToNumeraireArgs, type QuoteToNumeraireResult, type RemoveLiquidityAccounts, RemoveLiquidityArgs, RemoveLiquidityQuote, SEED_AUTHORITY, SEED_CONFIG$1 as SEED_CONFIG, SEED_ORACLE, SEED_POOL, SEED_POSITION, SEED_PROTOCOL_POSITION, SENTINEL_NO_CHANGE$1 as SENTINEL_NO_CHANGE, SENTINEL_PROGRAM_ID, SF_AFTER_ADD_LIQ, SF_AFTER_REMOVE_LIQ, SF_AFTER_SWAP$1 as SF_AFTER_SWAP, SF_BEFORE_ADD_LIQ, SF_BEFORE_REMOVE_LIQ, SF_BEFORE_SWAP$1 as SF_BEFORE_SWAP, SYSTEM_PROGRAM_ID, type SetFeesAccounts, SetFeesArgs, type SetRouteAccounts, SetRouteArgs, type SetSentinelAccounts, SetSentinelArgs, type SkimAccounts, SwapDirection, type SwapExactInAccounts, SwapExactInArgs, SwapQuote, TOKEN_METADATA_PROGRAM_ID, TOKEN_PROGRAM_ID, type TransferAdminAccounts, TransferAdminArgs, type UnpauseAccounts, areMintsOrdered, calculateAccruedFees, calculateTwap, calculateTwapNumber, ceilDiv, computePrice0Q64, computePrice1Q64, index as cpmmMigrator, createAddLiquidityInstruction, createClosePositionInstruction, createCollectFeesInstruction, createCollectProtocolFeesInstruction, createCreatePositionInstruction, createInitializeConfigInstruction$1 as createInitializeConfigInstruction, createInitializeOracleInstruction, createInitializePoolInstruction, createOracleConsultInstruction, createOracleUpdateInstruction, createPauseInstruction, createQuoteToNumeraireInstruction, createRemoveLiquidityInstruction, createSetFeesInstruction, createSetRouteInstruction, createSetSentinelInstruction, createSkimInstruction, createSwapExactInInstruction, createSwapInstruction, createTransferAdminInstruction, createUnpauseInstruction, curveParamsToMarketCap, decodeAmmConfig, decodeOracleConsultResult, decodeOracleState, decodePool, decodePosition, decodeQuoteToNumeraireResult, fetchAllPools, fetchConfig, fetchConfigWithAddress, fetchPool, fetchPoolsBatch, filterPoolsByMint, getAddLiquidityQuote, getConfigAddress$1 as getConfigAddress, getErrorMessage, getK, getLiquidityAddresses, getMetadataAddress, getOracleAddress, getPendingFees, getPoolAddress, getPoolAddressFromMints, getPoolAuthorityAddress, getPoolByMints, getPoolInitAddresses, getPositionAddress, getProtocolPositionAddress, getRemoveLiquidityQuote, getSpotPrice0, getSpotPrice1, getSwapAddresses, getSwapQuote, getSwapQuoteExactOut, getTvl, index$1 as initializer, isCpmmError, isqrt, marketCapToCurveParams, marketCapToSingleCurveParams, marketCapToTokenPrice, maxBigInt, minBigInt, numberToQ64, parseErrorFromLogs, poolExists, q64Div, q64Mul, q64ToNumber, ratioToNumber, sortMints, sortPoolsByReserves, validateMarketCapParameters };
|