@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.
Files changed (74) hide show
  1. package/dist/accounts/liquid.d.ts +2 -3
  2. package/dist/accounts/liquid.d.ts.map +1 -1
  3. package/dist/accounts/liquid.js +3 -4
  4. package/dist/accounts/liquid.js.map +1 -1
  5. package/dist/client.d.ts +4 -4
  6. package/dist/client.d.ts.map +1 -1
  7. package/dist/client.js +6 -6
  8. package/dist/client.js.map +1 -1
  9. package/dist/helpers/preview.d.ts.map +1 -1
  10. package/dist/helpers/preview.js +1 -1
  11. package/dist/helpers/preview.js.map +1 -1
  12. package/dist/idl/index.d.ts +1 -0
  13. package/dist/idl/index.d.ts.map +1 -1
  14. package/dist/idl/index.js +15 -4
  15. package/dist/idl/index.js.map +1 -1
  16. package/dist/idl/liquid.d.ts +0 -20
  17. package/dist/idl/liquid.d.ts.map +1 -1
  18. package/dist/idl/liquid.json +0 -20
  19. package/dist/idl/patch-idl.d.ts +10 -0
  20. package/dist/idl/patch-idl.d.ts.map +1 -0
  21. package/dist/idl/patch-idl.js +62 -0
  22. package/dist/idl/patch-idl.js.map +1 -0
  23. package/dist/index.d.ts +1 -1
  24. package/dist/index.d.ts.map +1 -1
  25. package/dist/index.js +1 -1
  26. package/dist/index.js.map +1 -1
  27. package/dist/instructions/liquid.d.ts.map +1 -1
  28. package/dist/instructions/liquid.js +3 -3
  29. package/dist/instructions/liquid.js.map +1 -1
  30. package/dist/instructions/program-cache.d.ts.map +1 -1
  31. package/dist/instructions/program-cache.js +10 -6
  32. package/dist/instructions/program-cache.js.map +1 -1
  33. package/dist/pda/index.d.ts.map +1 -1
  34. package/dist/pda/index.js +1 -1
  35. package/dist/pda/index.js.map +1 -1
  36. package/dist/pda/liquid.d.ts +2 -3
  37. package/dist/pda/liquid.d.ts.map +1 -1
  38. package/dist/pda/liquid.js +3 -4
  39. package/dist/pda/liquid.js.map +1 -1
  40. package/package.json +4 -4
  41. package/src/accounts/liquid-fees.ts +2 -2
  42. package/src/accounts/liquid-state.ts +7 -7
  43. package/src/accounts/liquid-swap.ts +4 -4
  44. package/src/accounts/liquid.ts +7 -10
  45. package/src/client.ts +33 -36
  46. package/src/config.ts +10 -10
  47. package/src/errors.ts +6 -6
  48. package/src/events/parser.ts +5 -5
  49. package/src/helpers/preview.ts +31 -32
  50. package/src/helpers/user.ts +1 -1
  51. package/src/idl/index.ts +31 -8
  52. package/src/idl/liquid.json +0 -20
  53. package/src/idl/liquid.ts +0 -20
  54. package/src/idl/patch-idl.ts +80 -0
  55. package/src/index.ts +1 -0
  56. package/src/instructions/liquid-fees.ts +14 -14
  57. package/src/instructions/liquid-state.ts +4 -4
  58. package/src/instructions/liquid-swap.ts +18 -18
  59. package/src/instructions/liquid.ts +47 -50
  60. package/src/instructions/program-cache.ts +18 -9
  61. package/src/math/amm.ts +3 -3
  62. package/src/math/bonding-curve.ts +6 -6
  63. package/src/math/fees.ts +9 -9
  64. package/src/math/tiered-fees.ts +5 -5
  65. package/src/oracle.ts +3 -3
  66. package/src/pda/index.ts +27 -28
  67. package/src/pda/liquid-fees.ts +6 -6
  68. package/src/pda/liquid-state.ts +13 -13
  69. package/src/pda/liquid-swap.ts +16 -16
  70. package/src/pda/liquid.ts +17 -19
  71. package/src/provider.ts +2 -2
  72. package/src/transaction/builder.ts +4 -4
  73. package/src/transaction/send.ts +4 -4
  74. 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 =
@@ -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
  };