@floorlaunchpad/sdk 0.3.0 → 0.3.2

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.
Files changed (41) hide show
  1. package/CHANGELOG.md +61 -0
  2. package/README.md +10 -0
  3. package/dist/abi/solana.gen.js +2 -0
  4. package/dist/config/generated.js +121 -64
  5. package/dist/evm/chains.js +5 -1
  6. package/dist/evm/squid.js +107 -0
  7. package/dist/index.js +2 -0
  8. package/dist/indexer/bodies.js +16 -0
  9. package/dist/indexer/client.js +4 -0
  10. package/dist/indexer/contract.js +17 -2
  11. package/dist/indexer/partners.js +5 -0
  12. package/dist/indexer/paths.js +6 -0
  13. package/dist/indexer/read.js +13 -0
  14. package/dist/math/v2/trade.js +8 -8
  15. package/dist/solana/floor/accounts.js +3 -1
  16. package/dist/solana/floor/events.js +4 -0
  17. package/dist/solana/floor/instructions.js +13 -0
  18. package/dist/v2/devbuy.js +15 -0
  19. package/dist/v2/router.js +22 -0
  20. package/docs/floor-line.md +235 -0
  21. package/examples/floor-line.html +401 -0
  22. package/package.json +2 -1
  23. package/src/abi/solana.gen.ts +2 -0
  24. package/src/config/generated.ts +121 -64
  25. package/src/config/index.ts +2 -0
  26. package/src/events/types.gen.ts +11 -0
  27. package/src/evm/chains.ts +5 -1
  28. package/src/evm/squid.ts +138 -0
  29. package/src/index.ts +2 -0
  30. package/src/indexer/bodies.ts +19 -0
  31. package/src/indexer/client.ts +8 -0
  32. package/src/indexer/contract.ts +18 -3
  33. package/src/indexer/partners.ts +6 -0
  34. package/src/indexer/paths.ts +6 -0
  35. package/src/indexer/read.ts +13 -0
  36. package/src/math/v2/trade.ts +8 -8
  37. package/src/solana/floor/accounts.ts +3 -1
  38. package/src/solana/floor/events.ts +4 -0
  39. package/src/solana/floor/instructions.ts +13 -0
  40. package/src/v2/devbuy.ts +33 -0
  41. package/src/v2/router.ts +22 -0
package/CHANGELOG.md CHANGED
@@ -2,6 +2,67 @@
2
2
 
3
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
4
 
