@liquid-af/sdk 0.3.0 → 0.4.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/dist/accounts/liquid.d.ts +2 -3
- package/dist/accounts/liquid.d.ts.map +1 -1
- package/dist/accounts/liquid.js +3 -4
- package/dist/accounts/liquid.js.map +1 -1
- package/dist/client.d.ts +4 -4
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +6 -6
- package/dist/client.js.map +1 -1
- package/dist/helpers/preview.d.ts.map +1 -1
- package/dist/helpers/preview.js +1 -1
- package/dist/helpers/preview.js.map +1 -1
- package/dist/idl/index.d.ts +1 -0
- package/dist/idl/index.d.ts.map +1 -1
- package/dist/idl/index.js +15 -4
- package/dist/idl/index.js.map +1 -1
- package/dist/idl/liquid.d.ts +0 -20
- package/dist/idl/liquid.d.ts.map +1 -1
- package/dist/idl/liquid.json +0 -20
- package/dist/idl/patch-idl.d.ts +10 -0
- package/dist/idl/patch-idl.d.ts.map +1 -0
- package/dist/idl/patch-idl.js +62 -0
- package/dist/idl/patch-idl.js.map +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/instructions/liquid.d.ts.map +1 -1
- package/dist/instructions/liquid.js +3 -3
- package/dist/instructions/liquid.js.map +1 -1
- package/dist/instructions/program-cache.d.ts.map +1 -1
- package/dist/instructions/program-cache.js +10 -6
- package/dist/instructions/program-cache.js.map +1 -1
- package/dist/pda/index.d.ts.map +1 -1
- package/dist/pda/index.js +1 -1
- package/dist/pda/index.js.map +1 -1
- package/dist/pda/liquid.d.ts +2 -3
- package/dist/pda/liquid.d.ts.map +1 -1
- package/dist/pda/liquid.js +3 -4
- package/dist/pda/liquid.js.map +1 -1
- package/package.json +4 -4
- package/src/accounts/liquid-fees.ts +2 -2
- package/src/accounts/liquid-state.ts +7 -7
- package/src/accounts/liquid-swap.ts +4 -4
- package/src/accounts/liquid.ts +7 -10
- package/src/client.ts +33 -36
- package/src/config.ts +10 -10
- package/src/errors.ts +6 -6
- package/src/events/parser.ts +5 -5
- package/src/helpers/preview.ts +31 -32
- package/src/helpers/user.ts +1 -1
- package/src/idl/index.ts +31 -8
- package/src/idl/liquid.json +0 -20
- package/src/idl/liquid.ts +0 -20
- package/src/idl/patch-idl.ts +80 -0
- package/src/index.ts +1 -0
- package/src/instructions/liquid-fees.ts +14 -14
- package/src/instructions/liquid-state.ts +4 -4
- package/src/instructions/liquid-swap.ts +18 -18
- package/src/instructions/liquid.ts +47 -50
- package/src/instructions/program-cache.ts +18 -9
- package/src/math/amm.ts +3 -3
- package/src/math/bonding-curve.ts +6 -6
- package/src/math/fees.ts +9 -9
- package/src/math/tiered-fees.ts +5 -5
- package/src/oracle.ts +3 -3
- package/src/pda/index.ts +27 -28
- package/src/pda/liquid-fees.ts +6 -6
- package/src/pda/liquid-state.ts +13 -13
- package/src/pda/liquid-swap.ts +16 -16
- package/src/pda/liquid.ts +17 -19
- package/src/provider.ts +2 -2
- package/src/transaction/builder.ts +4 -4
- package/src/transaction/send.ts +4 -4
- package/src/types.ts +2 -2
|
@@ -25,21 +25,21 @@ export interface BuildTransactionOptions {
|
|
|
25
25
|
*/
|
|
26
26
|
export function withComputeBudget(
|
|
27
27
|
instructions: TransactionInstruction[],
|
|
28
|
-
options: Pick<BuildTransactionOptions, "computeUnits" | "priorityFee"
|
|
28
|
+
options: Pick<BuildTransactionOptions, "computeUnits" | "priorityFee">,
|
|
29
29
|
): TransactionInstruction[] {
|
|
30
30
|
const budget: TransactionInstruction[] = [];
|
|
31
31
|
if (options.computeUnits !== undefined) {
|
|
32
32
|
budget.push(
|
|
33
33
|
ComputeBudgetProgram.setComputeUnitLimit({
|
|
34
34
|
units: options.computeUnits,
|
|
35
|
-
})
|
|
35
|
+
}),
|
|
36
36
|
);
|
|
37
37
|
}
|
|
38
38
|
if (options.priorityFee !== undefined) {
|
|
39
39
|
budget.push(
|
|
40
40
|
ComputeBudgetProgram.setComputeUnitPrice({
|
|
41
41
|
microLamports: options.priorityFee,
|
|
42
|
-
})
|
|
42
|
+
}),
|
|
43
43
|
);
|
|
44
44
|
}
|
|
45
45
|
return [...budget, ...instructions];
|
|
@@ -58,7 +58,7 @@ export function withComputeBudget(
|
|
|
58
58
|
export async function buildTransaction(
|
|
59
59
|
connection: Connection,
|
|
60
60
|
instructions: TransactionInstruction[],
|
|
61
|
-
options: BuildTransactionOptions
|
|
61
|
+
options: BuildTransactionOptions,
|
|
62
62
|
): Promise<Transaction> {
|
|
63
63
|
const { feePayer, ...budgetOptions } = options;
|
|
64
64
|
const allIxs =
|
package/src/transaction/send.ts
CHANGED
|
@@ -13,11 +13,11 @@ export const confirmTx = async (
|
|
|
13
13
|
connection: Connection,
|
|
14
14
|
signature: string,
|
|
15
15
|
blockhash: string,
|
|
16
|
-
lastValidBlockHeight: number
|
|
16
|
+
lastValidBlockHeight: number,
|
|
17
17
|
): Promise<string> => {
|
|
18
18
|
await connection.confirmTransaction(
|
|
19
19
|
{ blockhash, lastValidBlockHeight, signature },
|
|
20
|
-
"confirmed"
|
|
20
|
+
"confirmed",
|
|
21
21
|
);
|
|
22
22
|
return signature;
|
|
23
23
|
};
|
|
@@ -36,7 +36,7 @@ export const confirmTx = async (
|
|
|
36
36
|
*/
|
|
37
37
|
export const sendAndConfirm = async (
|
|
38
38
|
connection: Connection,
|
|
39
|
-
rpcCall: () => Promise<string
|
|
39
|
+
rpcCall: () => Promise<string>,
|
|
40
40
|
): Promise<string> => {
|
|
41
41
|
try {
|
|
42
42
|
const signature = await rpcCall();
|
|
@@ -60,7 +60,7 @@ export const sendAndConfirm = async (
|
|
|
60
60
|
connection,
|
|
61
61
|
sig,
|
|
62
62
|
blockhash,
|
|
63
|
-
lastValidBlockHeight
|
|
63
|
+
lastValidBlockHeight,
|
|
64
64
|
);
|
|
65
65
|
return sig;
|
|
66
66
|
} catch {
|
package/src/types.ts
CHANGED
|
@@ -25,7 +25,7 @@ export type CurveStatusAnchor =
|
|
|
25
25
|
*/
|
|
26
26
|
export const curveStatusEquals = (
|
|
27
27
|
anchorStatus: CurveStatusAnchor,
|
|
28
|
-
expected: CurveStatus
|
|
28
|
+
expected: CurveStatus,
|
|
29
29
|
): boolean => {
|
|
30
30
|
return Object.keys(anchorStatus)[0] === expected;
|
|
31
31
|
};
|
|
@@ -67,7 +67,7 @@ export const toAnchorFeeMode = (mode: FeeMode): FeeModeAnchor => {
|
|
|
67
67
|
*/
|
|
68
68
|
export const feeModeEquals = (
|
|
69
69
|
anchorMode: FeeModeAnchor,
|
|
70
|
-
expected: FeeMode
|
|
70
|
+
expected: FeeMode,
|
|
71
71
|
): boolean => {
|
|
72
72
|
return Object.keys(anchorMode)[0] === expected;
|
|
73
73
|
};
|