@solard/cli 0.2.33 → 0.2.40
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/package.json +3 -3
- package/src/commands/buy.ts +30 -4
- package/src/commands/sell.ts +19 -4
- package/src/commands/trade-fees.test.ts +18 -6
- package/src/commands/trade-fees.ts +8 -2
- package/src/commands/trade-minimum.test.ts +50 -0
- package/src/commands/trade-minimum.ts +23 -0
- package/src/commands/transfer.test.ts +75 -18
- package/src/commands/transfer.ts +34 -6
- package/src/index.ts +128 -34
- package/src/launch-watch-command.ts +301 -301
- package/src/liquidation-wallets.test.ts +27 -0
- package/src/liquidation-wallets.ts +33 -0
- package/src/price-feed-client.ts +174 -174
- package/src/price-feed-protocol.ts +45 -45
- package/src/price-feed-server.architecture.test.ts +20 -20
- package/src/price-feed-server.ts +315 -315
- package/src/pump/token-launch-cli.ts +1 -1
- package/src/refs.ts +3 -1
- package/src/rpc-management.test.ts +108 -0
- package/src/rpc-management.ts +109 -0
- package/src/trade-strategy-command.ts +1219 -1219
- package/src/wallet-group-filter.test.ts +10 -0
- package/src/wallet-group-filter.ts +12 -0
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import {expect,test}from"bun:test";
|
|
2
|
+
import {excludeWalletGroups}from"./wallet-group-filter.ts";
|
|
3
|
+
test("group exclusion handles overlapping memberships and virtual ungrouped without hiding unknown groups",()=>{
|
|
4
|
+
const wallets=[{address:"a"},{address:"b"},{address:"c"}];const memberships=[{groupName:"oct23-empty",walletAddress:"a"},{groupName:"default",walletAddress:"a"},{groupName:"keep",walletAddress:"b"}];const known=new Set(["oct23-empty","default","keep","empty"]);
|
|
5
|
+
expect(excludeWalletGroups(wallets,["oct23-empty"],memberships,known)).toEqual([{address:"b"},{address:"c"}]);
|
|
6
|
+
expect(excludeWalletGroups(wallets,["ungrouped"],memberships,known)).toEqual([{address:"a"},{address:"b"}]);
|
|
7
|
+
expect(excludeWalletGroups(wallets,["oct23-empty","keep"],memberships,known)).toEqual([{address:"c"}]);
|
|
8
|
+
expect(excludeWalletGroups(wallets,["empty"],memberships,known)).toEqual(wallets);
|
|
9
|
+
expect(()=>excludeWalletGroups(wallets,["typo"],memberships,known)).toThrow("Unknown excluded");
|
|
10
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export function excludeWalletGroups<T extends { address: string }>(
|
|
2
|
+
wallets:T[], names:string[], memberships:ReadonlyArray<{groupName:string;walletAddress:string}>, knownGroups:ReadonlySet<string>,
|
|
3
|
+
):T[] {
|
|
4
|
+
const grouped=new Set(memberships.filter(row=>row.groupName.toLowerCase()!=="ungrouped").map(row=>row.walletAddress));
|
|
5
|
+
const excluded=new Set<string>();
|
|
6
|
+
for(const name of names){
|
|
7
|
+
if(name.toLowerCase()==="ungrouped"){for(const wallet of wallets)if(!grouped.has(wallet.address))excluded.add(wallet.address);continue;}
|
|
8
|
+
if(!knownGroups.has(name))throw Error(`Unknown excluded wallet group: ${name}`);
|
|
9
|
+
for(const row of memberships)if(row.groupName===name)excluded.add(row.walletAddress);
|
|
10
|
+
}
|
|
11
|
+
return wallets.filter(wallet=>!excluded.has(wallet.address));
|
|
12
|
+
}
|