@logswap/sdk 0.5.49 → 0.5.51

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/dist/fpool.d.ts CHANGED
@@ -110,6 +110,16 @@ export declare const fPolicyBaseAbi: readonly [{
110
110
  readonly type: "uint256";
111
111
  }];
112
112
  readonly stateMutability: "view";
113
+ }, {
114
+ readonly type: "function";
115
+ readonly inputs: readonly [];
116
+ readonly name: "kind";
117
+ readonly outputs: readonly [{
118
+ readonly name: "";
119
+ readonly internalType: "bytes32";
120
+ readonly type: "bytes32";
121
+ }];
122
+ readonly stateMutability: "pure";
113
123
  }, {
114
124
  readonly type: "function";
115
125
  readonly inputs: readonly [];
@@ -195,6 +205,20 @@ export declare const fPolicyBaseAbi: readonly [{
195
205
  readonly type: "uint256";
196
206
  }];
197
207
  readonly stateMutability: "view";
208
+ }, {
209
+ readonly type: "function";
210
+ readonly inputs: readonly [{
211
+ readonly name: "";
212
+ readonly internalType: "bytes32";
213
+ readonly type: "bytes32";
214
+ }];
215
+ readonly name: "nameOf";
216
+ readonly outputs: readonly [{
217
+ readonly name: "";
218
+ readonly internalType: "bytes32";
219
+ readonly type: "bytes32";
220
+ }];
221
+ readonly stateMutability: "view";
198
222
  }, {
199
223
  readonly type: "function";
200
224
  readonly inputs: readonly [{
@@ -276,10 +300,6 @@ export declare const fPolicyBaseAbi: readonly [{
276
300
  readonly name: "phi";
277
301
  readonly internalType: "uint256";
278
302
  readonly type: "uint256";
279
- }, {
280
- readonly name: "kind";
281
- readonly internalType: "enum Kind";
282
- readonly type: "uint8";
283
303
  }, {
284
304
  readonly name: "policy";
285
305
  readonly internalType: "address";
@@ -301,6 +321,24 @@ export declare const fPolicyBaseAbi: readonly [{
301
321
  readonly type: "uint8";
302
322
  }];
303
323
  readonly stateMutability: "nonpayable";
324
+ }, {
325
+ readonly type: "function";
326
+ readonly inputs: readonly [{
327
+ readonly name: "poolId";
328
+ readonly internalType: "bytes32";
329
+ readonly type: "bytes32";
330
+ }, {
331
+ readonly name: "from";
332
+ readonly internalType: "address";
333
+ readonly type: "address";
334
+ }];
335
+ readonly name: "onMigrate";
336
+ readonly outputs: readonly [{
337
+ readonly name: "";
338
+ readonly internalType: "uint8";
339
+ readonly type: "uint8";
340
+ }];
341
+ readonly stateMutability: "nonpayable";
304
342
  }, {
305
343
  readonly type: "function";
306
344
  readonly inputs: readonly [{
@@ -397,6 +435,30 @@ export declare const fPolicyBaseAbi: readonly [{
397
435
  readonly name: "proposeAuthority";
398
436
  readonly outputs: readonly [];
399
437
  readonly stateMutability: "nonpayable";
438
+ }, {
439
+ readonly type: "function";
440
+ readonly inputs: readonly [];
441
+ readonly name: "quoteCurated";
442
+ readonly outputs: readonly [{
443
+ readonly name: "";
444
+ readonly internalType: "bool";
445
+ readonly type: "bool";
446
+ }];
447
+ readonly stateMutability: "view";
448
+ }, {
449
+ readonly type: "function";
450
+ readonly inputs: readonly [{
451
+ readonly name: "";
452
+ readonly internalType: "address";
453
+ readonly type: "address";
454
+ }];
455
+ readonly name: "quoteListed";
456
+ readonly outputs: readonly [{
457
+ readonly name: "";
458
+ readonly internalType: "bool";
459
+ readonly type: "bool";
460
+ }];
461
+ readonly stateMutability: "view";
400
462
  }, {
401
463
  readonly type: "function";
402
464
  readonly inputs: readonly [{
@@ -407,6 +469,44 @@ export declare const fPolicyBaseAbi: readonly [{
407
469
  readonly name: "setHarvestCut";
408
470
  readonly outputs: readonly [];
409
471
  readonly stateMutability: "nonpayable";
472
+ }, {
473
+ readonly type: "function";
474
+ readonly inputs: readonly [{
475
+ readonly name: "poolId";
476
+ readonly internalType: "bytes32";
477
+ readonly type: "bytes32";
478
+ }, {
479
+ readonly name: "name_";
480
+ readonly internalType: "bytes32";
481
+ readonly type: "bytes32";
482
+ }];
483
+ readonly name: "setName";
484
+ readonly outputs: readonly [];
485
+ readonly stateMutability: "nonpayable";
486
+ }, {
487
+ readonly type: "function";
488
+ readonly inputs: readonly [{
489
+ readonly name: "curated";
490
+ readonly internalType: "bool";
491
+ readonly type: "bool";
492
+ }];
493
+ readonly name: "setQuoteCurated";
494
+ readonly outputs: readonly [];
495
+ readonly stateMutability: "nonpayable";
496
+ }, {
497
+ readonly type: "function";
498
+ readonly inputs: readonly [{
499
+ readonly name: "quote";
500
+ readonly internalType: "address";
501
+ readonly type: "address";
502
+ }, {
503
+ readonly name: "listed";
504
+ readonly internalType: "bool";
505
+ readonly type: "bool";
506
+ }];
507
+ readonly name: "setQuoteListed";
508
+ readonly outputs: readonly [];
509
+ readonly stateMutability: "nonpayable";
410
510
  }, {
411
511
  readonly type: "function";
412
512
  readonly inputs: readonly [{
@@ -471,6 +571,46 @@ export declare const fPolicyBaseAbi: readonly [{
471
571
  readonly indexed: false;
472
572
  }];
473
573
  readonly name: "HarvestCutSet";
574
+ }, {
575
+ readonly type: "event";
576
+ readonly anonymous: false;
577
+ readonly inputs: readonly [{
578
+ readonly name: "poolId";
579
+ readonly internalType: "bytes32";
580
+ readonly type: "bytes32";
581
+ readonly indexed: true;
582
+ }, {
583
+ readonly name: "name";
584
+ readonly internalType: "bytes32";
585
+ readonly type: "bytes32";
586
+ readonly indexed: false;
587
+ }];
588
+ readonly name: "NameSet";
589
+ }, {
590
+ readonly type: "event";
591
+ readonly anonymous: false;
592
+ readonly inputs: readonly [{
593
+ readonly name: "curated";
594
+ readonly internalType: "bool";
595
+ readonly type: "bool";
596
+ readonly indexed: false;
597
+ }];
598
+ readonly name: "QuoteCuratedSet";
599
+ }, {
600
+ readonly type: "event";
601
+ readonly anonymous: false;
602
+ readonly inputs: readonly [{
603
+ readonly name: "quote";
604
+ readonly internalType: "address";
605
+ readonly type: "address";
606
+ readonly indexed: true;
607
+ }, {
608
+ readonly name: "listed";
609
+ readonly internalType: "bool";
610
+ readonly type: "bool";
611
+ readonly indexed: false;
612
+ }];
613
+ readonly name: "QuoteListed";
474
614
  }, {
475
615
  readonly type: "event";
476
616
  readonly anonymous: false;
@@ -486,10 +626,18 @@ export declare const fPolicyBaseAbi: readonly [{
486
626
  readonly indexed: false;
487
627
  }];
488
628
  readonly name: "RulesSet";
629
+ }, {
630
+ readonly type: "error";
631
+ readonly inputs: readonly [];
632
+ readonly name: "BadFee";
489
633
  }, {
490
634
  readonly type: "error";
491
635
  readonly inputs: readonly [];
492
636
  readonly name: "BadRate";
637
+ }, {
638
+ readonly type: "error";
639
+ readonly inputs: readonly [];
640
+ readonly name: "NoCreator";
493
641
  }, {
494
642
  readonly type: "error";
495
643
  readonly inputs: readonly [];
@@ -502,6 +650,22 @@ export declare const fPolicyBaseAbi: readonly [{
502
650
  readonly type: "error";
503
651
  readonly inputs: readonly [];
504
652
  readonly name: "NotManager";
653
+ }, {
654
+ readonly type: "error";
655
+ readonly inputs: readonly [];
656
+ readonly name: "NotRegistry";
657
+ }, {
658
+ readonly type: "error";
659
+ readonly inputs: readonly [];
660
+ readonly name: "OneBase";
661
+ }, {
662
+ readonly type: "error";
663
+ readonly inputs: readonly [{
664
+ readonly name: "quote";
665
+ readonly internalType: "address";
666
+ readonly type: "address";
667
+ }];
668
+ readonly name: "QuoteNotListed";
505
669
  }, {
506
670
  readonly type: "error";
507
671
  readonly inputs: readonly [];
@@ -547,11 +711,11 @@ export interface FPoolState {
547
711
  policy: Address;
548
712
  /** Whether the policy asked to be consulted on swaps ({@link ASK_SWAP}) and mints ({@link ASK_MINT}) — the desk's policy does, no other. */
549
713
  asks: number;
550
- /** The sponsor's own label for this pool, mutable and never identity. "" when unnamed. */
714
+ /** The sponsor's own label for this pool — the policy's word (decisions 049), mutable and never identity. "" when unnamed. */
551
715
  name: string;
552
716
  /** The block of the last harvest / composition action: no swap runs in it. */
553
717
  restructureBlock: number;
554
- /** The rung — see {@link FPoolKind}. */
718
+ /** What the pool is — its POLICY's self-description (decisions 049); see {@link FPoolKind}. */
555
719
  kind: FPoolKind;
556
720
  /** False before the first seed — and between a retire and the next one (decisions 032). */
557
721
  seeded: boolean;
@@ -568,25 +732,27 @@ export interface FPoolState {
568
732
  /** Read a basket pool whole. Batched — viem multicalls these when the transport allows. */
569
733
  export declare function getFPool(c: LogswapClient, poolId: Hex): Promise<FPoolState>;
570
734
  /**
571
- * The kind of pool (decisions 036, 038, 044) — what the manager promises structurally, whatever
572
- * the pool's policy answers. `public`: the protocol's own pool — its policy requires the collector as
573
- * creator; no gate, no operator. `private`, the desk: the one kind whose policy may gate swaps and
574
- * mints, with an operator that reshapes the legs between generations. `pol`, a treasury's pool
575
- * or a basket: composition and access fixed at birth. `pad`, a launch: a POL whose harvest is
576
- * income only whatever its policy says and whose seed the contract minted to 0xdead — one asset,
577
- * open to all. private → pol → pad is the ladder of rigidity; public is a pol held by the
578
- * protocol. Every rate, role and gate is the policy's.
735
+ * The kind of pool — the POLICY's self-description (decisions 049: the manager knows no kind; the
736
+ * policy the key names is the kind, and what it promises is its code). `public`: the protocol's
737
+ * own pool — its policy requires the collector as creator; no gate, no operator. `private`, the
738
+ * desk: the one whose policy may gate swaps and mints, with an operator that reshapes the legs
739
+ * between generations. `pol`, a treasury's pool, one base: composition and access fixed at
740
+ * birth. `pad`, a launch, one base: its policy answers income only at every harvest and declared
741
+ * its seed the pool's at birth (`SEED_TO_DEAD`) — open to all. private → pol → pad is the ladder
742
+ * of rigidity; public is a pol held by the protocol. Every rate, role and gate is the policy's.
579
743
  */
580
744
  export type FPoolKind = "public" | "private" | "pol" | "pad";
581
- /** The key's enum values. */
582
- export declare const F_KIND: {
583
- readonly public: 0;
584
- readonly private: 1;
585
- readonly pol: 2;
586
- readonly pad: 3;
587
- };
588
- export declare function fPoolKindOf(n: number | bigint): FPoolKind;
589
- /** The deployment's policy for a kind (decisions 044): what a key of that kind names. */
745
+ /** The policy's birth-time declaration that the seed's shares are the pool's (a pad's), in `asks`. */
746
+ export declare const SEED_TO_DEAD = 4;
747
+ /**
748
+ * What a policy IS — its `kind()` tag, read once per policy address and cached for the client's
749
+ * chain: a pool's kind is its policy's word (decisions 049), never the manager's. An unknown tag
750
+ * (a policy that is not one of the protocol's four shapes) throws; the app has no screen for it.
751
+ */
752
+ export declare function fPoolKindOfPolicy(c: LogswapClient, policy: Address): Promise<FPoolKind>;
753
+ /** The pool's label, as its policy holds it (decisions 049). "" when unnamed. */
754
+ export declare function fPoolNameOf(c: LogswapClient, poolId: Hex, policy?: Address): Promise<string>;
755
+ /** The deployment's policy for a kind (decisions 044, 049): the protocol's policy that IS that kind. */
590
756
  export declare function fPoolPolicyFor(c: LogswapClient, kind: FPoolKind): Address;
591
757
  /** The policy a pool named in its key — one read; {@link getFPool} carries it too. */
592
758
  export declare function fPoolPolicyOf(c: LogswapClient, poolId: Hex): Promise<Address>;
@@ -857,12 +1023,16 @@ export interface FPoolCreateArgs {
857
1023
  weights: bigint[];
858
1024
  /** Fixed fee, WAD. The base-for-base fee is pinned at 2φ on-chain. */
859
1025
  phi: bigint;
860
- /** The rung (decisions 036) — see {@link FPoolKind}. In the key: the pool's identity, never changed after. */
1026
+ /**
1027
+ * Which of the protocol's four the pool is — see {@link FPoolKind}. NOT a key field (decisions
1028
+ * 049: the manager knows no kind): it selects the deployment's policy of that kind when `policy`
1029
+ * is not named ({@link fPoolPolicyFor}), and it is what the policy will say it is.
1030
+ */
861
1031
  kind: FPoolKind;
862
1032
  /**
863
- * The pool's policy (decisions 041, 044): the contract the key names, approved by the protocol
864
- * for the kind. Defaults to the deployment's policy for `kind` ({@link fPoolPolicyFor}) — the one
865
- * every protocol pool names.
1033
+ * The pool's policy (decisions 041, 044, 049): the contract the key names, approved by the
1034
+ * registry, and the pool's kind. Defaults to the deployment's policy for `kind`
1035
+ * ({@link fPoolPolicyFor}) — the one every protocol pool names.
866
1036
  */
867
1037
  policy?: Address;
868
1038
  /** Who is born holding the pool: immutable identity, the pool's first authority (the policy records it). */
@@ -871,7 +1041,7 @@ export interface FPoolCreateArgs {
871
1041
  * The differentiator, and nothing else. Identity is the key's hash, so one sponsor cannot run
872
1042
  * two pools of the same shape without varying it — the second `initialize` would land on the
873
1043
  * first pool's id. Defaults to zero, which is the first book of any shape. A pool's NAME is not
874
- * this: names are mutable state (`fPoolSetName`), so a rename forks nothing.
1044
+ * this: names are the policy's mutable state (`fPoolSetName`), so a rename forks nothing.
875
1045
  */
876
1046
  salt?: Hex;
877
1047
  account: Address;
@@ -884,13 +1054,12 @@ export declare function sortFPoolLegs<T>(bases: Address[], ...companions: T[][])
884
1054
  bases: Address[];
885
1055
  companions: T[][];
886
1056
  };
887
- /** The key as the manager hashes it: legs sorted, the kind's policy filled in when none is named. */
1057
+ /** The key as the manager hashes it: legs sorted, the kind's policy filled in when none is named; no kind in it (049). */
888
1058
  export declare function fPoolKeyOf(c: LogswapClient, a: Omit<FPoolCreateArgs, "account">): {
889
1059
  quote: `0x${string}`;
890
1060
  bases: `0x${string}`[];
891
1061
  weights: bigint[];
892
1062
  phi: bigint;
893
- kind: 0 | 1 | 3 | 2;
894
1063
  policy: `0x${string}`;
895
1064
  creator: `0x${string}`;
896
1065
  salt: `0x${string}`;
@@ -1020,7 +1189,7 @@ export interface FPoolLaunchArgs extends Omit<FPoolCreateArgs, "account"> {
1020
1189
  amountIn: bigint;
1021
1190
  minOut?: bigint;
1022
1191
  };
1023
- /** The pool's label, set in the batch (≤ 31 bytes of UTF-8). */
1192
+ /** The pool's label (≤ 31 bytes of UTF-8) — the policy's word (049), written right after the batch by {@link fPoolLaunch}; not in the batch. */
1024
1193
  name?: string;
1025
1194
  /**
1026
1195
  * The pool already exists (a previous launch got as far as `initialize` and no further — a seed
@@ -1044,9 +1213,9 @@ export declare function fPoolLaunchCalls(poolId: Hex, a: FPoolLaunchArgs & ({
1044
1213
  x0: bigint[];
1045
1214
  })): Hex[];
1046
1215
  /**
1047
- * The desk's opening posture, on its policy (decisions 044): gated minting, the creator listed. No
1048
- * appointment: the authority is the operator until one is appointed (decisions 037). Two writes
1049
- * to `PrivatePolicy`; the launch batch cannot carry them (they are not manager calls).
1216
+ * The desk's opening posture, on its policy (decisions 044, 048): gated minting, the creator a
1217
+ * minter. No appointment: the authority is the operator until one is appointed (decisions 037).
1218
+ * Two writes to `PrivatePolicy`; the launch batch cannot carry them (they are not manager calls).
1050
1219
  */
1051
1220
  export declare function fPoolDeskOpening(c: LogswapClient, a: {
1052
1221
  poolId: Hex;
@@ -1108,35 +1277,53 @@ export declare function fPoolSetGates(c: LogswapClient, a: {
1108
1277
  policy?: Address;
1109
1278
  }): Promise<`0x${string}`>;
1110
1279
  /**
1111
- * Add to or remove from the pool's list, in one call (the authority, on the desk's policy). The list
1112
- * is keyed by the authority that granted it: a handover starts the buyer with an empty one.
1280
+ * Add to or remove from the pool's MINTERS — who may mint, and swap (a zap in is both under one
1281
+ * lock) — in one call (the authority, on the desk's policy; decisions 048). The list is keyed by
1282
+ * the authority that granted it: a handover starts the buyer with an empty one. Stamps the
1283
+ * block: no swap lands in it (047).
1113
1284
  */
1114
- export declare function fPoolSetAllowed(c: LogswapClient, a: {
1285
+ export declare function fPoolSetMinters(c: LogswapClient, a: {
1286
+ poolId: Hex;
1287
+ who: readonly Address[];
1288
+ allowed: boolean;
1289
+ account: Address;
1290
+ policy?: Address;
1291
+ }): Promise<`0x${string}`>;
1292
+ /** Add to or remove from the pool's TAKERS — who may swap only — in one call (the authority; decisions 048). Stamps the block. */
1293
+ export declare function fPoolSetTakers(c: LogswapClient, a: {
1115
1294
  poolId: Hex;
1116
1295
  who: readonly Address[];
1117
1296
  allowed: boolean;
1118
1297
  account: Address;
1119
1298
  policy?: Address;
1120
1299
  }): Promise<`0x${string}`>;
1121
- /** Whether `who` is on the pool's list under its current authority (consulted only while a gate is on). */
1300
+ /** On the pool's minters under its current authority: may mint, and swap. */
1301
+ export declare function fPoolIsMinter(c: LogswapClient, poolId: Hex, who: Address, policy?: Address): Promise<boolean>;
1302
+ /** On the pool's takers under its current authority: may swap only. */
1303
+ export declare function fPoolIsTaker(c: LogswapClient, poolId: Hex, who: Address, policy?: Address): Promise<boolean>;
1304
+ /** May swap: a minter or a taker (consulted only while the swap gate is on). */
1122
1305
  export declare function fPoolIsAllowed(c: LogswapClient, poolId: Hex, who: Address, policy?: Address): Promise<boolean>;
1123
- /** Label the pool — the sponsor's own words, mutable, never identity. At most 31 bytes of UTF-8. */
1306
+ /** Label the pool — the authority's own words on the pool's POLICY (decisions 049), mutable, never identity. At most 31 bytes of UTF-8. */
1124
1307
  export declare function fPoolSetName(c: LogswapClient, a: {
1125
1308
  poolId: Hex;
1126
1309
  name: string;
1127
1310
  account: Address;
1311
+ policy?: Address;
1128
1312
  }): Promise<`0x${string}`>;
1129
1313
  /**
1130
- * What the PROTOCOL says an address is — "Keyrock". Only `feeCollector` may write it, which is
1131
- * what makes it an attestation rather than a claim anyone could make about themselves.
1314
+ * What the PROTOCOL says an address is — "Keyrock" — on the REGISTRY (decisions 049). Only its
1315
+ * owner, the LOG authority, may write it, which is what makes it an attestation rather than a
1316
+ * claim anyone could make about themselves.
1132
1317
  */
1133
1318
  export declare function fPoolSetSponsorName(c: LogswapClient, a: {
1134
1319
  who: Address;
1135
1320
  name: string;
1136
1321
  account: Address;
1137
1322
  }): Promise<`0x${string}`>;
1138
- /** The protocol's attestation for an address, or "" when unattested — which most addresses are. */
1323
+ /** The protocol's attestation for an address, or "" when unattested — which most addresses are, and every address on a deployment with no registry. */
1139
1324
  export declare function fPoolSponsorName(c: LogswapClient, who: Address): Promise<string>;
1325
+ /** The registry the manager asks at every birth — `addresses.policyRegistry`, else the manager's word; zero on a bare deployment. */
1326
+ export declare function fPoolRegistryOf(c: LogswapClient): Promise<Address>;
1140
1327
  /** Who runs the pool (decisions 037): the appointed operator, or the authority until one is. */
1141
1328
  export declare function fPoolOperatorOf(s: Pick<FPoolRoles, "authority" | "operator">): Address;
1142
1329
  /**
@@ -1189,7 +1376,7 @@ export interface DiscoveredFPool {
1189
1376
  weights: bigint[];
1190
1377
  phi: bigint;
1191
1378
  kind: FPoolKind;
1192
- /** The pool's policy — the contract the key names (decisions 041, 044, 045). */
1379
+ /** The pool's policy AT BIRTH — the contract the key names (decisions 041, 044, 045). The LIVE one is {@link getFPool}'s `policy`: the registry's owner may have moved the pool (046, `PolicyMigrated`). */
1193
1380
  policy: Address;
1194
1381
  /** Who was born holding the pool (immutable). The LIVE authority is the policy's — {@link getFPoolRoles}. */
1195
1382
  creator: Address;
@@ -1208,9 +1395,10 @@ export interface DiscoveredFPool {
1208
1395
  shape: FPoolShape;
1209
1396
  }
1210
1397
  /**
1211
- * Every F pool ever created, from `Initialize` logs alone. Possible only because the event
1212
- * carries the full key preimage (bases, weights, phi, pad) — the poolId is a hash and could
1213
- * never be inverted; contracts PR #17 exists for exactly this call.
1398
+ * Every F pool ever created, from `Initialize` logs alone — plus one `kind()` read per distinct
1399
+ * policy, cached. Possible only because the event carries the full key preimage (bases,
1400
+ * weights, phi, policy) — the poolId is a hash and could never be inverted; contracts PR #17
1401
+ * exists for exactly this call.
1214
1402
  */
1215
1403
  export declare function discoverFPools(c: LogswapClient, opts?: {
1216
1404
  fromBlock?: bigint;