5
+ ## 0.3.2
6
+
7
+ Added:
8
+
9
+ - Indexer: the route `GET /floor-amm/launches/<launch>/member-sold` (also under `/floor-amm/v2/`; `INDEXER_CONTRACT.memberSold`,
10
+ `indexerPath.memberSold`, reader `memberSold`, `readMemberSold`, decoder `MEMBER_SOLD` / `MEMBER_SOLD_ROW`, types
11
+ `MemberSoldBody` / `MemberSoldRow`): every sell by a wallet that held a Team Slot place at that moment, oldest first, as
12
+ `{ indexed, memberSold: [{ launch, member, place, amount, quoteOut, block, timestamp, tx, id }] }`; `place` the lowest place
13
+ the member held, `amount` the tokens sold in the SDK's 6-decimal token units, `quoteOut` the quote paid out in base units,
14
+ `id` `<block>:<txnIndex>:<eventIndex>`. Derived from the trades and the Team Slot; a member who moves the tokens to another
15
+ wallet before selling is not seen.
16
+ - Indexer: the route `GET /floor-amm/launches/<launch>/account` (also under `/floor-amm/v2/`; `INDEXER_CONTRACT.launchAccount`,
17
+ `indexerPath.launchAccount`, reader `launchAccount`, `readLaunchAccount`, decoder `LAUNCH_ACCOUNT`, type `LaunchAccountBody`,
18
+ helper `launchAccountBytes`): a launch's whole `LaunchV2` account read live from the node at the ask (Solana only; EVM answers
19
+ `unknown route`), as `{ indexed, launch, mint, slot, data }` with `slot` the RPC context slot and `data` the account bytes in
20
+ base64. `launchAccountBytes(body)` returns them as a `Uint8Array` (browser and Node) for `decodeLaunchV2`. An account that is
21
+ absent, not owned by the program or not a `LaunchV2` answers `unknown launch`; a failed node read is a 502.
22
+ - `v2Devbuy.memberSoldFromTrade` (with `MemberSold`, `TeamSeat`): the member sale of one v2 `Trade` against a launch's
23
+ Team Slot places, or null. The indexer serves the route above from it.
24
+
25
+ Changed:
26
+
27
+ - `FLOOR_AMM_FROM_BLOCK.hyperevm` (`evm/chains.ts`) is `50398055`, the block FloorAmm was deployed at on HyperEVM (chain 999),
28
+ no longer `null`. FloorAmm is now deployed on all seven EVM chains at `FLOOR_AMM_ADDRESS`
29
+ (`0xF10000bd05c2C01793C6d55F027346469683d225`).
30
+
31
+ No export removed or renamed, no signature changed.
32
+
33
+ ## 0.3.1
34
+
35
+ Added:
36
+
37
+ - Solana genesis: `startGenesisPublicInstruction`, `setGenesisEndInstruction`, `GENESIS_NO_END`.
38
+ - Events: `GenesisPublicStarted` and `GenesisEndSet` on Solana (`SolGenesisPublicStartedFields`, `SolGenesisEndSetFields`);
39
+ `SolanaEvent`, `SolanaEventMap` and `FloorEvent` gain them. A `switch` over `name` that checks it is exhaustive needs the
40
+ two new cases.
41
+
42
+ - Config: `ExplorerRow.alt` (optional): a chain's other explorers (Blockscout). Arc and Robinhood Chain now link to Etherscan
43
+ (`arc.etherscan.io`, `robin.etherscan.io`), with Blockscout in `alt`; HyperEVM's test network links to Hyperliquid's
44
+ testnet explorer. The old Arc, Robinhood Chain and HyperEVM test links did not load.
45
+
46
+ - Router helpers on the root entry: `isDustRefund`, `carriesNoRefund`, `gasFor`, `GAS_FLAT`, `GAS_PER_STEP`, `GAS_FLAT_STEPS`, `GAS_MAX`.
47
+ - Indexer decoder: `CG_TICKERS` rows carry `depthUp2` and `depthDown2` (nullable decimals; the indexer serves them always).
48
+ - Indexer: the route `GET /floor-amm/holders/<token>` (`INDEXER_CONTRACT.tokenHolders`, reader `tokenHolders`): a token's
49
+ holders, balance descending, `limit` 1..500 (default 100) and `offset`; balances in the SDK's 6-decimal token units on
50
+ both chains.
51
+ - Indexer: the route `GET /floor-amm/handles/<handleId>/places` (`INDEXER_CONTRACT.handlePlaces`, reader `handlePlaces`,
52
+ `readHandlePlaces`, decoder `HANDLE_PLACES`): the Team Slot places a social handle holds now, bound to a wallet or not, as
53
+ `{ indexed, handle, places: [{ launch, place }] }`; `handleId` is 0x + 64 hex. `PathParam` gains `"handle"`.
54
+ - Config: `FLOOR_AMM_FROM_BLOCK` (`evm/chains.ts`): the block each EVM chain's FloorAmm was deployed at, `null` where it is
55
+ not deployed yet.
56
+ - Docs: `docs/floor-line.md`, a request to integrators to draw the floor line, and `examples/floor-line.html`, a page that draws it from a run of the SDK's math (`examples/gen-floor-line.mjs` makes its data). The npm package ships the page, not the script.
57
+
58
+ Changed:
59
+
60
+ - `FLOOR_AMM_ADDRESS` (`evm/chains.ts`) is `0xF10000bd05c2C01793C6d55F027346469683d225`, the FloorAmm proxy on every v2 EVM chain
61
+ (one CREATE2 address), no longer `null`. Deployed on Ethereum, Base, BNB Chain, Arbitrum, Arc and Robinhood Chain;
62
+ HyperEVM gets the same address at its deploy.
63
+
64
+ No export removed or renamed, no signature changed.
65
+
5
66
  ## 0.3.0
6
67
 
7
68
  The first public build, in three packages under the Apache License 2.0. `@floorlaunchpad/sdk` is the whole SDK.
package/README.md CHANGED
@@ -2,6 +2,11 @@
2
2
 
3
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.
4
4
 
5
+ > **One ask: show the FLOOR.** If you chart, list, route or hold FLOOR tokens, please show the FLOOR line on the token's
6
+ > price chart and the FLOOR price on the token's page. That is the minimum we ask for; anything more is a bonus. It is not
7
+ > a requirement, and it is highly appreciated. The field is `floorPriceQuote` in the Partner API (or `sqrtF` on every
8
+ > trade event); the guide, with drop-in chart code, is [docs/floor-line.md](docs/floor-line.md).
9
+
5
10
  `npm install @floorlaunchpad/sdk`. Chain-scoped entries over it: `@floorlaunchpad/sdk-evm` and `@floorlaunchpad/sdk-solana`. Apache-2.0.
6
11
 
7
12
  ## Install and import
@@ -23,6 +28,11 @@ Node 22.18 or newer. The package ships compiled JavaScript in `dist/` with the t
23
28
  | A wallet | [docs/wallet.md](docs/wallet.md): decode what a transaction does, read errors, build a claim |
