@floorlaunchpad/sdk 0.1.0 → 0.3.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/CHANGELOG.md +84 -0
- package/LICENSE +201 -60
- package/README.md +45 -24
- package/dist/abi/evm-event-names.js +12 -0
- package/dist/abi/evm.gen.js +130 -0
- package/dist/abi/functions.gen.js +144 -0
- package/dist/abi/index.js +17 -0
- package/dist/abi/solana.gen.js +128 -0
- package/dist/burn.js +21 -0
- package/dist/client/evm/index.js +191 -0
- package/dist/client/index.js +19 -0
- package/dist/client/solana/index.js +259 -0
- package/dist/client/types.js +5 -0
- package/dist/codec.js +77 -0
- package/dist/config/codeHash.js +9 -0
- package/dist/config/generated.js +746 -0
- package/dist/config/index.js +49 -0
- package/dist/config/registry.gen.js +118 -0
- package/dist/config/solana-genesis.js +7 -0
- package/dist/ed25519.js +31 -0
- package/dist/errors.js +249 -0
- package/dist/events/index.js +40 -0
- package/dist/events/types.gen.js +3 -0
- package/dist/evm/abi.js +283 -0
- package/dist/evm/balances.js +26 -0
- package/dist/evm/chains.js +144 -0
- package/dist/evm/floor/abi.gen.js +195 -0
- package/dist/evm/floor/calls.js +230 -0
- package/dist/evm/floor/create.js +49 -0
- package/dist/evm/floor/events.js +41 -0
- package/dist/evm/floor/iface.js +44 -0
- package/dist/evm/items.js +209 -0
- package/dist/evm/keccak.js +118 -0
- package/dist/evm/multicall.js +30 -0
- package/dist/evm/router.js +184 -0
- package/dist/evm/zap.js +128 -0
- package/dist/fixtures.js +53 -0
- package/dist/generated/index.js +28 -0
- package/dist/generated/interface.gen.js +146 -0
- package/dist/handle.js +22 -0
- package/dist/index.js +91 -7
- package/dist/indexer/bodies.js +473 -0
- package/dist/indexer/client.js +104 -0
- package/dist/indexer/contract.js +349 -0
- package/dist/indexer/decode.js +97 -0
- package/dist/indexer/partners.js +100 -0
- package/dist/indexer/paths.js +127 -0
- package/dist/indexer/read.js +109 -0
- package/dist/indexer/stream.js +71 -0
- package/dist/lock.js +16 -0
- package/dist/math/fixed.js +154 -0
- package/dist/math/genesis.js +39 -0
- package/dist/math/index.js +20 -0
- package/dist/math/u256.js +49 -0
- package/dist/math/v2/ask.js +162 -0
- package/dist/math/v2/book.js +607 -0
- package/dist/math/v2/circulating.js +62 -0
- package/dist/math/v2/create.js +122 -0
- package/dist/math/v2/display.js +208 -0
- package/dist/math/v2/error.js +17 -0
- package/dist/math/v2/feasibility.js +174 -0
- package/dist/math/v2/fees.js +121 -0
- package/dist/math/v2/holders.js +105 -0
- package/dist/math/v2/milestones.js +40 -0
- package/dist/math/v2/pow.js +69 -0
- package/dist/math/v2/preset.js +151 -0
- package/dist/math/v2/receipt.js +108 -0
- package/dist/math/v2/relay.js +217 -0
- package/dist/math/v2/rows.js +365 -0
- package/dist/math/v2/split.js +111 -0
- package/dist/math/v2/sqrt.js +84 -0
- package/dist/math/v2/supply.js +21 -0
- package/dist/math/v2/team.js +75 -0
- package/dist/math/v2/trade.js +126 -0
- package/dist/math/v2/wide.js +51 -0
- package/dist/quote.js +6 -0
- package/dist/registryPrice.js +23 -0
- package/dist/route/edge-jupiter.js +42 -0
- package/dist/route/edge.js +11 -0
- package/dist/route/graph.js +51 -0
- package/dist/route/path.js +75 -0
- package/dist/route/quote.js +15 -0
- package/dist/route-jupiter.js +35 -0
- package/dist/route.js +8 -0
- package/dist/sha256.js +61 -0
- package/dist/solana/alt.js +18 -0
- package/dist/solana/floor/accounts.js +390 -0
- package/dist/solana/floor/borsh.js +66 -0
- package/dist/solana/floor/create.js +65 -0
- package/dist/solana/floor/events.js +140 -0
- package/dist/solana/floor/genesis.js +91 -0
- package/dist/solana/floor/genesisList.js +68 -0
- package/dist/solana/floor/instructions.js +435 -0
- package/dist/solana/floor/metadata.js +198 -0
- package/dist/solana/floor/mint.js +206 -0
- package/dist/solana/floor/program.js +64 -0
- package/dist/solana/floor/registry.js +83 -0
- package/dist/solana/instruction.js +49 -0
- package/dist/solana/pda.js +88 -0
- package/dist/solana/tx.js +138 -0
- package/dist/v2/burnPreview.js +35 -0
- package/dist/v2/circulating.js +11 -0
- package/dist/v2/claimAllEvm.js +70 -0
- package/dist/v2/claims-evm.js +120 -0
- package/dist/v2/claims.js +218 -0
- package/dist/v2/dead.js +21 -0
- package/dist/v2/devbuy.js +37 -0
- package/dist/v2/events.js +115 -0
- package/dist/v2/evm.js +299 -0
- package/dist/v2/evmReads.js +76 -0
- package/dist/v2/genesis.js +76 -0
- package/dist/v2/layouts.js +217 -0
- package/dist/v2/market-evm.js +74 -0
- package/dist/v2/presetRowEvm.js +45 -0
- package/dist/v2/press.js +106 -0
- package/dist/v2/quoteMint.js +52 -0
- package/dist/v2/receipt-tx.js +149 -0
- package/dist/v2/route-alt.js +114 -0
- package/dist/v2/route.js +389 -0
- package/dist/v2/solana.js +391 -0
- package/dist/v2/solanaSettle.js +97 -0
- package/dist/v2/tx/evm.js +126 -0
- package/dist/v2/tx/genesis.js +47 -0
- package/dist/v2/tx/index.js +5 -0
- package/dist/v2/tx/solana.js +118 -0
- package/dist/v2/types.js +13 -0
- package/docs/aggregator.md +61 -0
- package/docs/bot.md +50 -0
- package/docs/frontend.md +29 -0
- package/docs/wallet.md +54 -0
- package/package.json +428 -32
- package/src/abi/evm-event-names.ts +12 -0
- package/src/abi/evm.gen.ts +139 -0
- package/src/abi/functions.gen.ts +154 -0
- package/src/abi/index.ts +30 -0
- package/src/abi/solana.gen.ts +138 -0
- package/src/burn.ts +37 -0
- package/src/client/evm/index.ts +199 -0
- package/src/client/index.ts +23 -0
- package/src/client/solana/index.ts +260 -0
- package/src/client/types.ts +162 -0
- package/src/codec.ts +77 -0
- package/src/config/codeHash.ts +9 -0
- package/src/config/generated.ts +746 -0
- package/src/config/index.ts +91 -0
- package/src/config/registry.gen.ts +118 -0
- package/src/config/solana-genesis.ts +7 -0
- package/src/ed25519.ts +31 -0
- package/src/errors.ts +270 -0
- package/src/events/index.ts +44 -0
- package/src/events/types.gen.ts +831 -0
- package/src/evm/abi.ts +292 -0
- package/src/evm/balances.ts +26 -0
- package/src/evm/chains.ts +167 -0
- package/src/evm/floor/abi.gen.ts +195 -0
- package/src/evm/floor/calls.ts +247 -0
- package/src/evm/floor/create.ts +68 -0
- package/src/evm/floor/events.ts +51 -0
- package/src/evm/floor/iface.ts +45 -0
- package/src/evm/items.ts +252 -0
- package/src/evm/keccak.ts +118 -0
- package/src/evm/multicall.ts +43 -0
- package/src/evm/router.ts +209 -0
- package/src/evm/zap.ts +152 -0
- package/src/fixtures.ts +53 -0
- package/src/generated/index.ts +29 -0
- package/src/generated/interface.gen.ts +153 -0
- package/src/handle.ts +22 -0
- package/src/index.ts +91 -6
- package/src/indexer/bodies.ts +528 -0
- package/src/indexer/client.ts +178 -0
- package/src/indexer/contract.ts +410 -0
- package/src/indexer/decode.ts +109 -0
- package/src/indexer/partners.ts +109 -0
- package/src/indexer/paths.ts +190 -0
- package/src/indexer/read.ts +119 -0
- package/src/indexer/stream.ts +83 -0
- package/src/lock.ts +16 -0
- package/src/math/fixed.ts +154 -0
- package/src/math/genesis.ts +39 -0
- package/src/math/index.ts +24 -0
- package/src/math/u256.ts +49 -0
- package/src/math/v2/ask.ts +218 -0
- package/src/math/v2/book.ts +660 -0
- package/src/math/v2/circulating.ts +69 -0
- package/src/math/v2/create.ts +139 -0
- package/src/math/v2/display.ts +250 -0
- package/src/math/v2/error.ts +19 -0
- package/src/math/v2/feasibility.ts +200 -0
- package/src/math/v2/fees.ts +121 -0
- package/src/math/v2/holders.ts +124 -0
- package/src/math/v2/milestones.ts +51 -0
- package/src/math/v2/pow.ts +71 -0
- package/src/math/v2/preset.ts +189 -0
- package/src/math/v2/receipt.ts +162 -0
- package/src/math/v2/relay.ts +235 -0
- package/src/math/v2/rows.ts +412 -0
- package/src/math/v2/split.ts +160 -0
- package/src/math/v2/sqrt.ts +86 -0
- package/src/math/v2/supply.ts +27 -0
- package/src/math/v2/team.ts +75 -0
- package/src/math/v2/trade.ts +145 -0
- package/src/math/v2/wide.ts +52 -0
- package/src/quote.ts +6 -0
- package/src/registryPrice.ts +28 -0
- package/src/route/edge-jupiter.ts +71 -0
- package/src/route/edge.ts +22 -0
- package/src/route/graph.ts +77 -0
- package/src/route/path.ts +84 -0
- package/src/route/quote.ts +46 -0
- package/src/route-jupiter.ts +36 -0
- package/src/route.ts +8 -0
- package/src/sha256.ts +61 -0
- package/src/solana/alt.ts +25 -0
- package/src/solana/floor/accounts.ts +393 -0
- package/src/solana/floor/borsh.ts +66 -0
- package/src/solana/floor/create.ts +89 -0
- package/src/solana/floor/events.ts +147 -0
- package/src/solana/floor/genesis.ts +111 -0
- package/src/solana/floor/genesisList.ts +75 -0
- package/src/solana/floor/instructions.ts +491 -0
- package/src/solana/floor/metadata.ts +246 -0
- package/src/solana/floor/mint.ts +242 -0
- package/src/solana/floor/program.ts +64 -0
- package/src/solana/floor/registry.ts +96 -0
- package/src/solana/instruction.ts +61 -0
- package/src/solana/pda.ts +91 -0
- package/src/solana/tx.ts +143 -0
- package/src/v2/burnPreview.ts +52 -0
- package/src/v2/circulating.ts +22 -0
- package/src/v2/claimAllEvm.ts +97 -0
- package/src/v2/claims-evm.ts +179 -0
- package/src/v2/claims.ts +288 -0
- package/src/v2/dead.ts +21 -0
- package/src/v2/devbuy.ts +55 -0
- package/src/v2/events.ts +131 -0
- package/src/v2/evm.ts +349 -0
- package/src/v2/evmReads.ts +121 -0
- package/src/v2/genesis.ts +80 -0
- package/src/v2/layouts.ts +219 -0
- package/src/v2/market-evm.ts +95 -0
- package/src/v2/presetRowEvm.ts +54 -0
- package/src/v2/press.ts +124 -0
- package/src/v2/quoteMint.ts +63 -0
- package/src/v2/receipt-tx.ts +251 -0
- package/src/v2/route-alt.ts +114 -0
- package/src/v2/route.ts +494 -0
- package/src/v2/solana.ts +439 -0
- package/src/v2/solanaSettle.ts +117 -0
- package/src/v2/tx/evm.ts +152 -0
- package/src/v2/tx/genesis.ts +66 -0
- package/src/v2/tx/index.ts +5 -0
- package/src/v2/tx/solana.ts +140 -0
- package/src/v2/types.ts +284 -0
- package/dist/adapter.d.ts +0 -28
- package/dist/adapter.d.ts.map +0 -1
- package/dist/adapter.js +0 -2
- package/dist/adapter.js.map +0 -1
- package/dist/chain.d.ts +0 -23
- package/dist/chain.d.ts.map +0 -1
- package/dist/chain.js +0 -25
- package/dist/chain.js.map +0 -1
- package/dist/client.d.ts +0 -26
- package/dist/client.d.ts.map +0 -1
- package/dist/client.js +0 -43
- package/dist/client.js.map +0 -1
- package/dist/dex-adapter.d.ts +0 -228
- package/dist/dex-adapter.d.ts.map +0 -1
- package/dist/dex-adapter.js +0 -407
- package/dist/dex-adapter.js.map +0 -1
- package/dist/index.d.ts +0 -7
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/quotes.d.ts +0 -12
- package/dist/quotes.d.ts.map +0 -1
- package/dist/quotes.gen.d.ts +0 -8
- package/dist/quotes.gen.d.ts.map +0 -1
- package/dist/quotes.gen.js +0 -2170
- package/dist/quotes.gen.js.map +0 -1
- package/dist/quotes.js +0 -24
- package/dist/quotes.js.map +0 -1
- package/dist/types.d.ts +0 -111
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js +0 -2
- package/dist/types.js.map +0 -1
- package/src/adapter.ts +0 -20
- package/src/chain.ts +0 -39
- package/src/client.ts +0 -41
- package/src/dex-adapter.ts +0 -477
- package/src/quotes.gen.ts +0 -2170
- package/src/quotes.ts +0 -29
- package/src/types.ts +0 -115
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to `@floorlaunchpad/sdk`. The version follows semver; while the major number is 0, a minor bump may rename or remove an export and a patch bump never does.
|
|
4
|
+
|
|
5
|
+
## 0.3.0
|
|
6
|
+
|
|
7
|
+
The first public build, in three packages under the Apache License 2.0. `@floorlaunchpad/sdk` is the whole SDK.
|
|
8
|
+
`@floorlaunchpad/sdk-evm` and `@floorlaunchpad/sdk-solana` are chain-scoped entries over it. Each re-exports, from `@floorlaunchpad/sdk` at the
|
|
9
|
+
same version, the namespaces for its chain and the shared ones.
|
|
10
|
+
|
|
11
|
+
Removed (0.x minor):
|
|
12
|
+
|
|
13
|
+
- `displayFloorV2` (`display.ts`): it served f as `b.floor` and c / k as the summed band money, not the live
|
|
14
|
+
rule. Read the single functions instead: `floorX64`, `bestBidPriceX64V2`, `nextBuyPriceX64`, `dexLiquidityV2`, `sCirc`.
|
|
15
|
+
|
|
16
|
+
Renamed (0.x minor: no alias is kept, the old spelling throws or fails the type check):
|
|
17
|
+
|
|
18
|
+
- The v2 trade builders take `amountIn` (was `amount`), `tokensIn` (was `tokens`) and `minOut` (was `minTokensOut` /
|
|
19
|
+
`minQuoteOut`): `buyInstructionV2`, `buyFromBalanceInstructionV2`, `sellInstructionV2`, `sellFromBalanceInstructionV2`,
|
|
20
|
+
`teamShareBuyInstructionV2`, `teamShareBuyAndClaimInstructionsV2`, `teamShareBuyCallV2`, `teamShareBuyAndClaimCallV2`;
|
|
21
|
+
`solPaidBuyInstructionsV2` (the routed buy, `RoutedBuyV2`) takes `minOut`. The EVM call encoders keep the contract's own
|
|
22
|
+
argument names.
|
|
23
|
+
- `setCreatePausedInstruction` takes `authority` (required); the `timelock` signer name is gone.
|
|
24
|
+
|
|
25
|
+
Changed:
|
|
26
|
+
|
|
27
|
+
- Slippage 0 to 10,000 bps on both chains (`MAX_SLIPPAGE_BPS` was 9,999). At 10,000 (100 %) `minOutAt` signs the least
|
|
28
|
+
minimum, 1; `buyLessIn` keeps no money and `buyMinTokens` returns 0, and the client and route quotes sign 1 for it.
|
|
29
|
+
Above 10,000 is still refused.
|
|
30
|
+
- `createFloorClient` on Solana: a quote's `minOut` is never 0, as on EVM. A buy whose input less the slippage buys nothing
|
|
31
|
+
(100 %, or a buy of a few base units) quotes `minOut` 1 instead of rejecting, and a sell that pays nothing quotes 1; a
|
|
32
|
+
sell of 0 tokens is refused with `BadArgument`.
|
|
33
|
+
- `createFloorClient` on Solana nets a Token-2022 quote mint's transfer fee as the program does: a buy quotes on
|
|
34
|
+
`amountIn` less the fee (its minimum on the slippage-less input less the fee, its refund as it arrives), a sell's
|
|
35
|
+
`amountOut` is what arrives (`minOut` stays the program's bound, before the fee). `SolanaTransport.rpc.getEpoch`
|
|
36
|
+
(optional) picks the mint's older or newer fee; without it the higher one is used.
|
|
37
|
+
- `v2/circulating.ts` `circulating` runs the math's `circulatingV2`, one formula with `sCirc`; same results.
|
|
38
|
+
- `buyLessIn` (so `buyMinTokens` and the route's buy minimum) refuses a slippage that is negative, not a whole number of
|
|
39
|
+
bps, or above 10,000 with `VaultShareOutOfRange`, as the Rust helper's `u16` bound does; before, -1 gave a minimum
|
|
40
|
+
above the quote and 0.5 threw a bare `RangeError`.
|
|
41
|
+
- `splitRowOfRowV2` reads a decoded `RowV2`'s `ckTargetBps`, as the math crate's `split_row` does (it read a `ckBps` that
|
|
42
|
+
`decodeRowV2` does not set).
|
|
43
|
+
- `solanaSettleInputsV2` / `quoteBuySolanaV2` take `opts.mintSupply` (the base mint's live `supply`): the program syncs
|
|
44
|
+
the supply before every trade (only a fall applies), so a quote after a burn the launch has not yet seen matches it.
|
|
45
|
+
- EVM: `readLaunchV2` reads `launchState`'s supply in chain units and divides it by 10¹² (`launchStateSupplyMath`); before,
|
|
46
|
+
the live supply and the market cap were 10¹² too large and a live launch could not be read. `decodeLaunchStateSupply`
|
|
47
|
+
still returns the view's raw chain numbers.
|
|
48
|
+
- EVM: `planEvmClaimAll` and `evmOwedReaderOfClaimsViewV2` read the deployed `owedV2` (token columns ÷ 10¹²), the one
|
|
49
|
+
claims read; the undeployed claims view's call (`OWED_V2_OF_SIG`, its call builder and decoder) and the `view` option are removed.
|
|
50
|
+
|
|
51
|
+
Added:
|
|
52
|
+
|
|
53
|
+
- Subpath exports `./v2/burnPreview`, `./v2/evmReads`, `./v2/presetRowEvm` and `./v2/claimAllEvm`, each also a root
|
|
54
|
+
namespace (`v2BurnPreview`, `v2EvmReads`, `v2PresetRowEvm`, `v2ClaimAllEvm`). Their names stay exported flat from the root too.
|
|
55
|
+
|
|
56
|
+
- A root entry. `import { v2Route, indexerRead } from "@floorlaunchpad/sdk"` reaches every subpath module as a namespace named after its path. Importing it runs no code.
|
|
57
|
+
- Guides for four readers in `docs/`: aggregator, wallet, bot and frontend.
|
|
58
|
+
- This changelog and the version plan below.
|
|
59
|
+
- New subpath exports, each also a root namespace: `./client` (`createFloorClient`), `./errors` (`FloorError`,
|
|
60
|
+
`decodeProgramError`), `./config` (chain and program ids, quotes), `./generated` (the generated interface constants),
|
|
61
|
+
`./v2/press` (`minOutAt`, `deadlineFrom`, the EVM first-sell permit), `./v2/receipt-tx` (`fillOf`, `paidOf`, `createdOf`,
|
|
62
|
+
`burnedOf` over a landed transaction), `./fixtures` (small synthetic accounts for your own tests; the recorded prints stay
|
|
63
|
+
out of the package).
|
|
64
|
+
- `CG_TICKERS` carries the indexer's `high` and `low` (nullable whole-unit prices, rolling 24 h).
|
|
65
|
+
- Claims: `teamBuyDueV2`, `holderOwedNowV2` and `claimLaunchesPerTxV2` beside `planClaimAllV2`.
|
|
66
|
+
- `U64_MAX`, `U128_MAX`, `toU128`, `BPS` and `RANGES_MAX` each have one definition; the old import paths still work.
|
|
67
|
+
- One definition each, the old import paths still work: `PROGRAM_IDS` (`generated`; `config` re-exports), the claim bits both
|
|
68
|
+
chains share (`CLAIM_CREATOR`, `CLAIM_CREATOR_REF`, `CLAIM_TEAM_SLOT`, `CLAIM_TRADER_REF`, `CLAIM_RESERVED_HOLDER`,
|
|
69
|
+
`CLAIM_EXTRA`, `CLAIM_TEAM_BUY`, `CLAIM_SHARE_BOUGHT`; `CLAIM_KNOWN` stays per chain), `SWEPT_*`, `MAX_NAME_LEN` /
|
|
70
|
+
`MAX_SYMBOL_LEN` / `MAX_URI_LEN`, `Ctx`, `EvmCall`. (A `floorLive` planned for this release was dropped before it: read
|
|
71
|
+
the floor from a `Book`'s `sqrtF`.)
|
|
72
|
+
`creatorLegsV2` / `platformLegsV2` are the same functions as `creatorLegs` / `platformLegs`.
|
|
73
|
+
- The indexer's dev-buy body decodes to the SDK's `DevBuyRole`; its item type is `DevBuyItem` (was `DevBuy` in
|
|
74
|
+
`indexer/bodies`, a second type of that name; the SDK's `DevBuy` is `v2/devbuy`'s).
|
|
75
|
+
|
|
76
|
+
## Version plan
|
|
77
|
+
|
|
78
|
+
- 0.3.x: patch fixes only. No export is removed or renamed.
|
|
79
|
+
- 0.4.0: the next rename or removal, each listed here with its replacement.
|
|
80
|
+
- 1.0.0: when the surface has gone one release with no rename. From then on a breaking change takes a major bump.
|
|
81
|
+
|
|
82
|
+
## 0.2.0
|
|
83
|
+
|
|
84
|
+
The first version of the package. It has the v2 math (bit for bit with the math crate), the quoter and route finder, Solana and EVM decoders, instruction and call builders, and the indexer readers. Private; not published.
|
package/LICENSE
CHANGED
|
@@ -1,61 +1,202 @@
|
|
|
1
|
-
Apache License
|
|
2
|
-
Version 2.0, January 2004
|
|
3
|
-
http://www.apache.org/licenses/
|
|
4
1
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
package/README.md
CHANGED
|
@@ -1,34 +1,55 @@
|
|
|
1
1
|
# @floorlaunchpad/sdk
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
adapter that serves the launch's chain. The adapters are separate packages:
|
|
5
|
-
[`@floorlaunchpad/sdk-evm`](https://github.com/gudtekdonkey/floor-sdk/tree/main/packages/sdk-evm) and
|
|
6
|
-
[`@floorlaunchpad/sdk-solana`](https://github.com/gudtekdonkey/floor-sdk/tree/main/packages/sdk-solana).
|
|
3
|
+
The FLOOR Program in TypeScript. It holds the program's math (bit for bit with the Rust crate), quoting, account and event decoders, and transaction builders for Solana and for EVM chains. It has no dependencies and opens no connection: you pass in your own RPC, indexer `get` and send functions.
|
|
7
4
|
|
|
8
|
-
|
|
9
|
-
npm install @floorlaunchpad/sdk @floorlaunchpad/sdk-solana @solana/kit
|
|
10
|
-
```
|
|
5
|
+
`npm install @floorlaunchpad/sdk`. Chain-scoped entries over it: `@floorlaunchpad/sdk-evm` and `@floorlaunchpad/sdk-solana`. Apache-2.0.
|
|
11
6
|
|
|
12
|
-
|
|
13
|
-
import { FloorClient, solanaRef } from '@floorlaunchpad/sdk';
|
|
7
|
+
## Install and import
|
|
14
8
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
const tx = await floor.buildTrade({ launch: launches[0]!.ref, side: 'buy', amountIn: 1_000_000_000n, minAmountOut: (q.amountOut * 99n) / 100n, trader });
|
|
9
|
+
```ts
|
|
10
|
+
import { quote, solanaPda, v2Route } from "@floorlaunchpad/sdk"; // the root entry: one namespace per module
|
|
11
|
+
import { findRouteV2, quoteRouteV2 } from "@floorlaunchpad/sdk/v2/route"; // or one module by its path
|
|
19
12
|
```
|
|
20
13
|
|
|
21
|
-
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
14
|
+
The root entry re-exports every subpath as a namespace named after its path: `./solana/floor/events` is `solanaFloorEvents`, `./v2/route` is `v2Route`. Importing the package runs no code (`"sideEffects": false`), so a bundler drops the namespaces you never read. Subpath imports stay valid and are the smallest option for a server script.
|
|
15
|
+
|
|
16
|
+
Node 22.18 or newer. The package ships compiled JavaScript in `dist/` with the types pointing at `src/`.
|
|
17
|
+
|
|
18
|
+
## Pick your guide
|
|
19
|
+
|
|
20
|
+
| You are | Start here |
|
|
21
|
+
|---|---|
|
|
22
|
+
| An aggregator or router | [docs/aggregator.md](docs/aggregator.md): find a route, quote it, build the Solana instructions or the EVM call |
|
|
23
|
+
| A wallet | [docs/wallet.md](docs/wallet.md): decode what a transaction does, read errors, build a claim |
|
|
24
|
+
| A bot or indexer | [docs/bot.md](docs/bot.md): read launches, follow the stream, decode logs |
|
|
25
|
+
| A frontend | [docs/frontend.md](docs/frontend.md): the root entry, the indexer readers, the math for display |
|
|
26
|
+
|
|
27
|
+
## Versions
|
|
29
28
|
|
|
30
|
-
|
|
29
|
+
The version follows semver. While the major number is 0, a minor bump (0.2 to 0.3) may rename or remove an export and a patch bump never does. The plan and the history are in [CHANGELOG.md](CHANGELOG.md).
|
|
30
|
+
|
|
31
|
+
**Fees in a quote.** A quote's `fees` has the five fee legs, each added on top of the trade, buys and sells alike: the
|
|
32
|
+
Backing Fee (`backing`), the Team Fee (`team`), the Platform fee (`platform`), the $FLOOR fee (`floor`) and the Holder Fee
|
|
33
|
+
(`holder`), with their `total`. Any leg can be 0. Before graduation a preset launch pays only the Platform fee and the
|
|
34
|
+
$FLOOR fee; the other three start at graduation. The rates are the launch's own, read from its state, so take them from
|
|
35
|
+
the quote rather than from a table. Marketcap Milestones are not fees: they sit inside the price, are paid only by buys on
|
|
36
|
+
the way up and never appear in `fees`.
|
|
37
|
+
|
|
38
|
+
**Reading an indexer.** `@floorlaunchpad/sdk/indexer/read` has one reader per indexer route and a decoder for each body. The SDK opens no connection and names no host. You pass a `Get`, a function from a path such as `/floor-amm/launches/<id>` to `{ status, body }`, and it can be `fetch` against your own indexer, a proxy, or a cache:
|
|
39
|
+
|
|
40
|
+
```ts
|
|
41
|
+
import { readLaunch, readTrades, IndexerError, type Get } from "@floorlaunchpad/sdk/indexer/read";
|
|
42
|
+
|
|
43
|
+
const get: Get = async (path) => {
|
|
44
|
+
const r = await fetch(`https://indexer.example/chains/base${path}`);
|
|
45
|
+
return { status: r.status, body: await r.json() };
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
const { launch } = await readLaunch(get, "42");
|
|
49
|
+
const page = await readTrades(get, launch.id, { limit: 50 });
|
|
50
|
+
const older = page.next === null ? null : await readTrades(get, launch.id, { limit: 50, before: page.next });
|
|
51
|
+
```
|
|
31
52
|
|
|
32
|
-
|
|
53
|
+
Amounts come back as `bigint`. A non-200 answer throws an `IndexerError`: `notReady` while the indexer is still catching up to the chain, `unknownLaunch` for an id it does not know. A body of the wrong shape throws a `ShapeError` naming the field. `@floorlaunchpad/sdk/indexer/stream` parses the live stream's frames in the same way, and `indexerPath` builds any route's path if you want to do the request yourself.
|
|
33
54
|
|
|
34
|
-
|
|
55
|
+
**Launch ids.** FLOOR has no pool: a launch trades against the program. On EVM it is FloorAmm's `launchId` (a uint256, written as its decimal string); on Solana it is the address of the `Launch` account. Every launch read (the `LaunchId` type) takes either that id or the launch's token address, and both name the same launch. The answer names the launch by its id: `launch.id` on a launch read, `launch` on each row elsewhere. The transaction builders take the id itself, so look a token up with `readLaunch` before you build a trade.
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
export const V2_EVENT_FIELD_NAMES = {
|
|
4
|
+
Trade: ["launchId", "trader", "recipient", "isBuy", "quoteGross", "quoteNet", "refund", "tokens", "fees", "traderRef", "fromResale", "fromFirst", "unfilled", "sqrtBefore", "sqrtAfter", "sqrtF", "floor", "cushion", "sCirc", "steps", "budgetHit", "slot", "ts", "kind", "creatorRef", "bidMoney", "msPaid"],
|
|
5
|
+
HolderIndexRolled: ["launchId", "index", "wMatured", "wPending", "carry"],
|
|
6
|
+
DeadSynced: ["launchId", "added", "deadTokens", "sCirc"],
|
|
7
|
+
BackingCredited: ["launchId", "donor", "amount", "fAfter", "slot"],
|
|
8
|
+
|
|
9
|
+
TokensBurnedV2: ["launchId", "wallet", "role", "place", "fromTeamBuy", "fromWallet", "balanceBefore", "owedAfter", "split", "supply", "sOut", "floorAfterX64", "fromShareBought"],
|
|
10
|
+
|
|
11
|
+
OptedIn: ["a"],
|
|
12
|
+
} ;
|