@acta-markets/ts-sdk 0.0.1-beta
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 +308 -0
- package/dist/actaClient.d.ts +46 -0
- package/dist/actaClient.js +99 -0
- package/dist/chain/client.d.ts +65 -0
- package/dist/chain/client.js +82 -0
- package/dist/chain/fetch.d.ts +204 -0
- package/dist/chain/fetch.js +392 -0
- package/dist/chain/fetch.test.d.ts +1 -0
- package/dist/chain/fetch.test.js +158 -0
- package/dist/chain/flows/index.d.ts +1 -0
- package/dist/chain/flows/index.js +1 -0
- package/dist/chain/flows/openPosition.d.ts +48 -0
- package/dist/chain/flows/openPosition.js +78 -0
- package/dist/chain/flows/openPosition.test.d.ts +1 -0
- package/dist/chain/flows/openPosition.test.js +43 -0
- package/dist/chain/helpers.d.ts +16 -0
- package/dist/chain/helpers.js +60 -0
- package/dist/chain/index.d.ts +9 -0
- package/dist/chain/index.js +9 -0
- package/dist/chain/instructions.admin.d.ts +44 -0
- package/dist/chain/instructions.admin.js +113 -0
- package/dist/chain/instructions.d.ts +5 -0
- package/dist/chain/instructions.js +5 -0
- package/dist/chain/instructions.maker.d.ts +34 -0
- package/dist/chain/instructions.maker.js +86 -0
- package/dist/chain/instructions.market.d.ts +39 -0
- package/dist/chain/instructions.market.js +107 -0
- package/dist/chain/instructions.oracle.d.ts +38 -0
- package/dist/chain/instructions.oracle.js +63 -0
- package/dist/chain/instructions.position.d.ts +82 -0
- package/dist/chain/instructions.position.js +240 -0
- package/dist/chain/instructions.resolve.test.d.ts +1 -0
- package/dist/chain/instructions.resolve.test.js +32 -0
- package/dist/chain/instructions.shared.d.ts +23 -0
- package/dist/chain/instructions.shared.js +55 -0
- package/dist/chain/orders.d.ts +40 -0
- package/dist/chain/orders.js +117 -0
- package/dist/chain/orders.test.d.ts +1 -0
- package/dist/chain/orders.test.js +67 -0
- package/dist/chain/signers.d.ts +9 -0
- package/dist/chain/signers.js +19 -0
- package/dist/chain/signers.test.d.ts +1 -0
- package/dist/chain/signers.test.js +13 -0
- package/dist/chain/token.d.ts +59 -0
- package/dist/chain/token.js +136 -0
- package/dist/chain/token.test.d.ts +1 -0
- package/dist/chain/token.test.js +69 -0
- package/dist/chain/tx.d.ts +72 -0
- package/dist/chain/tx.js +97 -0
- package/dist/cjs/actaClient.js +103 -0
- package/dist/cjs/chain/client.js +119 -0
- package/dist/cjs/chain/fetch.js +431 -0
- package/dist/cjs/chain/fetch.test.js +160 -0
- package/dist/cjs/chain/flows/index.js +17 -0
- package/dist/cjs/chain/flows/openPosition.js +81 -0
- package/dist/cjs/chain/flows/openPosition.test.js +45 -0
- package/dist/cjs/chain/helpers.js +67 -0
- package/dist/cjs/chain/index.js +48 -0
- package/dist/cjs/chain/instructions.admin.js +119 -0
- package/dist/cjs/chain/instructions.js +21 -0
- package/dist/cjs/chain/instructions.maker.js +92 -0
- package/dist/cjs/chain/instructions.market.js +112 -0
- package/dist/cjs/chain/instructions.oracle.js +70 -0
- package/dist/cjs/chain/instructions.position.js +247 -0
- package/dist/cjs/chain/instructions.resolve.test.js +34 -0
- package/dist/cjs/chain/instructions.shared.js +64 -0
- package/dist/cjs/chain/orders.js +126 -0
- package/dist/cjs/chain/orders.test.js +69 -0
- package/dist/cjs/chain/signers.js +22 -0
- package/dist/cjs/chain/signers.test.js +15 -0
- package/dist/cjs/chain/token.js +147 -0
- package/dist/cjs/chain/token.test.js +71 -0
- package/dist/cjs/chain/tx.js +103 -0
- package/dist/cjs/constants.js +6 -0
- package/dist/cjs/constants.test.js +31 -0
- package/dist/cjs/events.js +75 -0
- package/dist/cjs/events.test.js +384 -0
- package/dist/cjs/generated/accounts/config.js +79 -0
- package/dist/cjs/generated/accounts/index.js +28 -0
- package/dist/cjs/generated/accounts/maker.js +71 -0
- package/dist/cjs/generated/accounts/market.js +93 -0
- package/dist/cjs/generated/accounts/oracle.js +85 -0
- package/dist/cjs/generated/accounts/position.js +89 -0
- package/dist/cjs/generated/errors/actaContract.js +154 -0
- package/dist/cjs/generated/errors/index.js +24 -0
- package/dist/cjs/generated/index.js +28 -0
- package/dist/cjs/generated/instructions/changeOracleSource.js +81 -0
- package/dist/cjs/generated/instructions/closeMarket.js +83 -0
- package/dist/cjs/generated/instructions/closeOracle.js +79 -0
- package/dist/cjs/generated/instructions/createMarket.js +116 -0
- package/dist/cjs/generated/instructions/createOracle.js +99 -0
- package/dist/cjs/generated/instructions/depositFundsToPosition.js +101 -0
- package/dist/cjs/generated/instructions/depositPremium.js +96 -0
- package/dist/cjs/generated/instructions/finalizeMarket.js +91 -0
- package/dist/cjs/generated/instructions/index.js +43 -0
- package/dist/cjs/generated/instructions/initializeConfig.js +108 -0
- package/dist/cjs/generated/instructions/liquidatePosition.js +107 -0
- package/dist/cjs/generated/instructions/openPosition.js +154 -0
- package/dist/cjs/generated/instructions/registerMaker.js +90 -0
- package/dist/cjs/generated/instructions/setOracleConfig.js +80 -0
- package/dist/cjs/generated/instructions/settlePosition.js +104 -0
- package/dist/cjs/generated/instructions/topupFeeFund.js +96 -0
- package/dist/cjs/generated/instructions/updateConfig.js +86 -0
- package/dist/cjs/generated/instructions/updateMakerQuoteSigning.js +79 -0
- package/dist/cjs/generated/instructions/updateMarketOracles.js +96 -0
- package/dist/cjs/generated/instructions/updateOraclePrice.js +89 -0
- package/dist/cjs/generated/instructions/withdrawFromFeeFund.js +96 -0
- package/dist/cjs/generated/instructions/withdrawPremium.js +96 -0
- package/dist/cjs/generated/programs/actaContract.js +108 -0
- package/dist/cjs/generated/programs/index.js +24 -0
- package/dist/cjs/generated/shared/index.js +94 -0
- package/dist/cjs/generated/types/actaEvent.js +342 -0
- package/dist/cjs/generated/types/eventKind.js +45 -0
- package/dist/cjs/generated/types/index.js +27 -0
- package/dist/cjs/generated/types/positionStatus.js +31 -0
- package/dist/cjs/generated/types/positionType.js +28 -0
- package/dist/cjs/idl/acta_contract.json +2329 -0
- package/dist/cjs/idl/hash.js +4 -0
- package/dist/cjs/index.js +84 -0
- package/dist/cjs/nonce.js +93 -0
- package/dist/cjs/package.json +3 -0
- package/dist/cjs/types/index.js +18 -0
- package/dist/cjs/types/orderId.js +40 -0
- package/dist/cjs/types/orders.js +10 -0
- package/dist/cjs/ws/apy.js +106 -0
- package/dist/cjs/ws/apy.test.js +29 -0
- package/dist/cjs/ws/auth.js +104 -0
- package/dist/cjs/ws/client.handshake.integration.test.js +69 -0
- package/dist/cjs/ws/client.js +861 -0
- package/dist/cjs/ws/client.test.js +230 -0
- package/dist/cjs/ws/discovery.js +48 -0
- package/dist/cjs/ws/flows.js +101 -0
- package/dist/cjs/ws/flows.test.js +85 -0
- package/dist/cjs/ws/index.js +23 -0
- package/dist/cjs/ws/sponsoredTx.js +95 -0
- package/dist/cjs/ws/types.js +14 -0
- package/dist/cjs/ws/wirePolicy.js +34 -0
- package/dist/constants.d.ts +2 -0
- package/dist/constants.js +3 -0
- package/dist/constants.test.d.ts +1 -0
- package/dist/constants.test.js +29 -0
- package/dist/events.d.ts +15 -0
- package/dist/events.js +64 -0
- package/dist/events.test.d.ts +1 -0
- package/dist/events.test.js +382 -0
- package/dist/generated/accounts/config.d.ts +47 -0
- package/dist/generated/accounts/config.js +68 -0
- package/dist/generated/accounts/index.d.ts +12 -0
- package/dist/generated/accounts/index.js +12 -0
- package/dist/generated/accounts/maker.d.ts +39 -0
- package/dist/generated/accounts/maker.js +60 -0
- package/dist/generated/accounts/market.d.ts +61 -0
- package/dist/generated/accounts/market.js +82 -0
- package/dist/generated/accounts/oracle.d.ts +53 -0
- package/dist/generated/accounts/oracle.js +74 -0
- package/dist/generated/accounts/position.d.ts +57 -0
- package/dist/generated/accounts/position.js +78 -0
- package/dist/generated/errors/actaContract.d.ts +103 -0
- package/dist/generated/errors/actaContract.js +149 -0
- package/dist/generated/errors/index.d.ts +8 -0
- package/dist/generated/errors/index.js +8 -0
- package/dist/generated/index.d.ts +12 -0
- package/dist/generated/index.js +12 -0
- package/dist/generated/instructions/changeOracleSource.d.ts +50 -0
- package/dist/generated/instructions/changeOracleSource.js +72 -0
- package/dist/generated/instructions/closeMarket.d.ts +58 -0
- package/dist/generated/instructions/closeMarket.js +74 -0
- package/dist/generated/instructions/closeOracle.d.ts +48 -0
- package/dist/generated/instructions/closeOracle.js +70 -0
- package/dist/generated/instructions/createMarket.d.ts +90 -0
- package/dist/generated/instructions/createMarket.js +107 -0
- package/dist/generated/instructions/createOracle.d.ts +71 -0
- package/dist/generated/instructions/createOracle.js +90 -0
- package/dist/generated/instructions/depositFundsToPosition.d.ts +73 -0
- package/dist/generated/instructions/depositFundsToPosition.js +92 -0
- package/dist/generated/instructions/depositPremium.d.ts +62 -0
- package/dist/generated/instructions/depositPremium.js +87 -0
- package/dist/generated/instructions/finalizeMarket.d.ts +63 -0
- package/dist/generated/instructions/finalizeMarket.js +82 -0
- package/dist/generated/instructions/index.d.ts +27 -0
- package/dist/generated/instructions/index.js +27 -0
- package/dist/generated/instructions/initializeConfig.d.ts +75 -0
- package/dist/generated/instructions/initializeConfig.js +99 -0
- package/dist/generated/instructions/liquidatePosition.d.ts +78 -0
- package/dist/generated/instructions/liquidatePosition.js +98 -0
- package/dist/generated/instructions/openPosition.d.ts +130 -0
- package/dist/generated/instructions/openPosition.js +145 -0
- package/dist/generated/instructions/registerMaker.d.ts +57 -0
- package/dist/generated/instructions/registerMaker.js +81 -0
- package/dist/generated/instructions/setOracleConfig.d.ts +53 -0
- package/dist/generated/instructions/setOracleConfig.js +71 -0
- package/dist/generated/instructions/settlePosition.d.ts +78 -0
- package/dist/generated/instructions/settlePosition.js +95 -0
- package/dist/generated/instructions/topupFeeFund.d.ts +67 -0
- package/dist/generated/instructions/topupFeeFund.js +87 -0
- package/dist/generated/instructions/updateConfig.d.ts +58 -0
- package/dist/generated/instructions/updateConfig.js +77 -0
- package/dist/generated/instructions/updateMakerQuoteSigning.d.ts +47 -0
- package/dist/generated/instructions/updateMakerQuoteSigning.js +70 -0
- package/dist/generated/instructions/updateMarketOracles.d.ts +65 -0
- package/dist/generated/instructions/updateMarketOracles.js +87 -0
- package/dist/generated/instructions/updateOraclePrice.d.ts +55 -0
- package/dist/generated/instructions/updateOraclePrice.js +80 -0
- package/dist/generated/instructions/withdrawFromFeeFund.d.ts +62 -0
- package/dist/generated/instructions/withdrawFromFeeFund.js +87 -0
- package/dist/generated/instructions/withdrawPremium.d.ts +62 -0
- package/dist/generated/instructions/withdrawPremium.js +87 -0
- package/dist/generated/programs/actaContract.d.ts +83 -0
- package/dist/generated/programs/actaContract.js +104 -0
- package/dist/generated/programs/index.d.ts +8 -0
- package/dist/generated/programs/index.js +8 -0
- package/dist/generated/shared/index.d.ts +49 -0
- package/dist/generated/shared/index.js +86 -0
- package/dist/generated/types/actaEvent.d.ts +249 -0
- package/dist/generated/types/actaEvent.js +335 -0
- package/dist/generated/types/eventKind.d.ts +33 -0
- package/dist/generated/types/eventKind.js +39 -0
- package/dist/generated/types/index.d.ts +11 -0
- package/dist/generated/types/index.js +11 -0
- package/dist/generated/types/positionStatus.d.ts +19 -0
- package/dist/generated/types/positionStatus.js +25 -0
- package/dist/generated/types/positionType.d.ts +16 -0
- package/dist/generated/types/positionType.js +22 -0
- package/dist/idl/acta_contract.json +2329 -0
- package/dist/idl/hash.d.ts +1 -0
- package/dist/idl/hash.js +1 -0
- package/dist/index.d.ts +109 -0
- package/dist/index.js +34 -0
- package/dist/nonce.d.ts +29 -0
- package/dist/nonce.js +89 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.js +2 -0
- package/dist/types/orderId.d.ts +13 -0
- package/dist/types/orderId.js +35 -0
- package/dist/types/orders.d.ts +9 -0
- package/dist/types/orders.js +9 -0
- package/dist/ws/apy.d.ts +79 -0
- package/dist/ws/apy.js +98 -0
- package/dist/ws/apy.test.d.ts +1 -0
- package/dist/ws/apy.test.js +27 -0
- package/dist/ws/auth.d.ts +67 -0
- package/dist/ws/auth.js +98 -0
- package/dist/ws/client.d.ts +263 -0
- package/dist/ws/client.handshake.integration.test.d.ts +1 -0
- package/dist/ws/client.handshake.integration.test.js +64 -0
- package/dist/ws/client.js +857 -0
- package/dist/ws/client.test.d.ts +1 -0
- package/dist/ws/client.test.js +228 -0
- package/dist/ws/discovery.d.ts +13 -0
- package/dist/ws/discovery.js +44 -0
- package/dist/ws/flows.d.ts +44 -0
- package/dist/ws/flows.js +96 -0
- package/dist/ws/flows.test.d.ts +1 -0
- package/dist/ws/flows.test.js +83 -0
- package/dist/ws/index.d.ts +7 -0
- package/dist/ws/index.js +7 -0
- package/dist/ws/sponsoredTx.d.ts +39 -0
- package/dist/ws/sponsoredTx.js +92 -0
- package/dist/ws/types.d.ts +900 -0
- package/dist/ws/types.js +13 -0
- package/dist/ws/wirePolicy.d.ts +12 -0
- package/dist/ws/wirePolicy.js +30 -0
- package/package.json +87 -0
package/README.md
ADDED
|
@@ -0,0 +1,308 @@
|
|
|
1
|
+
# Acta TypeScript SDK
|
|
2
|
+
|
|
3
|
+
Generated by Codama.
|
|
4
|
+
|
|
5
|
+
- On-chain utilities live under `src/chain` (PDA helpers, instruction builders, fetchers, token helpers, tx sending).
|
|
6
|
+
- WebSocket client lives under `src/ws` (canonical RFQ-server protocol).
|
|
7
|
+
- `ActaClient` is the unified facade that optionally composes `ws` and/or `chain`.
|
|
8
|
+
|
|
9
|
+
## Package
|
|
10
|
+
|
|
11
|
+
Published package: **`@acta-markets/ts-sdk-v1@0.0.9-beta`** (ESM-first, CJS fallback)
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
yarn add @acta-markets/ts-sdk-v1@0.0.9-beta
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Tooling
|
|
18
|
+
|
|
19
|
+
- `yarn install`
|
|
20
|
+
- `yarn gen:codama` – regenerate `src/generated` from `src/idl/acta_contract.json`.
|
|
21
|
+
- `yarn build` – runs codegen then `tsc`.
|
|
22
|
+
- `yarn test` – Jest (offset/order encoding, order helpers).
|
|
23
|
+
|
|
24
|
+
## Exposed helpers
|
|
25
|
+
|
|
26
|
+
- `chain/helpers.ts`: `findConfigPda`, `findMakerPda`, `findMarketPda`, `findPositionPda`.
|
|
27
|
+
- `chain/orders.ts`:
|
|
28
|
+
- `computeOrderId` / `encodeOrderPreimage` — compute `orderId = sha256(preimage)` (32 bytes).
|
|
29
|
+
- `orderSignatureInstruction` / `signOrderInstruction` — build Ed25519 verify instructions (sign **32-byte orderId** for on-chain use).
|
|
30
|
+
- `nonce.ts`: `NonceGenerator` — deterministic Xoshiro256++ nonce generator for makers (seed optional; uses `crypto.getRandomValues` if available).
|
|
31
|
+
- `chain/fetch.ts`: GPA helpers via `createSolanaRpc` + memcmp offsets; decoded accessors for markets/positions/config.
|
|
32
|
+
- `ws/client.ts`: `ActaWsClient` (auth challenge, reconnect/backoff, ping, local state, ChainEvent).
|
|
33
|
+
|
|
34
|
+
All instructions/codecs are in `src/generated/instructions` (Codama @solana/kit style); program id exported as `ACTA_PROGRAM_ID` and `getActaProgramId()` from `src/index.ts`.
|
|
35
|
+
|
|
36
|
+
## Facade: ActaClient
|
|
37
|
+
|
|
38
|
+
You can instantiate WS-only, chain-only, or both:
|
|
39
|
+
|
|
40
|
+
```ts
|
|
41
|
+
import { ActaClient } from "@acta-markets/ts-sdk-v1";
|
|
42
|
+
|
|
43
|
+
// WS-only
|
|
44
|
+
const c1 = new ActaClient({ ws: { url: "wss://...", role: "taker" } });
|
|
45
|
+
|
|
46
|
+
// Chain-only
|
|
47
|
+
const c2 = new ActaClient({ chain: { rpc, rpcSubscriptions, payer } });
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Web app quickstart (taker-only)
|
|
51
|
+
|
|
52
|
+
### 1) Connect to WS anonymously, then authenticate on “Connect wallet”
|
|
53
|
+
|
|
54
|
+
```ts
|
|
55
|
+
import { ActaClient } from "@acta-markets/ts-sdk-v1";
|
|
56
|
+
import { WalletAuthProvider } from "@acta-markets/ts-sdk-v1/ws";
|
|
57
|
+
|
|
58
|
+
const client = new ActaClient({ ws: { url: "wss://localhost:8080", role: "taker" } });
|
|
59
|
+
const auth = new WalletAuthProvider({
|
|
60
|
+
publicKeyBase58: walletPublicKeyBase58,
|
|
61
|
+
signMessage: async (msg: Uint8Array) => wallet.signMessage(msg),
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
// No wallet prompt:
|
|
65
|
+
client.ws!.connectAnonymous();
|
|
66
|
+
|
|
67
|
+
// Later, on “Connect wallet” button:
|
|
68
|
+
await client.ws!.authenticate(auth);
|
|
69
|
+
client.ws!.on("snapshot", (s) => console.log("snapshot", s));
|
|
70
|
+
client.ws!.on("chainEvent", (e) => console.log("chain event", e));
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
#### Auth providers (why there are multiple)
|
|
74
|
+
|
|
75
|
+
- **`WalletAuthProvider`**: browser wallets (Phantom/Privy/etc.) that support `signMessage` (typical web integration).
|
|
76
|
+
- **`KeypairAuthProvider`**: Node scripts/CI/bots where you load a local keypair (e.g. from `KEYPAIR_PATH`).
|
|
77
|
+
- **`CustomAuthProvider`**: advanced integrations (remote signers, hardware wallets, nonstandard wallet APIs).
|
|
78
|
+
- **`AuthProvider` (type)**: shared interface the WS client accepts.
|
|
79
|
+
- **`WalletLike` (type)**: minimal wallet adapter shape (no dependency on wallet-adapter / web3.js types).
|
|
80
|
+
|
|
81
|
+
### Markets + positions without on-chain RPC (WS convenience)
|
|
82
|
+
|
|
83
|
+
```ts
|
|
84
|
+
client.ws!.on("markets", (markets) => console.log("markets", markets));
|
|
85
|
+
client.ws!.on("positions", (positions) => console.log("positions", positions));
|
|
86
|
+
|
|
87
|
+
client.ws!.getMarkets();
|
|
88
|
+
// positions require auth:
|
|
89
|
+
// client.ws!.getPositions();
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### RFQ → accept quote → sign sponsored tx (wallet UX)
|
|
93
|
+
|
|
94
|
+
```ts
|
|
95
|
+
// 1) Request RFQ
|
|
96
|
+
client.ws!.createRfq({
|
|
97
|
+
market: marketPdaBase58,
|
|
98
|
+
position_type: "cash_secured_put",
|
|
99
|
+
strike: 136_000_000_000,
|
|
100
|
+
quantity: 20_000_000,
|
|
101
|
+
timeoutSeconds: 31,
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
// RFQ window is short-lived. If it expires, server sends Error.code="rfq_expired".
|
|
105
|
+
// To get fresh quotes, you must send a new createRfq (new rfq_id).
|
|
106
|
+
|
|
107
|
+
// 2) Pick a quote and accept it
|
|
108
|
+
client.ws!.on("quoteReceived", (q) => {
|
|
109
|
+
// ... render / pick best quote
|
|
110
|
+
});
|
|
111
|
+
await client.ws!.acceptQuote(rfqId, makerPubkeyBase58, orderIdHex32);
|
|
112
|
+
|
|
113
|
+
// If accept is rejected with Error.code="quote_expired" or "quote_refresh_required",
|
|
114
|
+
// backend asked maker to refresh. Wait for a refreshed QuoteReceived (new order_id) and accept that.
|
|
115
|
+
|
|
116
|
+
// 3) Backend sends a v0 tx template (fee payer signature missing).
|
|
117
|
+
// Use wallet.signTransaction so the user sees preview/simulation UX.
|
|
118
|
+
client.ws!.on("sponsoredTxToSign", async (orderIdHex, txBase64, signatureDeadline) => {
|
|
119
|
+
// If your wallet exposes `signTransaction` (Phantom/Privy via adapters), you can use it.
|
|
120
|
+
// Alternatively (lighter): sign the **message bytes** and fill signature slot 1.
|
|
121
|
+
const signedTxBase64 = await import("@acta-markets/ts-sdk-v1/ws").then(({ signSponsoredTxBase64 }) =>
|
|
122
|
+
signSponsoredTxBase64({
|
|
123
|
+
txBase64,
|
|
124
|
+
taker: { signMessage: (msg: Uint8Array) => wallet.signMessage(msg) },
|
|
125
|
+
takerSignatureIndex: 1,
|
|
126
|
+
})
|
|
127
|
+
);
|
|
128
|
+
|
|
129
|
+
await client.ws!.submitSignedSponsoredTx({ orderIdHex, txBase64: signedTxBase64 });
|
|
130
|
+
});
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
### Handling server errors (RFQ/quote lifecycle)
|
|
134
|
+
|
|
135
|
+
The server sends structured error messages:
|
|
136
|
+
|
|
137
|
+
```json
|
|
138
|
+
{ "type": "Error", "data": { "code": "string", "message": "string" } }
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
In the SDK you can listen to raw messages to branch on `code`:
|
|
142
|
+
|
|
143
|
+
```ts
|
|
144
|
+
client.ws!.on("message", (m) => {
|
|
145
|
+
if (m.type !== "Error") return;
|
|
146
|
+
switch (m.data.code) {
|
|
147
|
+
case "rfq_expired":
|
|
148
|
+
// show “quotes expired” and offer a “Retry RFQ” button
|
|
149
|
+
break;
|
|
150
|
+
case "quote_expired":
|
|
151
|
+
case "quote_refresh_required":
|
|
152
|
+
// wait for refreshed QuoteReceived (new order_id) and accept again
|
|
153
|
+
break;
|
|
154
|
+
}
|
|
155
|
+
});
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
### APR/APY (annualized premium yield) from quotes
|
|
159
|
+
|
|
160
|
+
Frontends often want to display a simple “premium yield” as an annualized percentage.
|
|
161
|
+
Given:
|
|
162
|
+
|
|
163
|
+
- `price` = gross premium per 1 underlying (1e9 scale)
|
|
164
|
+
- `strike` = price per 1 underlying (1e9 scale)
|
|
165
|
+
- `market.expiry_ts` = option expiry (unix seconds)
|
|
166
|
+
|
|
167
|
+
The **term yield** (not annualized) is:
|
|
168
|
+
|
|
169
|
+
- cash-secured put: `term_yield = price / strike`
|
|
170
|
+
- covered call: `term_yield = price / spot_price` (requires current spot price \(S\))
|
|
171
|
+
|
|
172
|
+
Then annualize using time to expiry \(dt = expiry\_ts - now\):
|
|
173
|
+
|
|
174
|
+
- APR (simple): `apr = term_yield * (seconds_per_year / dt)`
|
|
175
|
+
- APY (compounded): `apy = (1 + term_yield)^(seconds_per_year / dt) - 1`
|
|
176
|
+
|
|
177
|
+
TS SDK helper (WS-only, no on-chain RPC needed):
|
|
178
|
+
|
|
179
|
+
```ts
|
|
180
|
+
import { ws } from "@acta-markets/ts-sdk-v1";
|
|
181
|
+
|
|
182
|
+
const secondsToExpiry = rfq.market.expiry_ts - Math.floor(Date.now() / 1000);
|
|
183
|
+
|
|
184
|
+
// Example: if you already render quantity as “10 SOL”, pass underlyingAmount=10.
|
|
185
|
+
const { apr, apy, premiumNotional } = ws.computeApyFromScaledPrices({
|
|
186
|
+
positionType: "cash_secured_put",
|
|
187
|
+
underlyingAmount: 10,
|
|
188
|
+
grossPremiumPerUnit1e9: quote.price, // u64, 1e9 scale
|
|
189
|
+
strike1e9: rfq.strike, // u64, 1e9 scale
|
|
190
|
+
secondsToExpiry,
|
|
191
|
+
});
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
Note:
|
|
195
|
+
- This is a **display metric** (premium / collateral annualized), not a promise of “guaranteed yield”.
|
|
196
|
+
- For covered calls you also need `spotPrice1e9` (from your own spot feed) to value collateral in quote units.
|
|
197
|
+
|
|
198
|
+
### Chain flow helpers
|
|
199
|
+
|
|
200
|
+
Build the minimal instruction set for `open_position` (maker ed25519 verify + open ix):
|
|
201
|
+
|
|
202
|
+
```ts
|
|
203
|
+
import { chain } from "@acta-markets/ts-sdk-v1";
|
|
204
|
+
|
|
205
|
+
const built = await chain.flows.buildOpenPositionFlowIxs({
|
|
206
|
+
underlyingMint,
|
|
207
|
+
quoteMint,
|
|
208
|
+
expiryTs,
|
|
209
|
+
isPut,
|
|
210
|
+
positionType,
|
|
211
|
+
strike,
|
|
212
|
+
quantity,
|
|
213
|
+
price,
|
|
214
|
+
validUntil,
|
|
215
|
+
nonce,
|
|
216
|
+
user,
|
|
217
|
+
makerOwner,
|
|
218
|
+
makerQuoteSigning,
|
|
219
|
+
makerSigner,
|
|
220
|
+
keeper: user,
|
|
221
|
+
});
|
|
222
|
+
|
|
223
|
+
// built.ixs = [makerSigIx, openPositionIx]
|
|
224
|
+
// then: client.chain!.tx.sendAndConfirmIxs({ ixs: built.ixs, ... })
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
## Program ID override
|
|
228
|
+
|
|
229
|
+
By default the SDK targets the mainnet deployment program id exported from `src/generated/programs`.
|
|
230
|
+
For tests/devnet you can override it at runtime:
|
|
231
|
+
|
|
232
|
+
```ts
|
|
233
|
+
import { setActaProgramId, clearActaProgramId } from "@acta-markets/ts-sdk-v1";
|
|
234
|
+
// setActaProgramId("...devnet program id..." as Address<string>);
|
|
235
|
+
// clearActaProgramId();
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
## Recipe: open_position (hash-based orderId)
|
|
239
|
+
|
|
240
|
+
On-chain expects an **Ed25519 verify instruction** (maker) immediately followed by `open_position`, where the signature signs the same **32-byte `orderId`**:
|
|
241
|
+
|
|
242
|
+
```ts
|
|
243
|
+
import { randomBytes } from "crypto";
|
|
244
|
+
import { Address } from "@solana/addresses";
|
|
245
|
+
import { PositionType } from "@acta-markets/ts-sdk-v1";
|
|
246
|
+
import {
|
|
247
|
+
computeOrderId,
|
|
248
|
+
orderSignatureInstruction,
|
|
249
|
+
findMarketPda,
|
|
250
|
+
findPositionPda,
|
|
251
|
+
buildOpenPositionIx,
|
|
252
|
+
} from "@acta-markets/ts-sdk-v1/chain";
|
|
253
|
+
|
|
254
|
+
const nonce = Buffer.from(randomBytes(8)).readBigUInt64LE(0);
|
|
255
|
+
const orderId = computeOrderId({
|
|
256
|
+
isTakerBuy: false,
|
|
257
|
+
positionType: PositionType.CoveredCall,
|
|
258
|
+
market: marketPda, // PDA of the market you will open against
|
|
259
|
+
strike,
|
|
260
|
+
quantity,
|
|
261
|
+
price: grossPerUnit, // gross per-unit (1e9 scale)
|
|
262
|
+
validUntil,
|
|
263
|
+
maker: makerOwner,
|
|
264
|
+
taker: user,
|
|
265
|
+
nonce,
|
|
266
|
+
});
|
|
267
|
+
|
|
268
|
+
const positionPda = await findPositionPda({ orderId });
|
|
269
|
+
|
|
270
|
+
// makerSig is a 64-byte Ed25519 signature over `orderId` (NOT over the preimage).
|
|
271
|
+
const makerSigIx = orderSignatureInstruction({
|
|
272
|
+
publicKey: makerQuoteSigning,
|
|
273
|
+
signature: makerSig,
|
|
274
|
+
message: orderId,
|
|
275
|
+
});
|
|
276
|
+
|
|
277
|
+
const openIx = await buildOpenPositionIx({
|
|
278
|
+
keeper,
|
|
279
|
+
user,
|
|
280
|
+
makerOwner,
|
|
281
|
+
underlyingMint,
|
|
282
|
+
quoteMint,
|
|
283
|
+
premiumMint: quoteMint,
|
|
284
|
+
positionType: PositionType.CoveredCall,
|
|
285
|
+
strike,
|
|
286
|
+
quantity,
|
|
287
|
+
price: grossPerUnit,
|
|
288
|
+
validUntil,
|
|
289
|
+
nonce,
|
|
290
|
+
orderId,
|
|
291
|
+
isPut,
|
|
292
|
+
expiryTs,
|
|
293
|
+
configPda, // optional; derived from premium mint if omitted
|
|
294
|
+
});
|
|
295
|
+
|
|
296
|
+
// Send [makerSigIx, openIx] in one tx (plus any ATA/setup ixs you need).
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
## OrderId rules (SDK-wide)
|
|
300
|
+
|
|
301
|
+
- **Canonical**: `orderId` is always **32 bytes** (`sha256(preimage182)`), same as the on-chain program expects.
|
|
302
|
+
- **In code**: use `Uint8Array(32)` everywhere.
|
|
303
|
+
- **JSON / WS wire**: when `order_id` must be a string, it is **64-char hex** (32 bytes). SDK flow helpers handle encoding/decoding for you.
|
|
304
|
+
|
|
305
|
+
## WS order status events
|
|
306
|
+
|
|
307
|
+
Events: `orderAccepted/orderSubmitted/orderConfirmed/orderFailed` carry `orderId: string`.
|
|
308
|
+
In this SDK the string is **64-char hex** (i.e. a **32-byte orderId**, sha256).
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { ActaChainClient, type ChainOptions } from "./chain";
|
|
2
|
+
import { ActaWsClient, type ActaWsClientOptions } from "./ws";
|
|
3
|
+
import type { AuthProvider } from "./ws/auth";
|
|
4
|
+
export type ActaClientOptions = {
|
|
5
|
+
/**
|
|
6
|
+
* Optional on-chain component.
|
|
7
|
+
* - If provided, `client.chain` is constructed immediately.
|
|
8
|
+
* - If omitted, on-chain features are unavailable until `createChain()`.
|
|
9
|
+
*/
|
|
10
|
+
chain?: ChainOptions;
|
|
11
|
+
/**
|
|
12
|
+
* Optional WS component (RFQ server).
|
|
13
|
+
* - If provided, `client.ws` is constructed immediately (but not connected).
|
|
14
|
+
* - Call `client.connectWs(authProvider)` or `client.ws.connect(authProvider)` to start.
|
|
15
|
+
*/
|
|
16
|
+
ws?: ActaWsClientOptions;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Unified Acta client facade.
|
|
20
|
+
*
|
|
21
|
+
* - `client.chain` is optional (on-chain only usage is supported)
|
|
22
|
+
* - `client.ws` is optional (ws-only usage is supported)
|
|
23
|
+
*/
|
|
24
|
+
export declare class ActaClient {
|
|
25
|
+
chain?: ActaChainClient;
|
|
26
|
+
ws?: ActaWsClient;
|
|
27
|
+
private chainOpts?;
|
|
28
|
+
private wsOpts?;
|
|
29
|
+
constructor(opts?: ActaClientOptions);
|
|
30
|
+
createChain(opts: ChainOptions): this;
|
|
31
|
+
updateChain(patch: Partial<ChainOptions>): this;
|
|
32
|
+
createWs(opts: ActaWsClientOptions): this;
|
|
33
|
+
updateWs(patch: Partial<ActaWsClientOptions>): this;
|
|
34
|
+
/** Throw if `chain` is not configured, otherwise return it (for ergonomic call sites). */
|
|
35
|
+
assertChain(): ActaChainClient;
|
|
36
|
+
/** Throw if `ws` is not configured, otherwise return it (for ergonomic call sites). */
|
|
37
|
+
assertWs(): ActaWsClient;
|
|
38
|
+
/** Convenience: `client.connectWs(auth)` instead of `client.ws!.connect(auth)`. */
|
|
39
|
+
connectWs(authProvider: AuthProvider): this;
|
|
40
|
+
/** Convenience: connect and trigger auth flow in one call. */
|
|
41
|
+
connectWsAndAuthenticate(authProvider: AuthProvider): this;
|
|
42
|
+
/** Convenience: connect WS without triggering auth (anonymous browsing). */
|
|
43
|
+
connectWsAnonymous(): this;
|
|
44
|
+
/** Convenience: disconnect WS (and stop reconnect timers). */
|
|
45
|
+
disconnectWs(): this;
|
|
46
|
+
}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { ActaChainClient } from "./chain";
|
|
2
|
+
import { ActaWsClient } from "./ws";
|
|
3
|
+
/**
|
|
4
|
+
* Unified Acta client facade.
|
|
5
|
+
*
|
|
6
|
+
* - `client.chain` is optional (on-chain only usage is supported)
|
|
7
|
+
* - `client.ws` is optional (ws-only usage is supported)
|
|
8
|
+
*/
|
|
9
|
+
export class ActaClient {
|
|
10
|
+
chain;
|
|
11
|
+
ws;
|
|
12
|
+
chainOpts;
|
|
13
|
+
wsOpts;
|
|
14
|
+
constructor(opts = {}) {
|
|
15
|
+
if (opts.chain)
|
|
16
|
+
this.createChain(opts.chain);
|
|
17
|
+
if (opts.ws)
|
|
18
|
+
this.createWs(opts.ws);
|
|
19
|
+
}
|
|
20
|
+
createChain(opts) {
|
|
21
|
+
this.chainOpts = opts;
|
|
22
|
+
this.chain = new ActaChainClient(opts);
|
|
23
|
+
return this;
|
|
24
|
+
}
|
|
25
|
+
updateChain(patch) {
|
|
26
|
+
if (!this.chainOpts) {
|
|
27
|
+
throw new Error("Cannot update chain: chain is not configured");
|
|
28
|
+
}
|
|
29
|
+
const next = {
|
|
30
|
+
...this.chainOpts,
|
|
31
|
+
...patch,
|
|
32
|
+
...(Object.prototype.hasOwnProperty.call(patch, "rpcSubscriptions")
|
|
33
|
+
? { rpcSubscriptions: patch.rpcSubscriptions }
|
|
34
|
+
: null),
|
|
35
|
+
};
|
|
36
|
+
return this.createChain(next);
|
|
37
|
+
}
|
|
38
|
+
createWs(opts) {
|
|
39
|
+
this.wsOpts = opts;
|
|
40
|
+
// If a previous instance exists, ensure it's not reconnecting anymore.
|
|
41
|
+
if (this.ws) {
|
|
42
|
+
try {
|
|
43
|
+
this.ws.disconnect();
|
|
44
|
+
}
|
|
45
|
+
catch {
|
|
46
|
+
// ignore
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
this.ws = new ActaWsClient(opts);
|
|
50
|
+
return this;
|
|
51
|
+
}
|
|
52
|
+
updateWs(patch) {
|
|
53
|
+
if (!this.wsOpts) {
|
|
54
|
+
throw new Error("Cannot update ws: ws is not configured");
|
|
55
|
+
}
|
|
56
|
+
const next = {
|
|
57
|
+
...this.wsOpts,
|
|
58
|
+
...patch,
|
|
59
|
+
...(Object.prototype.hasOwnProperty.call(patch, "makeSocket")
|
|
60
|
+
? { makeSocket: patch.makeSocket }
|
|
61
|
+
: null),
|
|
62
|
+
};
|
|
63
|
+
return this.createWs(next);
|
|
64
|
+
}
|
|
65
|
+
/** Throw if `chain` is not configured, otherwise return it (for ergonomic call sites). */
|
|
66
|
+
assertChain() {
|
|
67
|
+
if (!this.chain) {
|
|
68
|
+
throw new Error("chain is not configured on this ActaClient instance");
|
|
69
|
+
}
|
|
70
|
+
return this.chain;
|
|
71
|
+
}
|
|
72
|
+
/** Throw if `ws` is not configured, otherwise return it (for ergonomic call sites). */
|
|
73
|
+
assertWs() {
|
|
74
|
+
if (!this.ws) {
|
|
75
|
+
throw new Error("ws is not configured on this ActaClient instance");
|
|
76
|
+
}
|
|
77
|
+
return this.ws;
|
|
78
|
+
}
|
|
79
|
+
/** Convenience: `client.connectWs(auth)` instead of `client.ws!.connect(auth)`. */
|
|
80
|
+
connectWs(authProvider) {
|
|
81
|
+
this.assertWs().connect(authProvider);
|
|
82
|
+
return this;
|
|
83
|
+
}
|
|
84
|
+
/** Convenience: connect and trigger auth flow in one call. */
|
|
85
|
+
connectWsAndAuthenticate(authProvider) {
|
|
86
|
+
this.assertWs().connectAndAuthenticate(authProvider);
|
|
87
|
+
return this;
|
|
88
|
+
}
|
|
89
|
+
/** Convenience: connect WS without triggering auth (anonymous browsing). */
|
|
90
|
+
connectWsAnonymous() {
|
|
91
|
+
this.assertWs().connectAnonymous();
|
|
92
|
+
return this;
|
|
93
|
+
}
|
|
94
|
+
/** Convenience: disconnect WS (and stop reconnect timers). */
|
|
95
|
+
disconnectWs() {
|
|
96
|
+
this.ws?.disconnect();
|
|
97
|
+
return this;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Acta on-chain client wrapper.
|
|
3
|
+
*
|
|
4
|
+
* This is a thin "composition" layer that:
|
|
5
|
+
* - stores rpc/rpcSubscriptions + default payer
|
|
6
|
+
* - exposes existing helpers/builders/fetchers under a single namespace
|
|
7
|
+
* - provides tx execution helpers (`tx.send*`)
|
|
8
|
+
*/
|
|
9
|
+
import type { TransactionSigner } from "@solana/kit";
|
|
10
|
+
import type { Commitment } from "@solana/rpc-types";
|
|
11
|
+
import type { createSolanaRpc } from "@solana/rpc";
|
|
12
|
+
import type { createSolanaRpcSubscriptions } from "@solana/rpc-subscriptions";
|
|
13
|
+
import type { Instruction } from "@solana/instructions";
|
|
14
|
+
import * as helpers from "./helpers";
|
|
15
|
+
import * as instructions from "./instructions";
|
|
16
|
+
import * as fetch from "./fetch";
|
|
17
|
+
import * as orders from "./orders";
|
|
18
|
+
import * as token from "./token";
|
|
19
|
+
import { type Rpc, type RpcSubscriptions, type SendOptions, type SignedTxWithLifetime } from "./tx";
|
|
20
|
+
export type ChainOptions = {
|
|
21
|
+
rpc: ReturnType<typeof createSolanaRpc>;
|
|
22
|
+
rpcSubscriptions?: ReturnType<typeof createSolanaRpcSubscriptions>;
|
|
23
|
+
payer: TransactionSigner<string>;
|
|
24
|
+
commitment?: Commitment;
|
|
25
|
+
};
|
|
26
|
+
export declare class ActaChainClient {
|
|
27
|
+
readonly rpc: Rpc;
|
|
28
|
+
readonly rpcSubscriptions?: RpcSubscriptions;
|
|
29
|
+
readonly payer: TransactionSigner<string>;
|
|
30
|
+
readonly commitment: Commitment;
|
|
31
|
+
readonly helpers: typeof helpers;
|
|
32
|
+
readonly instructions: typeof instructions;
|
|
33
|
+
readonly fetch: typeof fetch;
|
|
34
|
+
readonly orders: typeof orders;
|
|
35
|
+
readonly token: typeof token;
|
|
36
|
+
constructor(opts: ChainOptions);
|
|
37
|
+
/**
|
|
38
|
+
* Transaction helpers.
|
|
39
|
+
*
|
|
40
|
+
* - `buildAndSignIxs`: returns a signed tx and the deterministic signature.
|
|
41
|
+
* - `sendSigned`: send without confirmation.
|
|
42
|
+
* - `sendAndConfirmSigned`: send + confirm (requires `rpcSubscriptions`).
|
|
43
|
+
* - `sendAndConfirmIxs`: build+sign+send+confirm (requires `rpcSubscriptions`).
|
|
44
|
+
*/
|
|
45
|
+
readonly tx: {
|
|
46
|
+
buildAndSignIxs: (args: {
|
|
47
|
+
ixs: Instruction[];
|
|
48
|
+
signers?: TransactionSigner<string>[];
|
|
49
|
+
commitment?: Commitment;
|
|
50
|
+
}) => Promise<SignedTxWithLifetime>;
|
|
51
|
+
sendSigned: (args: {
|
|
52
|
+
signed: SignedTxWithLifetime;
|
|
53
|
+
options?: SendOptions;
|
|
54
|
+
}) => Promise<string>;
|
|
55
|
+
sendAndConfirmSigned: (args: {
|
|
56
|
+
signed: SignedTxWithLifetime;
|
|
57
|
+
options?: SendOptions;
|
|
58
|
+
}) => Promise<string>;
|
|
59
|
+
sendAndConfirmIxs: (args: {
|
|
60
|
+
ixs: Instruction[];
|
|
61
|
+
signers?: TransactionSigner<string>[];
|
|
62
|
+
options?: SendOptions;
|
|
63
|
+
}) => Promise<string>;
|
|
64
|
+
};
|
|
65
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Acta on-chain client wrapper.
|
|
3
|
+
*
|
|
4
|
+
* This is a thin "composition" layer that:
|
|
5
|
+
* - stores rpc/rpcSubscriptions + default payer
|
|
6
|
+
* - exposes existing helpers/builders/fetchers under a single namespace
|
|
7
|
+
* - provides tx execution helpers (`tx.send*`)
|
|
8
|
+
*/
|
|
9
|
+
import * as helpers from "./helpers";
|
|
10
|
+
import * as instructions from "./instructions";
|
|
11
|
+
import * as fetch from "./fetch";
|
|
12
|
+
import * as orders from "./orders";
|
|
13
|
+
import * as token from "./token";
|
|
14
|
+
import { buildAndSignTransactionFromIxs, sendAndConfirmIxs, sendAndConfirmSignedTransaction, sendSignedTransaction, } from "./tx";
|
|
15
|
+
export class ActaChainClient {
|
|
16
|
+
rpc;
|
|
17
|
+
rpcSubscriptions;
|
|
18
|
+
payer;
|
|
19
|
+
commitment;
|
|
20
|
+
// Re-export existing modules for convenience.
|
|
21
|
+
helpers = helpers;
|
|
22
|
+
instructions = instructions;
|
|
23
|
+
fetch = fetch;
|
|
24
|
+
orders = orders;
|
|
25
|
+
token = token;
|
|
26
|
+
constructor(opts) {
|
|
27
|
+
this.rpc = opts.rpc;
|
|
28
|
+
this.rpcSubscriptions = opts.rpcSubscriptions;
|
|
29
|
+
this.payer = opts.payer;
|
|
30
|
+
this.commitment = opts.commitment ?? "confirmed";
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Transaction helpers.
|
|
34
|
+
*
|
|
35
|
+
* - `buildAndSignIxs`: returns a signed tx and the deterministic signature.
|
|
36
|
+
* - `sendSigned`: send without confirmation.
|
|
37
|
+
* - `sendAndConfirmSigned`: send + confirm (requires `rpcSubscriptions`).
|
|
38
|
+
* - `sendAndConfirmIxs`: build+sign+send+confirm (requires `rpcSubscriptions`).
|
|
39
|
+
*/
|
|
40
|
+
tx = {
|
|
41
|
+
buildAndSignIxs: async (args) => {
|
|
42
|
+
return buildAndSignTransactionFromIxs({
|
|
43
|
+
rpc: this.rpc,
|
|
44
|
+
payer: this.payer,
|
|
45
|
+
signers: args.signers,
|
|
46
|
+
ixs: args.ixs,
|
|
47
|
+
commitment: args.commitment ?? this.commitment,
|
|
48
|
+
});
|
|
49
|
+
},
|
|
50
|
+
sendSigned: async (args) => {
|
|
51
|
+
return sendSignedTransaction({
|
|
52
|
+
rpc: this.rpc,
|
|
53
|
+
signed: args.signed,
|
|
54
|
+
options: { commitment: this.commitment, ...args.options },
|
|
55
|
+
});
|
|
56
|
+
},
|
|
57
|
+
sendAndConfirmSigned: async (args) => {
|
|
58
|
+
if (!this.rpcSubscriptions) {
|
|
59
|
+
throw new Error("rpcSubscriptions is required for sendAndConfirm");
|
|
60
|
+
}
|
|
61
|
+
return sendAndConfirmSignedTransaction({
|
|
62
|
+
rpc: this.rpc,
|
|
63
|
+
rpcSubscriptions: this.rpcSubscriptions,
|
|
64
|
+
signed: args.signed,
|
|
65
|
+
options: { commitment: this.commitment, ...args.options },
|
|
66
|
+
});
|
|
67
|
+
},
|
|
68
|
+
sendAndConfirmIxs: async (args) => {
|
|
69
|
+
if (!this.rpcSubscriptions) {
|
|
70
|
+
throw new Error("rpcSubscriptions is required for sendAndConfirm");
|
|
71
|
+
}
|
|
72
|
+
return sendAndConfirmIxs({
|
|
73
|
+
rpc: this.rpc,
|
|
74
|
+
rpcSubscriptions: this.rpcSubscriptions,
|
|
75
|
+
payer: this.payer,
|
|
76
|
+
signers: args.signers,
|
|
77
|
+
ixs: args.ixs,
|
|
78
|
+
options: { commitment: this.commitment, ...args.options },
|
|
79
|
+
});
|
|
80
|
+
},
|
|
81
|
+
};
|
|
82
|
+
}
|