24
29
  | A bot or indexer | [docs/bot.md](docs/bot.md): read launches, follow the stream, decode logs |
25
30
  | A frontend | [docs/frontend.md](docs/frontend.md): the root entry, the indexer readers, the math for display |
31
+ | Anyone who shows a FLOOR token: chart, screener, terminal, wallet | [docs/floor-line.md](docs/floor-line.md): show the FLOOR line and the FLOOR price (the one ask) |
32
+
33
+ ## Show the floor on your chart
34
+
35
+ A launch's floor is the price the program's own money stands behind. Drawing it under the price line shows holders what backs them. [docs/floor-line.md](docs/floor-line.md) says what we ask, which field to read (the Partner API, a trade event or the SDK), how to draw the line in Lightweight Charts, TradingView or plain SVG, and what to watch for (units, burns, the gap between floor and price, graduation). [examples/floor-line.html](examples/floor-line.html) is a working token page with the line, the FLOOR price and every snippet.
26
36
 
27
37
  ## Versions
28
38
 
@@ -44,6 +44,8 @@ export const SOLANA_EVENT_SCHEMAS = [
44
44
  { name: "GenesisListRootSet", discriminator: "85037264ea1a3265", source: "v1", fields: [["signer","pubkey"],["oldRoot","bytes:32"],["newRoot","bytes:32"]] },
45
45
  { name: "BurnsSynced", discriminator: "cfb2d288fed64590", source: "v1", fields: [["launch","pubkey"],["incinerated","u64"],["supply","u64"],["sOut","u64"],["floorAfterX64","u128"],["slot","u64"]] },
46
46
  { name: "TokensBurned", discriminator: "e6ff2271e235e309", source: "v1", fields: [["launch","pubkey"],["wallet","pubkey"],["role","u8"],["place","u8"],["fromTeamBuy","u64"],["fromWallet","u64"],["balanceBefore","u64"],["owedAfter","u64"],["split","u64[10]"],["supply","u64"],["sOut","u64"],["floorAfterX64","u128"],["slot","u64"],["fromShareBought","u64?"]] },
47
+ { name: "GenesisPublicStarted", discriminator: "0f963d81be5c82af", source: "v1", fields: [["signer","pubkey"],["at","i64"]] },
48
+ { name: "GenesisEndSet", discriminator: "2fc250f230dedba2", source: "v1", fields: [["signer","pubkey"],["oldEndsAt","i64"],["newEndsAt","i64"]] },
47
49
  { name: "LaunchCreatedV2", discriminator: "4c0e9eb9ef6b568e", source: "v2", fields: [["launch","pubkey"],["mint","pubkey"],["quoteMint","pubkey"],["creator","pubkey"],["id","u64"],["presetId","u8"],["presetVersion","u32"],["presetHash","bytes:32"],["p0X64","u128"],["raise","u64"],["windowTokens","u64"],["creatorBuyTokens","u64"],["createFee","u64"],["name","bytes:32"],["symbol","bytes:10"],["slot","u64"],["ts","i64"],["listed","bool"],["quoteUsdCentsX64","u128"],["nativeCreateFee","u64"],["rowVersion","u8"],["sqrtP0","u128"]] },
48
50
  { name: "Trade", discriminator: "18feda98fd2b1251", source: "v2", fields: [["launch","pubkey"],["trader","pubkey"],["isBuy","bool"],["quoteGross","u64"],["quoteNet","u64"],["refund","u64"],["tokens","u64"],["fees","u64[5]"],["traderRef","u64"],["fromResale","u64"],["fromFirst","u64"],["unfilled","u64"],["sqrtBefore","u128"],["sqrtAfter","u128"],["sqrtF","u128"],["floor","u64"],["cushion","u64"],["sCirc","u64"],["steps","u8"],["budgetHit","bool"],["slot","u64"],["ts","i64"],["kind","u8"],["creatorRef","u64"],["recipient","pubkey"],["bidMoney","u64"],["msPaid","u64[4]"]] },
49
51
  { name: "HolderPositionOpened", discriminator: "86a0f22128a8ddac", source: "v2", fields: [["launch","pubkey"],["owner","pubkey"],["amount","u64"]] },
@@ -137,7 +137,13 @@ export const CHAIN_ROWS = [
137
137
  "url": "https://etherscan.io",
138
138
  "soak": {
139
139
  "url": "https://sepolia.etherscan.io"
140
- }
140
+ },
141
+ "alt": [
142
+ {
143
+ "name": "Blockscout",
144
+ "url": "https://eth.blockscout.com"
145
+ }
146
+ ]
141
147
  },
