@pipeline-sol/sdk 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +201 -2
- package/dist/actions.d.ts +87 -0
- package/dist/actions.d.ts.map +1 -0
- package/dist/actions.js +326 -0
- package/dist/actions.js.map +1 -0
- package/dist/codecs.d.ts +188 -0
- package/dist/codecs.d.ts.map +1 -0
- package/dist/codecs.js +296 -0
- package/dist/codecs.js.map +1 -0
- package/dist/constants.d.ts +97 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +98 -0
- package/dist/constants.js.map +1 -0
- package/dist/discovery.d.ts +17 -0
- package/dist/discovery.d.ts.map +1 -0
- package/dist/discovery.js +47 -0
- package/dist/discovery.js.map +1 -0
- package/dist/events.d.ts +106 -0
- package/dist/events.d.ts.map +1 -0
- package/dist/events.js +149 -0
- package/dist/events.js.map +1 -0
- package/dist/fees.d.ts +16 -0
- package/dist/fees.d.ts.map +1 -0
- package/dist/fees.js +60 -0
- package/dist/fees.js.map +1 -0
- package/dist/http.d.ts +23 -0
- package/dist/http.d.ts.map +1 -0
- package/dist/http.js +99 -0
- package/dist/http.js.map +1 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +13 -0
- package/dist/index.js.map +1 -0
- package/dist/inspect.d.ts +347 -0
- package/dist/inspect.d.ts.map +1 -0
- package/dist/inspect.js +721 -0
- package/dist/inspect.js.map +1 -0
- package/dist/instructions.d.ts +101 -0
- package/dist/instructions.d.ts.map +1 -0
- package/dist/instructions.js +201 -0
- package/dist/instructions.js.map +1 -0
- package/dist/listing.d.ts +35 -0
- package/dist/listing.d.ts.map +1 -0
- package/dist/listing.js +49 -0
- package/dist/listing.js.map +1 -0
- package/dist/metadata.d.ts +266 -0
- package/dist/metadata.d.ts.map +1 -0
- package/dist/metadata.js +515 -0
- package/dist/metadata.js.map +1 -0
- package/dist/pda.d.ts +21 -0
- package/dist/pda.d.ts.map +1 -0
- package/dist/pda.js +52 -0
- package/dist/pda.js.map +1 -0
- package/dist/quote.d.ts +63 -0
- package/dist/quote.d.ts.map +1 -0
- package/dist/quote.js +169 -0
- package/dist/quote.js.map +1 -0
- package/package.json +56 -5
- package/schema/strategy-metadata.v1.json +171 -0
package/dist/codecs.d.ts
ADDED
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
import { type Address, type Codec, type Decoder, type ReadonlyUint8Array } from '@solana/kit';
|
|
2
|
+
import { ACCOUNT_DISCRIMINATORS } from './constants.js';
|
|
3
|
+
/** Borsh `bool`: one byte that must be 0 or 1. */
|
|
4
|
+
export declare function getBorshBoolCodec(): Codec<boolean>;
|
|
5
|
+
/** Borsh `Option<T>`: a 0 or 1 tag byte, then the value if present. `None` is `null`. */
|
|
6
|
+
export declare function getBorshOptionCodec<TFrom, TTo extends TFrom>(item: Codec<TFrom, TTo>): Codec<TFrom | null, TTo | null>;
|
|
7
|
+
/** Borsh `Vec<u8>`: a u32 length, then the bytes. */
|
|
8
|
+
export declare function getBorshBytesCodec(): Codec<ReadonlyUint8Array>;
|
|
9
|
+
/** Borsh `String`: a u32 byte length, then UTF-8. Invalid UTF-8 fails, as in Rust. */
|
|
10
|
+
export declare function getBorshStringCodec(): Codec<string>;
|
|
11
|
+
/** Borsh `Vec<T>`: a u32 element count, then the elements. */
|
|
12
|
+
export declare function getBorshVecCodec<T>(item: Codec<T>): Codec<T[]>;
|
|
13
|
+
/**
|
|
14
|
+
* Decodes `bytes` completely, as Rust's `try_from_slice`: returns `null` if decoding fails
|
|
15
|
+
* or leaves bytes unread.
|
|
16
|
+
*/
|
|
17
|
+
export declare function decodeExact<T>(decoder: Decoder<T>, bytes: ReadonlyUint8Array): T | null;
|
|
18
|
+
/** Decodes a value from the start of `bytes`, ignoring trailing bytes. `null` on failure. */
|
|
19
|
+
export declare function decodePrefix<T>(decoder: Decoder<T>, bytes: ReadonlyUint8Array): T | null;
|
|
20
|
+
/**
|
|
21
|
+
* Decodes program return data as reported by RPC. The runtime strips trailing zero bytes
|
|
22
|
+
* from recorded return data, so the bytes are padded back with zeros before decoding;
|
|
23
|
+
* a strategy's trailing `0` amounts or `false` flags survive the round trip.
|
|
24
|
+
*/
|
|
25
|
+
export declare function decodeReturnData<T>(decoder: Decoder<T>, bytes: ReadonlyUint8Array): T | null;
|
|
26
|
+
/** Instruction data: an 8-byte discriminator followed by the Borsh-encoded argument. */
|
|
27
|
+
export declare function instructionData<T>(discriminator: ReadonlyUint8Array, codec: Codec<T>, arg: T): Uint8Array;
|
|
28
|
+
/** Decodes instruction data written by {@link instructionData}. `null` on any mismatch. */
|
|
29
|
+
export declare function parseInstruction<T>(discriminator: ReadonlyUint8Array, decoder: Decoder<T>, data: ReadonlyUint8Array): T | null;
|
|
30
|
+
export declare function startsWith(data: ReadonlyUint8Array, prefix: ReadonlyUint8Array): boolean;
|
|
31
|
+
export declare const TradeMode: {
|
|
32
|
+
/** `amount` is the input the strategy receives; it reports the output. */
|
|
33
|
+
readonly ExactIn: 0;
|
|
34
|
+
/** `amount` is the output the strategy must send; it reports the input it needs. */
|
|
35
|
+
readonly ExactOut: 1;
|
|
36
|
+
};
|
|
37
|
+
export type TradeMode = (typeof TradeMode)[keyof typeof TradeMode];
|
|
38
|
+
/** Borsh unit enum: the variant index as one byte. */
|
|
39
|
+
export declare function getTradeModeCodec(): Codec<TradeMode>;
|
|
40
|
+
/**
|
|
41
|
+
* What a trader wants, as seen by the strategy. Amounts are measured at the strategy's
|
|
42
|
+
* own vaults: input is what arrives in the input vault (after any token transfer fee),
|
|
43
|
+
* output is what leaves the output vault (before any token transfer fee).
|
|
44
|
+
*/
|
|
45
|
+
export type TradeRequest = {
|
|
46
|
+
mode: TradeMode;
|
|
47
|
+
/** Index into the market's mints. */
|
|
48
|
+
inputIndex: number;
|
|
49
|
+
outputIndex: number;
|
|
50
|
+
amount: bigint;
|
|
51
|
+
/** `null` for anonymous quotes, such as an aggregator's. */
|
|
52
|
+
trader: Address | null;
|
|
53
|
+
/** Strategy-specific data, passed through from the client unchanged. */
|
|
54
|
+
extra: ReadonlyUint8Array;
|
|
55
|
+
};
|
|
56
|
+
export declare function getTradeRequestCodec(): Codec<TradeRequest>;
|
|
57
|
+
/** Argument of `pipeline_swap`. */
|
|
58
|
+
export type SwapRequest = {
|
|
59
|
+
trade: TradeRequest;
|
|
60
|
+
/** Gross input the router transferred into the input vault just before the call. */
|
|
61
|
+
amountSent: bigint;
|
|
62
|
+
/** The trader's minimum output. The router enforces it independently. */
|
|
63
|
+
minAmountOut: bigint;
|
|
64
|
+
};
|
|
65
|
+
export declare function getSwapRequestCodec(): Codec<SwapRequest>;
|
|
66
|
+
/** Return data of `pipeline_quote`, in the strategy's vault-level units. */
|
|
67
|
+
export type QuoteResult = {
|
|
68
|
+
/** Input the strategy keeps. Exact-in may keep less than requested and refund the rest. */
|
|
69
|
+
amountIn: bigint;
|
|
70
|
+
/** Output the strategy sends. */
|
|
71
|
+
amountOut: bigint;
|
|
72
|
+
};
|
|
73
|
+
export declare function getQuoteResultCodec(): Codec<QuoteResult>;
|
|
74
|
+
/** Return data of `pipeline_market_info`. */
|
|
75
|
+
export type MarketInfo = {
|
|
76
|
+
mints: Address[];
|
|
77
|
+
/** The token account that receives input for each mint, in the same order as `mints`. */
|
|
78
|
+
vaults: Address[];
|
|
79
|
+
supportsExactOut: boolean;
|
|
80
|
+
};
|
|
81
|
+
export declare function getMarketInfoCodec(): Codec<MarketInfo>;
|
|
82
|
+
/** Argument of `pipeline_resolve_accounts`. */
|
|
83
|
+
export type ResolveRequest = {
|
|
84
|
+
trade: TradeRequest;
|
|
85
|
+
/** Starts at 0. Later rounds pass the accounts returned so far after the fixed accounts. */
|
|
86
|
+
round: number;
|
|
87
|
+
};
|
|
88
|
+
export declare function getResolveRequestCodec(): Codec<ResolveRequest>;
|
|
89
|
+
export type AccountRef = {
|
|
90
|
+
address: Address;
|
|
91
|
+
writable: boolean;
|
|
92
|
+
};
|
|
93
|
+
export declare function getAccountRefCodec(): Codec<AccountRef>;
|
|
94
|
+
/**
|
|
95
|
+
* Return data of `pipeline_resolve_accounts`: the full list of strategy-specific accounts
|
|
96
|
+
* known so far (not just this round's additions).
|
|
97
|
+
*/
|
|
98
|
+
export type ResolveResult = {
|
|
99
|
+
accounts: AccountRef[];
|
|
100
|
+
/** `false` if the strategy needs to read the returned accounts before it can list more. */
|
|
101
|
+
complete: boolean;
|
|
102
|
+
};
|
|
103
|
+
export declare function getResolveResultCodec(): Codec<ResolveResult>;
|
|
104
|
+
export type ConfigArgs = {
|
|
105
|
+
listingFeeLamports: bigint;
|
|
106
|
+
listingFeeRecipient: Address;
|
|
107
|
+
treasuryOwner: Address;
|
|
108
|
+
};
|
|
109
|
+
export declare function getConfigArgsCodec(): Codec<ConfigArgs>;
|
|
110
|
+
/** Each field left `null` keeps its current value. */
|
|
111
|
+
export type UpdateConfigArgs = {
|
|
112
|
+
admin: Address | null;
|
|
113
|
+
paused: boolean | null;
|
|
114
|
+
listingFeeLamports: bigint | null;
|
|
115
|
+
listingFeeRecipient: Address | null;
|
|
116
|
+
treasuryOwner: Address | null;
|
|
117
|
+
};
|
|
118
|
+
export declare function getUpdateConfigArgsCodec(): Codec<UpdateConfigArgs>;
|
|
119
|
+
export type SwapArgs = {
|
|
120
|
+
mode: TradeMode;
|
|
121
|
+
/** Exact-in: amount sent to the strategy. Exact-out: the most that may be sent. */
|
|
122
|
+
amountIn: bigint;
|
|
123
|
+
/** Exact-out only: output the strategy must send, in strategy vault units. */
|
|
124
|
+
amountOut: bigint;
|
|
125
|
+
minAmountOut: bigint;
|
|
126
|
+
integratorFeeBps: number;
|
|
127
|
+
/** Number of transfer-hook accounts at the end of the account list. */
|
|
128
|
+
inputHookAccounts: number;
|
|
129
|
+
extra: ReadonlyUint8Array;
|
|
130
|
+
};
|
|
131
|
+
export declare function getSwapArgsCodec(): Codec<SwapArgs>;
|
|
132
|
+
/** Return data of the router's `swap`. */
|
|
133
|
+
export type SwapResult = {
|
|
134
|
+
netSent: bigint;
|
|
135
|
+
received: bigint;
|
|
136
|
+
pipelineFee: bigint;
|
|
137
|
+
integratorFee: bigint;
|
|
138
|
+
};
|
|
139
|
+
export declare function getSwapResultCodec(): Codec<SwapResult>;
|
|
140
|
+
export type Config = {
|
|
141
|
+
admin: Address;
|
|
142
|
+
paused: boolean;
|
|
143
|
+
listingFeeLamports: bigint;
|
|
144
|
+
listingFeeRecipient: Address;
|
|
145
|
+
treasuryOwner: Address;
|
|
146
|
+
bump: number;
|
|
147
|
+
};
|
|
148
|
+
export declare function getConfigCodec(): Codec<Config>;
|
|
149
|
+
export type Strategy = {
|
|
150
|
+
programId: Address;
|
|
151
|
+
metadataUri: string;
|
|
152
|
+
interfaceVersion: number;
|
|
153
|
+
registeredAt: bigint;
|
|
154
|
+
marketCount: bigint;
|
|
155
|
+
bump: number;
|
|
156
|
+
};
|
|
157
|
+
export declare function getStrategyCodec(): Codec<Strategy>;
|
|
158
|
+
export type Market = {
|
|
159
|
+
strategyProgram: Address;
|
|
160
|
+
marketState: Address;
|
|
161
|
+
mintCount: number;
|
|
162
|
+
/** Always four entries; only the first `mintCount` are used. See {@link marketMints}. */
|
|
163
|
+
mints: Address[];
|
|
164
|
+
/** Input vault for each mint, in the same order as `mints`. */
|
|
165
|
+
vaults: Address[];
|
|
166
|
+
supportsExactOut: boolean;
|
|
167
|
+
createdBy: Address;
|
|
168
|
+
createdAt: bigint;
|
|
169
|
+
bump: number;
|
|
170
|
+
feeAuthorityBump: number;
|
|
171
|
+
};
|
|
172
|
+
export declare function getMarketCodec(): Codec<Market>;
|
|
173
|
+
/** The mints a market trades. */
|
|
174
|
+
export declare function marketMints(market: Market): Address[];
|
|
175
|
+
/** The input vault for `mint`, or `null` if the market does not trade it. */
|
|
176
|
+
export declare function marketVaultFor(market: Market, mint: Address): Address | null;
|
|
177
|
+
export type RouterAccountName = keyof typeof ACCOUNT_DISCRIMINATORS;
|
|
178
|
+
/**
|
|
179
|
+
* Decodes a router account, checking its 8-byte Anchor discriminator. Trailing bytes are
|
|
180
|
+
* ignored, because Anchor allocates accounts at their maximum size.
|
|
181
|
+
*/
|
|
182
|
+
export declare function decodeAccount<T>(name: RouterAccountName, decoder: Decoder<T>, data: ReadonlyUint8Array): T | null;
|
|
183
|
+
/** Encodes a router account as stored on chain: discriminator, then Borsh. */
|
|
184
|
+
export declare function encodeAccount<T>(name: RouterAccountName, codec: Codec<T>, value: T): Uint8Array;
|
|
185
|
+
export declare function decodeConfig(data: ReadonlyUint8Array): Config | null;
|
|
186
|
+
export declare function decodeStrategy(data: ReadonlyUint8Array): Strategy | null;
|
|
187
|
+
export declare function decodeMarket(data: ReadonlyUint8Array): Market | null;
|
|
188
|
+
//# sourceMappingURL=codecs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"codecs.d.ts","sourceRoot":"","sources":["../src/codecs.ts"],"names":[],"mappings":"AAOA,OAAO,EAcH,KAAK,OAAO,EACZ,KAAK,KAAK,EACV,KAAK,OAAO,EACZ,KAAK,kBAAkB,EAC1B,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,sBAAsB,EAAqC,MAAM,gBAAgB,CAAC;AAM3F,kDAAkD;AAClD,wBAAgB,iBAAiB,IAAI,KAAK,CAAC,OAAO,CAAC,CAWlD;AAED,yFAAyF;AACzF,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,GAAG,SAAS,KAAK,EACxD,IAAI,EAAE,KAAK,CAAC,KAAK,EAAE,GAAG,CAAC,GACxB,KAAK,CAAC,KAAK,GAAG,IAAI,EAAE,GAAG,GAAG,IAAI,CAAC,CAsBjC;AAED,qDAAqD;AACrD,wBAAgB,kBAAkB,IAAI,KAAK,CAAC,kBAAkB,CAAC,CAE9D;AAKD,sFAAsF;AACtF,wBAAgB,mBAAmB,IAAI,KAAK,CAAC,MAAM,CAAC,CAMnD;AAED,8DAA8D;AAC9D,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,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B,cAAc,IAAI,KAAK,CAAC,MAAM,CAAC,CAa9C;AAED,iCAAiC;AACjC,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,EAAE,CAErD;AAED,6EAA6E;AAC7E,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,GAAG,OAAO,GAAG,IAAI,CAG5E;AAED,MAAM,MAAM,iBAAiB,GAAG,MAAM,OAAO,sBAAsB,CAAC;AAEpE;;;GAGG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAAE,IAAI,EAAE,iBAAiB,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,kBAAkB,GAAG,CAAC,GAAG,IAAI,CAMjH;AAED,8EAA8E;AAC9E,wBAAgB,aAAa,CAAC,CAAC,EAAE,IAAI,EAAE,iBAAiB,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,UAAU,CAE/F;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,kBAAkB,GAAG,MAAM,GAAG,IAAI,CAEpE;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,kBAAkB,GAAG,QAAQ,GAAG,IAAI,CAExE;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,kBAAkB,GAAG,MAAM,GAAG,IAAI,CAEpE"}
|
package/dist/codecs.js
ADDED
|
@@ -0,0 +1,296 @@
|
|
|
1
|
+
// Borsh codecs for every type the router and strategies exchange, built from
|
|
2
|
+
// `@solana/kit` codecs. Layouts mirror the Rust crates `pipeline-strategy-interface` and
|
|
3
|
+
// `pipeline-client` field for field; the cross-language fixtures in `test/` pin them.
|
|
4
|
+
//
|
|
5
|
+
// Conventions: `u64`/`i64` decode to `bigint`, `u8`/`u16` to `number`, `Option<T>` to
|
|
6
|
+
// `T | null`, `Vec<u8>` to a byte array, `Pubkey` to a base58 `Address`.
|
|
7
|
+
import { addCodecSizePrefix, createCodec, getAddressCodec, getArrayCodec, getBytesCodec, getEncodedSize, getI64Codec, getStructCodec, getU16Codec, getU32Codec, getU64Codec, getU8Codec, transformCodec, } from '@solana/kit';
|
|
8
|
+
import { ACCOUNT_DISCRIMINATORS, MAX_MARKET_MINTS, MAX_RETURN_DATA } from './constants.js';
|
|
9
|
+
// ---------------------------------------------------------------------------------------
|
|
10
|
+
// Borsh primitives
|
|
11
|
+
// ---------------------------------------------------------------------------------------
|
|
12
|
+
/** Borsh `bool`: one byte that must be 0 or 1. */
|
|
13
|
+
export function getBorshBoolCodec() {
|
|
14
|
+
return transformCodec(getU8Codec(), (value) => (value ? 1 : 0), (byte) => {
|
|
15
|
+
if (byte > 1) {
|
|
16
|
+
throw new Error(`invalid bool byte ${byte}`);
|
|
17
|
+
}
|
|
18
|
+
return byte === 1;
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
/** Borsh `Option<T>`: a 0 or 1 tag byte, then the value if present. `None` is `null`. */
|
|
22
|
+
export function getBorshOptionCodec(item) {
|
|
23
|
+
return createCodec({
|
|
24
|
+
getSizeFromValue: (value) => (value === null ? 1 : 1 + getEncodedSize(value, item)),
|
|
25
|
+
write: (value, bytes, offset) => {
|
|
26
|
+
if (value === null) {
|
|
27
|
+
bytes.set([0], offset);
|
|
28
|
+
return offset + 1;
|
|
29
|
+
}
|
|
30
|
+
bytes.set([1], offset);
|
|
31
|
+
return item.write(value, bytes, offset + 1);
|
|
32
|
+
},
|
|
33
|
+
read: (bytes, offset) => {
|
|
34
|
+
const tag = bytes[offset];
|
|
35
|
+
if (tag === 0) {
|
|
36
|
+
return [null, offset + 1];
|
|
37
|
+
}
|
|
38
|
+
if (tag === 1) {
|
|
39
|
+
return item.read(bytes, offset + 1);
|
|
40
|
+
}
|
|
41
|
+
throw new Error(`invalid option tag ${tag}`);
|
|
42
|
+
},
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
/** Borsh `Vec<u8>`: a u32 length, then the bytes. */
|
|
46
|
+
export function getBorshBytesCodec() {
|
|
47
|
+
return addCodecSizePrefix(getBytesCodec(), getU32Codec());
|
|
48
|
+
}
|
|
49
|
+
const utf8Encoder = new TextEncoder();
|
|
50
|
+
const utf8Decoder = new TextDecoder('utf-8', { fatal: true, ignoreBOM: true });
|
|
51
|
+
/** Borsh `String`: a u32 byte length, then UTF-8. Invalid UTF-8 fails, as in Rust. */
|
|
52
|
+
export function getBorshStringCodec() {
|
|
53
|
+
return transformCodec(getBorshBytesCodec(), (value) => utf8Encoder.encode(value), (bytes) => utf8Decoder.decode(bytes));
|
|
54
|
+
}
|
|
55
|
+
/** Borsh `Vec<T>`: a u32 element count, then the elements. */
|
|
56
|
+
export function getBorshVecCodec(item) {
|
|
57
|
+
return getArrayCodec(item, { size: getU32Codec() });
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Decodes `bytes` completely, as Rust's `try_from_slice`: returns `null` if decoding fails
|
|
61
|
+
* or leaves bytes unread.
|
|
62
|
+
*/
|
|
63
|
+
export function decodeExact(decoder, bytes) {
|
|
64
|
+
try {
|
|
65
|
+
const [value, end] = decoder.read(bytes, 0);
|
|
66
|
+
return end === bytes.length ? value : null;
|
|
67
|
+
}
|
|
68
|
+
catch {
|
|
69
|
+
return null;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
/** Decodes a value from the start of `bytes`, ignoring trailing bytes. `null` on failure. */
|
|
73
|
+
export function decodePrefix(decoder, bytes) {
|
|
74
|
+
try {
|
|
75
|
+
return decoder.read(bytes, 0)[0];
|
|
76
|
+
}
|
|
77
|
+
catch {
|
|
78
|
+
return null;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Decodes program return data as reported by RPC. The runtime strips trailing zero bytes
|
|
83
|
+
* from recorded return data, so the bytes are padded back with zeros before decoding;
|
|
84
|
+
* a strategy's trailing `0` amounts or `false` flags survive the round trip.
|
|
85
|
+
*/
|
|
86
|
+
export function decodeReturnData(decoder, bytes) {
|
|
87
|
+
if (bytes.length > MAX_RETURN_DATA) {
|
|
88
|
+
return null;
|
|
89
|
+
}
|
|
90
|
+
const padded = new Uint8Array(MAX_RETURN_DATA);
|
|
91
|
+
padded.set(bytes);
|
|
92
|
+
return decodePrefix(decoder, padded);
|
|
93
|
+
}
|
|
94
|
+
/** Instruction data: an 8-byte discriminator followed by the Borsh-encoded argument. */
|
|
95
|
+
export function instructionData(discriminator, codec, arg) {
|
|
96
|
+
const body = codec.encode(arg);
|
|
97
|
+
const data = new Uint8Array(discriminator.length + body.length);
|
|
98
|
+
data.set(discriminator);
|
|
99
|
+
data.set(body, discriminator.length);
|
|
100
|
+
return data;
|
|
101
|
+
}
|
|
102
|
+
/** Decodes instruction data written by {@link instructionData}. `null` on any mismatch. */
|
|
103
|
+
export function parseInstruction(discriminator, decoder, data) {
|
|
104
|
+
if (!startsWith(data, discriminator)) {
|
|
105
|
+
return null;
|
|
106
|
+
}
|
|
107
|
+
return decodeExact(decoder, data.subarray(discriminator.length));
|
|
108
|
+
}
|
|
109
|
+
export function startsWith(data, prefix) {
|
|
110
|
+
if (data.length < prefix.length) {
|
|
111
|
+
return false;
|
|
112
|
+
}
|
|
113
|
+
for (let i = 0; i < prefix.length; i++) {
|
|
114
|
+
if (data[i] !== prefix[i]) {
|
|
115
|
+
return false;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
return true;
|
|
119
|
+
}
|
|
120
|
+
const u8 = getU8Codec;
|
|
121
|
+
const u16 = getU16Codec;
|
|
122
|
+
const u64 = getU64Codec;
|
|
123
|
+
const i64 = getI64Codec;
|
|
124
|
+
const bool = getBorshBoolCodec;
|
|
125
|
+
const pubkey = getAddressCodec;
|
|
126
|
+
const bytes = getBorshBytesCodec;
|
|
127
|
+
const string = getBorshStringCodec;
|
|
128
|
+
// ---------------------------------------------------------------------------------------
|
|
129
|
+
// Strategy interface
|
|
130
|
+
// ---------------------------------------------------------------------------------------
|
|
131
|
+
export const TradeMode = {
|
|
132
|
+
/** `amount` is the input the strategy receives; it reports the output. */
|
|
133
|
+
ExactIn: 0,
|
|
134
|
+
/** `amount` is the output the strategy must send; it reports the input it needs. */
|
|
135
|
+
ExactOut: 1,
|
|
136
|
+
};
|
|
137
|
+
/** Borsh unit enum: the variant index as one byte. */
|
|
138
|
+
export function getTradeModeCodec() {
|
|
139
|
+
return transformCodec(getU8Codec(), (mode) => mode, (byte) => {
|
|
140
|
+
if (byte !== TradeMode.ExactIn && byte !== TradeMode.ExactOut) {
|
|
141
|
+
throw new Error(`invalid trade mode ${byte}`);
|
|
142
|
+
}
|
|
143
|
+
return byte;
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
export function getTradeRequestCodec() {
|
|
147
|
+
return getStructCodec([
|
|
148
|
+
['mode', getTradeModeCodec()],
|
|
149
|
+
['inputIndex', u8()],
|
|
150
|
+
['outputIndex', u8()],
|
|
151
|
+
['amount', u64()],
|
|
152
|
+
['trader', getBorshOptionCodec(pubkey())],
|
|
153
|
+
['extra', bytes()],
|
|
154
|
+
]);
|
|
155
|
+
}
|
|
156
|
+
export function getSwapRequestCodec() {
|
|
157
|
+
return getStructCodec([
|
|
158
|
+
['trade', getTradeRequestCodec()],
|
|
159
|
+
['amountSent', u64()],
|
|
160
|
+
['minAmountOut', u64()],
|
|
161
|
+
]);
|
|
162
|
+
}
|
|
163
|
+
export function getQuoteResultCodec() {
|
|
164
|
+
return getStructCodec([
|
|
165
|
+
['amountIn', u64()],
|
|
166
|
+
['amountOut', u64()],
|
|
167
|
+
]);
|
|
168
|
+
}
|
|
169
|
+
export function getMarketInfoCodec() {
|
|
170
|
+
return getStructCodec([
|
|
171
|
+
['mints', getBorshVecCodec(pubkey())],
|
|
172
|
+
['vaults', getBorshVecCodec(pubkey())],
|
|
173
|
+
['supportsExactOut', bool()],
|
|
174
|
+
]);
|
|
175
|
+
}
|
|
176
|
+
export function getResolveRequestCodec() {
|
|
177
|
+
return getStructCodec([
|
|
178
|
+
['trade', getTradeRequestCodec()],
|
|
179
|
+
['round', u8()],
|
|
180
|
+
]);
|
|
181
|
+
}
|
|
182
|
+
export function getAccountRefCodec() {
|
|
183
|
+
return getStructCodec([
|
|
184
|
+
['address', pubkey()],
|
|
185
|
+
['writable', bool()],
|
|
186
|
+
]);
|
|
187
|
+
}
|
|
188
|
+
export function getResolveResultCodec() {
|
|
189
|
+
return getStructCodec([
|
|
190
|
+
['accounts', getBorshVecCodec(getAccountRefCodec())],
|
|
191
|
+
['complete', bool()],
|
|
192
|
+
]);
|
|
193
|
+
}
|
|
194
|
+
export function getConfigArgsCodec() {
|
|
195
|
+
return getStructCodec([
|
|
196
|
+
['listingFeeLamports', u64()],
|
|
197
|
+
['listingFeeRecipient', pubkey()],
|
|
198
|
+
['treasuryOwner', pubkey()],
|
|
199
|
+
]);
|
|
200
|
+
}
|
|
201
|
+
export function getUpdateConfigArgsCodec() {
|
|
202
|
+
return getStructCodec([
|
|
203
|
+
['admin', getBorshOptionCodec(pubkey())],
|
|
204
|
+
['paused', getBorshOptionCodec(bool())],
|
|
205
|
+
['listingFeeLamports', getBorshOptionCodec(u64())],
|
|
206
|
+
['listingFeeRecipient', getBorshOptionCodec(pubkey())],
|
|
207
|
+
['treasuryOwner', getBorshOptionCodec(pubkey())],
|
|
208
|
+
]);
|
|
209
|
+
}
|
|
210
|
+
export function getSwapArgsCodec() {
|
|
211
|
+
return getStructCodec([
|
|
212
|
+
['mode', getTradeModeCodec()],
|
|
213
|
+
['amountIn', u64()],
|
|
214
|
+
['amountOut', u64()],
|
|
215
|
+
['minAmountOut', u64()],
|
|
216
|
+
['integratorFeeBps', u16()],
|
|
217
|
+
['inputHookAccounts', u8()],
|
|
218
|
+
['extra', bytes()],
|
|
219
|
+
]);
|
|
220
|
+
}
|
|
221
|
+
export function getSwapResultCodec() {
|
|
222
|
+
return getStructCodec([
|
|
223
|
+
['netSent', u64()],
|
|
224
|
+
['received', u64()],
|
|
225
|
+
['pipelineFee', u64()],
|
|
226
|
+
['integratorFee', u64()],
|
|
227
|
+
]);
|
|
228
|
+
}
|
|
229
|
+
export function getConfigCodec() {
|
|
230
|
+
return getStructCodec([
|
|
231
|
+
['admin', pubkey()],
|
|
232
|
+
['paused', bool()],
|
|
233
|
+
['listingFeeLamports', u64()],
|
|
234
|
+
['listingFeeRecipient', pubkey()],
|
|
235
|
+
['treasuryOwner', pubkey()],
|
|
236
|
+
['bump', u8()],
|
|
237
|
+
]);
|
|
238
|
+
}
|
|
239
|
+
export function getStrategyCodec() {
|
|
240
|
+
return getStructCodec([
|
|
241
|
+
['programId', pubkey()],
|
|
242
|
+
['metadataUri', string()],
|
|
243
|
+
['interfaceVersion', u8()],
|
|
244
|
+
['registeredAt', i64()],
|
|
245
|
+
['marketCount', u64()],
|
|
246
|
+
['bump', u8()],
|
|
247
|
+
]);
|
|
248
|
+
}
|
|
249
|
+
export function getMarketCodec() {
|
|
250
|
+
return getStructCodec([
|
|
251
|
+
['strategyProgram', pubkey()],
|
|
252
|
+
['marketState', pubkey()],
|
|
253
|
+
['mintCount', u8()],
|
|
254
|
+
['mints', getArrayCodec(pubkey(), { size: MAX_MARKET_MINTS })],
|
|
255
|
+
['vaults', getArrayCodec(pubkey(), { size: MAX_MARKET_MINTS })],
|
|
256
|
+
['supportsExactOut', bool()],
|
|
257
|
+
['createdBy', pubkey()],
|
|
258
|
+
['createdAt', i64()],
|
|
259
|
+
['bump', u8()],
|
|
260
|
+
['feeAuthorityBump', u8()],
|
|
261
|
+
]);
|
|
262
|
+
}
|
|
263
|
+
/** The mints a market trades. */
|
|
264
|
+
export function marketMints(market) {
|
|
265
|
+
return market.mints.slice(0, market.mintCount);
|
|
266
|
+
}
|
|
267
|
+
/** The input vault for `mint`, or `null` if the market does not trade it. */
|
|
268
|
+
export function marketVaultFor(market, mint) {
|
|
269
|
+
const index = marketMints(market).indexOf(mint);
|
|
270
|
+
return index < 0 ? null : (market.vaults[index] ?? null);
|
|
271
|
+
}
|
|
272
|
+
/**
|
|
273
|
+
* Decodes a router account, checking its 8-byte Anchor discriminator. Trailing bytes are
|
|
274
|
+
* ignored, because Anchor allocates accounts at their maximum size.
|
|
275
|
+
*/
|
|
276
|
+
export function decodeAccount(name, decoder, data) {
|
|
277
|
+
const discriminator = ACCOUNT_DISCRIMINATORS[name];
|
|
278
|
+
if (!startsWith(data, discriminator)) {
|
|
279
|
+
return null;
|
|
280
|
+
}
|
|
281
|
+
return decodePrefix(decoder, data.subarray(discriminator.length));
|
|
282
|
+
}
|
|
283
|
+
/** Encodes a router account as stored on chain: discriminator, then Borsh. */
|
|
284
|
+
export function encodeAccount(name, codec, value) {
|
|
285
|
+
return instructionData(ACCOUNT_DISCRIMINATORS[name], codec, value);
|
|
286
|
+
}
|
|
287
|
+
export function decodeConfig(data) {
|
|
288
|
+
return decodeAccount('Config', getConfigCodec(), data);
|
|
289
|
+
}
|
|
290
|
+
export function decodeStrategy(data) {
|
|
291
|
+
return decodeAccount('Strategy', getStrategyCodec(), data);
|
|
292
|
+
}
|
|
293
|
+
export function decodeMarket(data) {
|
|
294
|
+
return decodeAccount('Market', getMarketCodec(), data);
|
|
295
|
+
}
|
|
296
|
+
//# sourceMappingURL=codecs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"codecs.js","sourceRoot":"","sources":["../src/codecs.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,yFAAyF;AACzF,sFAAsF;AACtF,EAAE;AACF,sFAAsF;AACtF,yEAAyE;AAEzE,OAAO,EACH,kBAAkB,EAClB,WAAW,EACX,eAAe,EACf,aAAa,EACb,aAAa,EACb,cAAc,EACd,WAAW,EACX,cAAc,EACd,WAAW,EACX,WAAW,EACX,WAAW,EACX,UAAU,EACV,cAAc,GAKjB,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,sBAAsB,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAE3F,0FAA0F;AAC1F,mBAAmB;AACnB,0FAA0F;AAE1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I,CAAC,QAAQ,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC;AACtE,CAAC;AAED,8EAA8E;AAC9E,MAAM,UAAU,aAAa,CAAI,IAAuB,EAAE,KAAe,EAAE,KAAQ;IAC/E,OAAO,eAAe,CAAC,sBAAsB,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;AACvE,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,IAAwB;IACjD,OAAO,aAAa,CAAC,QAAQ,EAAE,cAAc,EAAE,EAAE,IAAI,CAAC,CAAC;AAC3D,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,IAAwB;IACnD,OAAO,aAAa,CAAC,UAAU,EAAE,gBAAgB,EAAE,EAAE,IAAI,CAAC,CAAC;AAC/D,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,IAAwB;IACjD,OAAO,aAAa,CAAC,QAAQ,EAAE,cAAc,EAAE,EAAE,IAAI,CAAC,CAAC;AAC3D,CAAC"}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { type Address } from '@solana/kit';
|
|
2
|
+
/** The Pipeline router program. */
|
|
3
|
+
export declare const PIPELINE_PROGRAM_ADDRESS: Address;
|
|
4
|
+
export declare const SYSTEM_PROGRAM_ADDRESS: Address;
|
|
5
|
+
export declare const TOKEN_PROGRAM_ADDRESS: Address;
|
|
6
|
+
export declare const TOKEN_2022_PROGRAM_ADDRESS: Address;
|
|
7
|
+
export declare const ASSOCIATED_TOKEN_PROGRAM_ADDRESS: Address;
|
|
8
|
+
export declare const BPF_LOADER_UPGRADEABLE_PROGRAM_ADDRESS: Address;
|
|
9
|
+
export declare const COMPUTE_BUDGET_PROGRAM_ADDRESS: Address;
|
|
10
|
+
/** The all-zero address, used as the trader of anonymous quotes. */
|
|
11
|
+
export declare const DEFAULT_ADDRESS: Address;
|
|
12
|
+
/** Version of the strategy interface a strategy declares at registration. */
|
|
13
|
+
export declare const INTERFACE_VERSION = 1;
|
|
14
|
+
/** Pipeline's fee on every swap's input, in basis points. */
|
|
15
|
+
export declare const PIPELINE_FEE_BPS = 25n;
|
|
16
|
+
export declare const BPS_DENOMINATOR = 10000n;
|
|
17
|
+
/** A market trades between 2 and 4 mints. */
|
|
18
|
+
export declare const MIN_MARKET_MINTS = 2;
|
|
19
|
+
export declare const MAX_MARKET_MINTS = 4;
|
|
20
|
+
/** Clients stop asking a strategy for more accounts after this many rounds. */
|
|
21
|
+
export declare const MAX_RESOLVE_ROUNDS = 4;
|
|
22
|
+
/** Solana caps return data at 1 KiB. */
|
|
23
|
+
export declare const MAX_RETURN_DATA = 1024;
|
|
24
|
+
/** PDA seeds used by the router. */
|
|
25
|
+
export declare const SEEDS: {
|
|
26
|
+
readonly config: Uint8Array<ArrayBuffer>;
|
|
27
|
+
readonly strategy: Uint8Array<ArrayBuffer>;
|
|
28
|
+
/** `["market", strategy_program, market_state]`. Signs every call into the strategy. */
|
|
29
|
+
readonly market: Uint8Array<ArrayBuffer>;
|
|
30
|
+
/** `["fees", market]`. Owns the market's fee accounts. Never passed to strategies. */
|
|
31
|
+
readonly feeAuthority: Uint8Array<ArrayBuffer>;
|
|
32
|
+
/** `["setup", market]`. Temporary payer for a strategy's market setup. */
|
|
33
|
+
readonly setupPayer: Uint8Array<ArrayBuffer>;
|
|
34
|
+
/**
|
|
35
|
+
* `["pipeline-register"]` derived from the strategy program itself. Lets a program
|
|
36
|
+
* without an upgrade authority register by signing through a CPI.
|
|
37
|
+
*/
|
|
38
|
+
readonly register: Uint8Array<ArrayBuffer>;
|
|
39
|
+
/** Anchor's `#[event_cpi]` authority. */
|
|
40
|
+
readonly eventAuthority: Uint8Array<ArrayBuffer>;
|
|
41
|
+
};
|
|
42
|
+
/** Strategy instruction discriminators: `sha256("global:<name>")[..8]`. */
|
|
43
|
+
export declare const STRATEGY_DISCRIMINATORS: {
|
|
44
|
+
readonly initMarket: Uint8Array<ArrayBuffer>;
|
|
45
|
+
readonly marketInfo: Uint8Array<ArrayBuffer>;
|
|
46
|
+
readonly resolveAccounts: Uint8Array<ArrayBuffer>;
|
|
47
|
+
readonly quote: Uint8Array<ArrayBuffer>;
|
|
48
|
+
readonly swap: Uint8Array<ArrayBuffer>;
|
|
49
|
+
};
|
|
50
|
+
/** Router instruction discriminators: `sha256("global:<name>")[..8]`. */
|
|
51
|
+
export declare const ROUTER_INSTRUCTION_DISCRIMINATORS: {
|
|
52
|
+
readonly initializeConfig: Uint8Array<ArrayBuffer>;
|
|
53
|
+
readonly updateConfig: Uint8Array<ArrayBuffer>;
|
|
54
|
+
readonly registerStrategy: Uint8Array<ArrayBuffer>;
|
|
55
|
+
readonly updateMetadata: Uint8Array<ArrayBuffer>;
|
|
56
|
+
readonly createMarket: Uint8Array<ArrayBuffer>;
|
|
57
|
+
readonly registerExistingMarket: Uint8Array<ArrayBuffer>;
|
|
58
|
+
readonly initFeeAccount: Uint8Array<ArrayBuffer>;
|
|
59
|
+
readonly swap: Uint8Array<ArrayBuffer>;
|
|
60
|
+
readonly sweepFees: Uint8Array<ArrayBuffer>;
|
|
61
|
+
readonly liftPause: Uint8Array<ArrayBuffer>;
|
|
62
|
+
};
|
|
63
|
+
/** Router account discriminators: `sha256("account:<Name>")[..8]`. */
|
|
64
|
+
export declare const ACCOUNT_DISCRIMINATORS: {
|
|
65
|
+
readonly Config: Uint8Array<ArrayBuffer>;
|
|
66
|
+
readonly Strategy: Uint8Array<ArrayBuffer>;
|
|
67
|
+
readonly Market: Uint8Array<ArrayBuffer>;
|
|
68
|
+
};
|
|
69
|
+
/** Anchor's prefix for self-CPI event instructions (`0x1d9acb512ea545e4`, little-endian). */
|
|
70
|
+
export declare const EVENT_IX_TAG: Uint8Array<ArrayBuffer>;
|
|
71
|
+
/** Router event discriminators: `sha256("event:<Name>")[..8]`. */
|
|
72
|
+
export declare const EVENT_DISCRIMINATORS: {
|
|
73
|
+
readonly Swap: Uint8Array<ArrayBuffer>;
|
|
74
|
+
readonly StrategyRegistered: Uint8Array<ArrayBuffer>;
|
|
75
|
+
readonly MetadataUpdated: Uint8Array<ArrayBuffer>;
|
|
76
|
+
readonly MarketCreated: Uint8Array<ArrayBuffer>;
|
|
77
|
+
readonly FeesSwept: Uint8Array<ArrayBuffer>;
|
|
78
|
+
readonly ConfigChanged: Uint8Array<ArrayBuffer>;
|
|
79
|
+
};
|
|
80
|
+
/**
|
|
81
|
+
* Positions of the fixed accounts at the start of `pipeline_swap`, `pipeline_quote` and
|
|
82
|
+
* `pipeline_resolve_accounts`. Strategy-specific accounts follow.
|
|
83
|
+
*/
|
|
84
|
+
export declare const TRADE_ACCOUNTS: {
|
|
85
|
+
readonly marketSigner: 0;
|
|
86
|
+
readonly marketState: 1;
|
|
87
|
+
readonly trader: 2;
|
|
88
|
+
readonly traderInput: 3;
|
|
89
|
+
readonly traderOutput: 4;
|
|
90
|
+
readonly inputVault: 5;
|
|
91
|
+
readonly inputMint: 6;
|
|
92
|
+
readonly outputMint: 7;
|
|
93
|
+
readonly inputTokenProgram: 8;
|
|
94
|
+
readonly outputTokenProgram: 9;
|
|
95
|
+
readonly len: 10;
|
|
96
|
+
};
|
|
97
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,KAAK,OAAO,EAAE,MAAM,aAAa,CAAC;AAEpD,mCAAmC;AACnC,eAAO,MAAM,wBAAwB,EAAE,OAAgE,CAAC;AACxG,eAAO,MAAM,sBAAsB,EAAE,OAAqD,CAAC;AAC3F,eAAO,MAAM,qBAAqB,EAAE,OAAgE,CAAC;AACrG,eAAO,MAAM,0BAA0B,EAAE,OAAgE,CAAC;AAC1G,eAAO,MAAM,gCAAgC,EAAE,OAAiE,CAAC;AACjH,eAAO,MAAM,sCAAsC,EAAE,OAAgE,CAAC;AACtH,eAAO,MAAM,8BAA8B,EAAE,OAAgE,CAAC;AAE9G,oEAAoE;AACp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