142
148
  "quotes": [
143
149
  {
@@ -208,14 +214,16 @@ export const CHAIN_ROWS = [
208
214
  "name": "Pepe",
209
215
  "address": "0x6982508145454Ce325dDbE47a25d4ec3d2311933",
210
216
  "decimals": 18,
211
- "kind": "meme"
217
+ "kind": "meme",
218
+ "deferred": true
212
219
  },
213
220
  {
214
221
  "symbol": "SHIB",
215
- "name": "Shiba Inu",
222
+ "name": "SHIBA INU",
216
223
  "address": "0x95aD61b0a150d79219dCF64E1E6Cc01f0B64C4cE",
217
224
  "decimals": 18,
218
- "kind": "meme"
225
+ "kind": "meme",
226
+ "deferred": true
219
227
  }
220
228
  ]
221
229
  },
@@ -239,7 +247,13 @@ export const CHAIN_ROWS = [
239
247
  "url": "https://basescan.org",
240
248
  "soak": {
241
249
  "url": "https://sepolia.basescan.org"
242
- }
250
+ },
251
+ "alt": [
252
+ {
253
+ "name": "Blockscout",
254
+ "url": "https://base.blockscout.com"
255
+ }
256
+ ]
243
257
  },
244
258
  "quotes": [
245
259
  {
@@ -418,7 +432,13 @@ export const CHAIN_ROWS = [
418
432
  "url": "https://arbiscan.io",
419
433
  "soak": {
420
434
  "url": "https://sepolia.arbiscan.io"
421
- }
435
+ },
436
+ "alt": [
437
+ {
438
+ "name": "Blockscout",
439
+ "url": "https://arbitrum.blockscout.com"
440
+ }
441
+ ]
422
442
  },
423
443
  "quotes": [
424
444
  {
@@ -460,11 +480,17 @@ export const CHAIN_ROWS = [
460
480
  "rpcEnv": "FLOOR_RPC_ARC_TESTNET"
461
481
  },
462
482
  "explorer": {
463
- "name": "ArcScan",
464
- "url": "https://arcscan.app",
483
+ "name": "Arc Etherscan",
484
+ "url": "https://arc.etherscan.io",
465
485
  "soak": {
466
- "url": "https://testnet.arcscan.app"
467
- }
486
+ "url": "https://explorer.testnet.arc.io"
487
+ },
488
+ "alt": [
489
+ {
490
+ "name": "Blockscout",
491
+ "url": "https://explorer.arc.io"
492
+ }
493
+ ]
468
494
  },
469
495
  "quotes": [
470
496
  {
@@ -492,11 +518,17 @@ export const CHAIN_ROWS = [
492
518
  "rpcEnv": "FLOOR_RPC_ROBINHOOD_TESTNET"
493
519
  },
494
520
  "explorer": {
495
- "name": "Robinhood Chain Explorer",
496
- "url": "https://explorer.robinhood.com",
521
+ "name": "Robinhood Chain Etherscan",
522
+ "url": "https://robin.etherscan.io",
497
523
  "soak": {
498
524
  "url": "https://explorer.testnet.chain.robinhood.com"
499
- }
525
+ },
526
+ "alt": [
527
+ {
528
+ "name": "Blockscout",
529
+ "url": "https://robinhoodchain.blockscout.com"
530
+ }
531
+ ]
500
532
  },
501
533
  "quotes": [
502
534
  {
@@ -515,24 +547,27 @@ export const CHAIN_ROWS = [
515
547
  },
516
548
  {
517
549
  "symbol": "WOJAK",
518
- "name": "WOJAK",
550
+ "name": "Wojak",
519
551
  "address": "0x806ba27b5e1c4c2e989a3757a8def9fe1145ed10",
520
552
  "decimals": 18,
521
- "kind": "meme"
553
+ "kind": "meme",
554
+ "deferred": true
522
555
  },
523
556
  {
524
557
  "symbol": "AI",
525
- "name": "AI",
558
+ "name": "Artificial Inu",
526
559
  "address": "0x2E8c31162b855A2ffa90F6F8634643Ad6F111e18",
527
560
  "decimals": 18,
528
- "kind": "meme"
561
+ "kind": "meme",
562
+ "deferred": true
529
563
  },
530
564
  {
531
565
  "symbol": "PONS",
532
- "name": "PONS",
566
+ "name": "Pons",
533
567
  "address": "0x39dBED3a2bd333467115dE45665cC57F813C4571",
534
568
  "decimals": 18,
535
- "kind": "meme"
569
+ "kind": "meme",
570
+ "deferred": true
536
571
  }
537
572
  ]
538
573
  },
@@ -555,7 +590,7 @@ export const CHAIN_ROWS = [
555
590
  "name": "HyperEVMScan",
556
591
  "url": "https://hyperevmscan.io",
557
592
  "soak": {
558
- "url": "https://testnet.purrsec.com"
593
+ "url": "https://app.hyperliquid-testnet.xyz/explorer"
559
594
  }
560
595
  },
561
596
  "quotes": [
@@ -589,157 +624,179 @@ export const CHAIN_ROWS = [
589
624
  },
590
625
  {
591
626
  "symbol": "wNVDAx",
592
- "name": "wNVDAx",
627
+ "name": "Wrapped NVIDIA xStock",
593
628
  "address": "0xa8ddb5cd96b5222afe198316e9a57caa642850d5",
594
629
  "decimals": 18,
595
- "kind": "stock"
630
+ "kind": "stock",
631
+ "deferred": true
596
632
  },
597
633
  {
598
634
  "symbol": "wSPYx",
599
- "name": "wSPYx",
635
+ "name": "Wrapped SP500 xStock",
600
636
  "address": "0xe7e553cd128f0011777323a0b44a7b96ea1cb540",
601
637
  "decimals": 18,
602
- "kind": "stock"
638
+ "kind": "stock",
639
+ "deferred": true
603
640
  },
604
641
  {
605
642
  "symbol": "wQQQx",
606
- "name": "wQQQx",
643
+ "name": "Wrapped Nasdaq xStock",
607
644
  "address": "0x4c1ae29c159838fc1b224636e28e086eb69101f7",
608
645
  "decimals": 18,
609
- "kind": "stock"
646
+ "kind": "stock",
647
+ "deferred": true
610
648
  },
611
649
  {
612
650
  "symbol": "wSKHYx",
613
- "name": "wSKHYx",
651
+ "name": "Wrapped SK hynix xStock",
614
652
  "address": "0x6215a58ed045d71f2561aaabe54f4c885c522998",
615
653
  "decimals": 18,
616
- "kind": "stock"
654
+ "kind": "stock",
655
+ "deferred": true
617
656
  },
618
657
  {
619
658
  "symbol": "wMUx",
620
- "name": "wMUx",
659
+ "name": "Wrapped Micron Technology xStock",
621
660
  "address": "0xe2047ee3bddb5c99ae428ab83df63f8730698e30",
622
661
  "decimals": 18,
623
- "kind": "stock"
662
+ "kind": "stock",
663
+ "deferred": true
624
664
  },
625
665
  {
626
666
  "symbol": "SPCX.dw",
627
- "name": "SPCX.dw",
667
+ "name": "Wrapped Space Exploration Technologies Corp.",
628
668
  "address": "0x95687557c66bc799a850ba7037673528238ae763",
629
669
  "decimals": 18,
630
- "kind": "stock"
670
+ "kind": "stock",
671
+ "deferred": true
631
672
  },
632
673
  {
633
674
  "symbol": "AAPLd",
634
- "name": "AAPLd",
675
+ "name": "Apple",
635
676
  "address": "0x7374dc1894fbd1bc6c42f6ebbc50b78c211a8606",
636
677
  "decimals": 18,
637
- "kind": "stock"
678
+ "kind": "stock",
679
+ "deferred": true
638
680
  },
639
681
  {
640
682
  "symbol": "MSFTd",
641
- "name": "MSFTd",
683
+ "name": "Microsoft",
642
684
  "address": "0x66520d8fd614487214a25af7babf27584f59f76b",
643
685
  "decimals": 18,
644
- "kind": "stock"
686
+ "kind": "stock",
687
+ "deferred": true
645
688
  },
646
689
  {
647
690
  "symbol": "GOOGLd",
648
- "name": "GOOGLd",
691
+ "name": "Alphabet Class A",
649
692
  "address": "0x35eeda03e55ff217a013892e9e2e37e792b264ea",
650
693
  "decimals": 18,
651
- "kind": "stock"
694
+ "kind": "stock",
695
+ "deferred": true
652
696
  },
653
697
  {
654
698
  "symbol": "METAd",
655
- "name": "METAd",
699
+ "name": "Meta Platforms",
656
700
  "address": "0x5a9d2deee7d8782011695623f1c453f46b2b566e",
657
701
  "decimals": 18,
658
- "kind": "stock"
702
+ "kind": "stock",
703
+ "deferred": true
659
704
  },
660
705
  {
661
706
  "symbol": "AMZNd",
662
- "name": "AMZNd",
707
+ "name": "Amazon",
663
708
  "address": "0x4f2164c12d2d450a8b1d430492ef6670fe4cad8e",
664
709
  "decimals": 18,
665
- "kind": "stock"
710
+ "kind": "stock",
711
+ "deferred": true
666
712
  },
667
713
  {
668
714
  "symbol": "HOODd",
669
- "name": "HOODd",
715
+ "name": "Robinhood Markets",
670
716
  "address": "0xc304a9d52cf9165024ebc7814250ef3a5013f924",
671
717
  "decimals": 18,
672
- "kind": "stock"
718
+ "kind": "stock",
719
+ "deferred": true
673
720
  },
674
721
  {
675
722
  "symbol": "CRCLd",
676
- "name": "CRCLd",
723
+ "name": "Circle Internet Group",
677
724
  "address": "0xe74aa6c4050a15790525eb11cc4562c664dc67c9",
678
725
  "decimals": 18,
679
- "kind": "stock"
726
+ "kind": "stock",
727
+ "deferred": true
680
728
  },
681
729
  {
682
730
  "symbol": "MUd",
683
- "name": "MUd",
731
+ "name": "Micron Technology",
684
732
  "address": "0x173c83a71c1a9e254721a86b7512cd65bf92648d",
685
733
  "decimals": 18,
686
- "kind": "stock"
734
+ "kind": "stock",
735
+ "deferred": true
687
736
  },
688
737
  {
689
738
  "symbol": "ORCLd",
690
- "name": "ORCLd",
739
+ "name": "Oracle",
691
740
  "address": "0xca2156522638f597ffb3705857ffdc356efabe50",
692
741
  "decimals": 18,
693
- "kind": "stock"
742
+ "kind": "stock",
743
+ "deferred": true
694
744
  },
695
745
  {
696
746
  "symbol": "AVGOd",
697
- "name": "AVGOd",
747
+ "name": "Broadcom",
698
748
  "address": "0xc2785563af80c05177fff006e3b380ac5d172602",
699
749
  "decimals": 18,
700
- "kind": "stock"
750
+ "kind": "stock",
751
+ "deferred": true
701
752
  },
702
753
  {
703
754
  "symbol": "SPCXd",
704
- "name": "SPCXd",
755
+ "name": "SpaceX",
705
756
  "address": "0xe8c8afdf7e80be51e91afa28b6ac44404d270b5d",
706
757
  "decimals": 18,
707
- "kind": "stock"
758
+ "kind": "stock",
759
+ "deferred": true
708
760
  },
709
761
  {
710
762
  "symbol": "SPYd",
711
- "name": "SPYd",
763
+ "name": "SPDR S&P 500 ETF",
712
764
  "address": "0xb7bf37783db41a2851b77c6917280c56312c833a",
713
765
  "decimals": 18,
714
- "kind": "stock"
766
+ "kind": "stock",
767
+ "deferred": true
715
768
  },
716
769
  {
717
770
  "symbol": "QQQd",
718
- "name": "QQQd",
771
+ "name": "Invesco QQQ",
719
772
  "address": "0x499e347174f237ad28687b947b94c0d49570d1b7",
720
773
  "decimals": 18,
721
- "kind": "stock"
774
+ "kind": "stock",
775
+ "deferred": true
722
776
  },
723
777
  {
724
778
  "symbol": "GLDd",
725
- "name": "GLDd",
779
+ "name": "SPDR Gold Shares (ETF)",
726
780
  "address": "0x08be08c37d93e689518ced744a89f113b4afaad4",
727
781
  "decimals": 18,
728
- "kind": "stock"
782
+ "kind": "stock",
783
+ "deferred": true
729
784
  },
730
785
  {
731
786
  "symbol": "SLVd",
732
- "name": "SLVd",
787
+ "name": "iShares Silver Trust (ETF)",
733
788
  "address": "0x7ef4eba0c0200957e357627ced1884d6cb63e961",
734
789
  "decimals": 18,
735
- "kind": "stock"
790
+ "kind": "stock",
791
+ "deferred": true
736
792
  },
737
793
  {
738
794
  "symbol": "BNBd",
739
- "name": "BNBd",
795
+ "name": "BNB",
740
796
  "address": "0xfd6f06d323f6cb08ee9eeb2d201e9ec0e9112c88",
741
797
  "decimals": 18,
742
- "kind": "stock"
798
+ "kind": "stock",
799
+ "deferred": true
743
800
  }
744
801
  ]
745
802
  }
@@ -107,7 +107,11 @@ export const FLOOR_SALTS = {
107
107
  routerDeployer: salt("floor-router.v2.router-deployer"),
108
108
  } ;
109
109
 
110
- export const FLOOR_AMM_ADDRESS = null;
110
+ export const FLOOR_AMM_ADDRESS = "0xF10000bd05c2C01793C6d55F027346469683d225";
111
+
112
+ export const FLOOR_AMM_FROM_BLOCK = {
113
+ ethereum: 26327910, base: 53421827, bsc: 131270813, arbitrum: 520655168, arc: 29205598, robinhood: 104455459, hyperevm: 50398055,
114
+ };
111
115
 
112
116
  const cat = (...h ) => "0x" + h.map((x) => bytesToHex(hexToBytes(x)).slice(2)).join("");
113
117
  const at = (s , init ) => create2Address({ deployer: CREATE2_FACTORY, salt: s, initCode: init });
@@ -0,0 +1,107 @@
1
+
2
+
3
+ import { bytesToHex, encodeAbi, encodeCall } from "./abi.js";
4
+
5
+ export const SQUID_CALL = { Default: 0, FullTokenBalance: 1, FullNativeBalance: 2, CollectTokenBalance: 3 } ;
6
+
7
+ export const SQUID_FULL = 0n;
8
+
9
+ const SOLANA_CHAINS = [101, 1151111081099710, "solana", "solana-mainnet-beta"];
10
+
11
+ export class SquidHookError extends Error {
12
+ code ;
13
+ constructor(code , detail ) {
14
+ super(`squid: ${code}: ${detail}`);
15
+ this.code = code;
16
+ this.name = "SquidHookError";
17
+ }
18
+ }
19
+
20
+ export const SQUID_TOKEN_SCALE = 10n ** 12n;
21
+
22
+ export const SQUID_GAS = { transfer: 65_000, buy: 700_000, sell: 750_000, zapBuy: 900_000, passOn: 30_000 } ;
23
+
24
+ const ZERO = "0x" + "0".repeat(40);
25
+ const lc = (a , what ) => {
26
+ if (!/^0x[0-9a-fA-F]{40}$/.test(a)) throw new SquidHookError("BAD_ADDRESS", `${what} ${a}`);
27
+ return a.toLowerCase();
28
+ };
29
+
30
+ function checkCommon(p ) {
31
+ if (SOLANA_CHAINS.includes(p.chainId)) throw new SquidHookError("SOLANA", `chain ${p.chainId}: hooks run on EVM chains only`);
32
+ }
33
+
34
+ function checkUser(p ) {
35
+ const user = lc(p.user, "user");
36
+ if (user === lc(p.multicall, "multicall")) throw new SquidHookError("RECIPIENT_IS_MULTICALL", "the tokens would stay on SquidMulticall");
37
+ if (user === ZERO || user === lc(p.floorAmm, "floorAmm")) throw new SquidHookError("BAD_RECIPIENT", user);
38
+ return user;
39
+ }
40
+
41
+ const call = (callType , target , value , callData , payload , gas ) => ({
42
+ chainType: "evm",
43
+ callType,
44
+ target,
45
+ value: value.toString(),
46
+ callData,
47
+ payload,
48
+ estimatedGas: String(gas),
49
+ });
50
+
51
+ export function buyHookErc20(p ) {
52
+ checkCommon(p);
53
+ const user = checkUser(p);
54
+ const quote = lc(p.quote, "quote");
55
+ if (quote === ZERO) throw new SquidHookError("NATIVE_QUOTE", "buyFromBalance refuses a native quote: use buyHookNative");
56
+ if (p.minTokensOut <= 0n) throw new SquidHookError("NO_MINIMUM", "minTokensOut must be > 0");
57
+ const amm = lc(p.floorAmm, "floorAmm");
58
+ return {
59
+ provider: "FLOOR",
60
+ description: "Buy a FLOOR launch token",
61
+ calls: [
62
+ call(SQUID_CALL.FullTokenBalance, quote, 0n, bytesToHex(encodeCall("transfer(address,uint256)", [amm, SQUID_FULL])), bytesToHex(encodeAbi(["address", "uint256"], [quote, 1n])), SQUID_GAS.transfer),
63
+ call(SQUID_CALL.Default, amm, 0n, bytesToHex(encodeCall("buyFromBalance(uint256,uint256,address,address,uint256)", [p.launchId, p.minTokensOut, user, user, p.deadline])), "0x", SQUID_GAS.buy),
64
+ ],
65
+ };
66
+ }
67
+
68
+ export function buyHookNative(p ) {
69
+ checkCommon(p);
70
+ const user = checkUser(p);
71
+ if (p.minQuoteIn <= 0n || p.minTokensOut <= 0n) throw new SquidHookError("NO_MINIMUM", "minQuoteIn and minTokensOut must be > 0");
72
+ const zap = lc(p.zap, "zap");
73
+ return {
74
+ provider: "FLOOR",
75
+ description: "Buy a FLOOR launch token with the native coin",
76
+ calls: [
77
+ call(SQUID_CALL.FullNativeBalance, zap, 0n, bytesToHex(encodeCall("buyWithEth(uint256,bytes,uint256,uint256,address,uint256)", [p.launchId, p.swapData, p.minQuoteIn, p.minTokensOut, user, p.deadline])), "0x", SQUID_GAS.zapBuy),
78
+ call(SQUID_CALL.FullNativeBalance, user, 0n, "0x", "0x", SQUID_GAS.passOn),
79
+ ],
80
+ };
81
+ }
82
+
83
+ export function sellHook(p ) {
84
+ checkCommon(p);
85
+ lc(p.user, "user");
86
+ if (p.tokensIn <= 0n || p.tokensIn % SQUID_TOKEN_SCALE !== 0n) throw new SquidHookError("NOT_WHOLE_UNITS", `${p.tokensIn} is not a positive multiple of ${SQUID_TOKEN_SCALE}`);
87
+ if (p.minQuoteOut <= 0n) throw new SquidHookError("NO_MINIMUM", "minQuoteOut must be > 0");
88
+ const to = lc(p.proceedsTo ?? p.multicall, "proceedsTo");
89
+ if (to === ZERO) throw new SquidHookError("BAD_RECIPIENT", "proceedsTo");
90
+ const token = lc(p.token, "token");
91
+ const amm = lc(p.floorAmm, "floorAmm");
92
+ return {
93
+ provider: "FLOOR",
94
+ description: "Sell a FLOOR launch token",
95
+ calls: [
96
+ call(SQUID_CALL.Default, token, 0n, bytesToHex(encodeCall("transfer(address,uint256)", [amm, p.tokensIn])), "0x", SQUID_GAS.transfer),
97
+ call(SQUID_CALL.Default, amm, 0n, bytesToHex(encodeCall("sellFromBalance(uint256,uint256,address,uint256)", [p.launchId, p.minQuoteOut, to, p.deadline])), "0x", SQUID_GAS.sell),
98
+ ],
99
+ fundToken: token,
100
+ fundAmount: p.tokensIn.toString(),
101
+ };
102
+ }
103
+
104
+ export function encodeMulticallRun(calls ) {
105
+ const tuples = calls.map((c) => [BigInt(c.callType), c.target, BigInt(c.value), c.callData, c.payload]);
106
+ return bytesToHex(encodeCall("run((uint8,address,uint256,bytes,bytes)[])", [tuples]));
107
+ }
package/dist/index.js CHANGED
@@ -7,6 +7,8 @@ export * from "./v2/presetRowEvm.js";
7
7
 
8
8
  export * from "./v2/claimAllEvm.js";
9
9
 
10
+ export * from "./v2/router.js";
11
+
10
12
  export * as math from "./math/index.js";
11
13
  export * as mathGenesis from "./math/genesis.js";
12
14
  export * as codec from "./codec.js";
@@ -118,6 +118,8 @@ export const LISTED_LAUNCH = object({
118
118
  backedPpm: nullable(int),
119
119
  volume24hUsd: nullable(decimal),
120
120
  marketCapUsd: nullable(decimal),
121
+
122
+ trendingScore: nullable(big),
121
123
  });
122
124
 
123
125
  export const LIVE_LAUNCH = object({ ...LAUNCH_FIELDS, volume24hGross: nullable(big), holders: int });
@@ -245,6 +247,12 @@ export const LAUNCH_CLAIMS = object({ indexed, claims: array(LAUNCH_CLAIM) });
245
247
 
246
248
  export const DEV_BUYS = object({ indexed, teamBuyUnlocked: bool, teamBuyUnlockedTs: nullable(int), devBuys: array(DEV_BUY) });
247
249
 
250
+ export const MEMBER_SOLD_ROW = object({ launch: str, member: str, place: int, amount: big, quoteOut: big, block: int, timestamp: int, tx: str, id: str });
251
+
252
+ export const MEMBER_SOLD = object({ indexed, memberSold: array(MEMBER_SOLD_ROW) });
253
+
254
+ export const LAUNCH_ACCOUNT = object({ indexed, launch: str, mint: str, slot: int, data: str });
255
+
248
256
  export const CANDLE_INTERVALS = ["1s", "5s", "1m", "5m", "15m", "1h", "4h", "1d"] ;
249
257
 
250
258
  export const CANDLE_INTERVAL_SECS = { "1s": 1, "5s": 5, "1m": 60, "5m": 300, "15m": 900, "1h": 3_600, "4h": 14_400, "1d": 86_400 };
@@ -455,11 +463,19 @@ export const ROLES = object({
455
463
  creatorOf: array(str),
456
464
  creatorRefOf: array(object({ launch: str, tier: int })),
457
465
  teamSlotOf: array(object({ launch: str, place: int })),
466
+
467
+ handleSlotOf: array(object({ launch: str, place: int, handle: str })),
458
468
  holdings: array(object({ launch: str, token: str, amount: big })),
459
469
  }),
460
470
  claimed: record(big),
461
471
  });
462
472
 
473
+ export const HANDLE_PLACES = object({
474
+ indexed,
475
+ handle: str,
476
+ places: array(object({ launch: str, place: int })),
477
+ });
478
+
463
479
  export const TRADER_BOARD = object({
464
480
  indexed,
465
481
  window: oneOf(...TRADER_WINDOWS),