@vue-solana/vue 1.1.0 → 2.0.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 +9 -8
- package/dist/buffer-polyfill.d.cts +1 -1
- package/dist/buffer-polyfill.d.mts +1 -1
- package/dist/buffer-polyfill.d.ts +1 -1
- package/dist/index.cjs +24 -16
- package/dist/index.d.cts +6 -7
- package/dist/index.d.mts +6 -7
- package/dist/index.d.ts +6 -7
- package/dist/index.mjs +21 -17
- package/dist/kit.cjs +9 -0
- package/dist/kit.d.cts +1 -0
- package/dist/kit.d.mts +1 -0
- package/dist/kit.d.ts +1 -0
- package/dist/kit.mjs +1 -0
- package/dist/shared/{vue.ChnRkpDR.mjs → vue.3VLZmw05.mjs} +2 -2
- package/dist/shared/{vue.DaoqgzJC.mjs → vue.B2sFJ1xI.mjs} +3 -3
- package/dist/shared/{vue.o-mWY2Yg.cjs → vue.BAlo-tIh.cjs} +3 -3
- package/dist/shared/vue.BMencBpI.cjs +82 -0
- package/dist/shared/{vue.Diugnf4a.cjs → vue.B_LRH8SM.cjs} +9 -10
- package/dist/shared/vue.BaFrF2PF.mjs +8 -0
- package/dist/shared/{vue.eNXmiI3a.cjs → vue.BaR1VPhl.cjs} +2 -2
- package/dist/shared/{vue.BTN0h5Il.mjs → vue.BbMPRDeO.mjs} +20 -8
- package/dist/shared/vue.Bfu1dCKe.mjs +10 -0
- package/dist/shared/{vue.CZohWxBN.cjs → vue.C32ozdA1.cjs} +3 -3
- package/dist/shared/{vue.BleajB0B.cjs → vue.C7yR7Cs0.cjs} +20 -8
- package/dist/shared/{vue.D6U1RFZ0.cjs → vue.CEn2purG.cjs} +8 -8
- package/dist/shared/{vue.Dp894nYb.cjs → vue.CP1DPDX9.cjs} +1 -1
- package/dist/shared/{vue.CMJANJ4a.cjs → vue.CSJSK0Nq.cjs} +6 -6
- package/dist/shared/{vue.BM8Qjk74.cjs → vue.CXHYdyKZ.cjs} +9 -9
- package/dist/shared/{vue.vn--SX8d.mjs → vue.CZO8TwJP.mjs} +1 -1
- package/dist/shared/vue.CZwftA0L.cjs +9 -0
- package/dist/shared/vue.ChujsB0B.mjs +7 -0
- package/dist/shared/{vue.DCDTsSjf.mjs → vue.CnUlZSe8.mjs} +2 -2
- package/dist/shared/{vue.Cvg6TEXE.mjs → vue.D7xFeC2m.mjs} +1 -1
- package/dist/shared/{vue.DZWyk9E_.mjs → vue.DL-yMCNc.mjs} +18 -74
- package/dist/shared/vue.DNxOpDXz.cjs +12 -0
- package/dist/shared/{vue.BPuN7ieB.mjs → vue.DP7qY8Rk.mjs} +9 -9
- package/dist/shared/{vue.D5Kmwcx3.cjs → vue.DgCmU1RR.cjs} +1 -1
- package/dist/shared/{vue.B7w1CC4R.mjs → vue.PJjEncbP.mjs} +3 -3
- package/dist/shared/{vue.BBNHeOeb.mjs → vue.WugzPOca.mjs} +6 -6
- package/dist/shared/{vue.CXNFQf3l.cjs → vue.XQFqlMId.cjs} +18 -74
- package/dist/shared/{vue.C5C3l0RQ.cjs → vue.__r7YYZE.cjs} +2 -2
- package/dist/shared/vue.dPRo2X5y.mjs +80 -0
- package/dist/shared/vue.k9Q6aN-0.cjs +10 -0
- package/dist/shared/{vue.DOpWV4b3.mjs → vue.stUBDBI9.mjs} +9 -9
- package/dist/shared/{vue.DYCd9oyI.mjs → vue.yQcL1yMv.mjs} +9 -10
- package/dist/useAccountInfo.cjs +6 -5
- package/dist/useAccountInfo.d.cts +12 -8
- package/dist/useAccountInfo.d.mts +12 -8
- package/dist/useAccountInfo.d.ts +12 -8
- package/dist/useAccountInfo.mjs +6 -5
- package/dist/useBalance.cjs +4 -4
- package/dist/useBalance.d.cts +4 -2
- package/dist/useBalance.d.mts +4 -2
- package/dist/useBalance.d.ts +4 -2
- package/dist/useBalance.mjs +4 -4
- package/dist/useConnection.cjs +3 -3
- package/dist/useConnection.d.cts +9 -2
- package/dist/useConnection.d.mts +9 -2
- package/dist/useConnection.d.ts +9 -2
- package/dist/useConnection.mjs +3 -3
- package/dist/useProgramAccounts.cjs +6 -5
- package/dist/useProgramAccounts.d.cts +24 -9
- package/dist/useProgramAccounts.d.mts +24 -9
- package/dist/useProgramAccounts.d.ts +24 -9
- package/dist/useProgramAccounts.mjs +6 -5
- package/dist/useRpc.cjs +2 -2
- package/dist/useRpc.d.cts +5 -2
- package/dist/useRpc.d.mts +5 -2
- package/dist/useRpc.d.ts +5 -2
- package/dist/useRpc.mjs +2 -2
- package/dist/useSignAndSendTransaction.cjs +6 -6
- package/dist/useSignAndSendTransaction.d.cts +18 -24
- package/dist/useSignAndSendTransaction.d.mts +18 -24
- package/dist/useSignAndSendTransaction.d.ts +18 -24
- package/dist/useSignAndSendTransaction.mjs +6 -6
- package/dist/useSignMessage.cjs +3 -3
- package/dist/useSignMessage.mjs +3 -3
- package/dist/useSignatureStatus.cjs +4 -4
- package/dist/useSignatureStatus.d.cts +9 -5
- package/dist/useSignatureStatus.d.mts +9 -5
- package/dist/useSignatureStatus.d.ts +9 -5
- package/dist/useSignatureStatus.mjs +4 -4
- package/dist/useSolana.cjs +1 -1
- package/dist/useSolana.mjs +1 -1
- package/dist/useSolanaClient.cjs +9 -0
- package/dist/useSolanaClient.d.cts +11 -0
- package/dist/useSolanaClient.d.mts +11 -0
- package/dist/useSolanaClient.d.ts +11 -0
- package/dist/useSolanaClient.mjs +3 -0
- package/dist/useTokenAccounts.cjs +6 -6
- package/dist/useTokenAccounts.d.cts +6 -6
- package/dist/useTokenAccounts.d.mts +6 -6
- package/dist/useTokenAccounts.d.ts +6 -6
- package/dist/useTokenAccounts.mjs +6 -6
- package/dist/useTokenBalance.cjs +6 -6
- package/dist/useTokenBalance.d.cts +2 -2
- package/dist/useTokenBalance.d.mts +2 -2
- package/dist/useTokenBalance.d.ts +2 -2
- package/dist/useTokenBalance.mjs +6 -6
- package/dist/useTransaction.d.cts +1 -2
- package/dist/useTransaction.d.mts +1 -2
- package/dist/useTransaction.d.ts +1 -2
- package/dist/useTransactionConfirmation.cjs +4 -4
- package/dist/useTransactionConfirmation.d.cts +18 -24
- package/dist/useTransactionConfirmation.d.mts +18 -24
- package/dist/useTransactionConfirmation.d.ts +18 -24
- package/dist/useTransactionConfirmation.mjs +4 -4
- package/dist/useWallet.cjs +2 -2
- package/dist/useWallet.d.cts +2 -2
- package/dist/useWallet.d.mts +2 -2
- package/dist/useWallet.d.ts +2 -2
- package/dist/useWallet.mjs +2 -2
- package/dist/useWallets.cjs +2 -2
- package/dist/useWallets.mjs +2 -2
- package/package.json +11 -7
- package/dist/shared/vue.Bii4W61L.cjs +0 -9
- package/dist/shared/vue.CKXhlRu-.cjs +0 -131
- package/dist/shared/vue.CKx4lRew.mjs +0 -7
- package/dist/shared/vue.DgPfVZnU.mjs +0 -129
- package/dist/web3.cjs +0 -13
- package/dist/web3.d.cts +0 -1
- package/dist/web3.d.mts +0 -1
- package/dist/web3.d.ts +0 -1
- package/dist/web3.mjs +0 -1
package/README.md
CHANGED
|
@@ -200,7 +200,7 @@ const { publicKey, connected, connecting, canSignMessage, connect, disconnect }
|
|
|
200
200
|
</button>
|
|
201
201
|
<p>Selected: {{ selectedWallet?.name ?? "None" }}</p>
|
|
202
202
|
<p>Connected: {{ connected }}</p>
|
|
203
|
-
<p>Public key: {{ publicKey
|
|
203
|
+
<p>Public key: {{ publicKey }}</p>
|
|
204
204
|
<p>Can sign messages: {{ canSignMessage }}</p>
|
|
205
205
|
<p v-if="connecting">Connecting...</p>
|
|
206
206
|
<button type="button" :disabled="!selectedWallet || connected || connecting" @click="connect">
|
|
@@ -310,17 +310,18 @@ Docs: [Vue Solana Agent Skill](https://vue-solana-docs.vercel.app/agent-skill)
|
|
|
310
310
|
| `createSolanaPlugin(options?)` | Installs the Vue Solana context. |
|
|
311
311
|
| `VueSolana` | Alias for `createSolanaPlugin`. |
|
|
312
312
|
| `useSolana()` | Returns the full injected Solana context. |
|
|
313
|
-
| `useRpc()` | Returns cluster, endpoint, connection status, latest blockhash, and `checkConnection()`.
|
|
314
|
-
| `
|
|
313
|
+
| `useRpc()` | Returns cluster, endpoint, connection status, latest blockhash, the Kit `client`, and `checkConnection()`. |
|
|
314
|
+
| `useSolanaClient()` | Returns the injected Kit client as `{ client, rpc }`. The recommended RPC path. |
|
|
315
|
+
| `useConnection()` | Returns the Kit `client`. Deprecated in favor of `useSolanaClient()`. |
|
|
315
316
|
| `useWallet()` | Returns wallet refs, computed connection state, and wallet actions. |
|
|
316
317
|
| `useWallets()` | Returns discovered browser extension wallets, Android MWA wallets, iOS browser wallet links, and wallet selection actions. |
|
|
317
318
|
| `useSignMessage()` | Signs arbitrary message bytes through the connected wallet when message signing is supported. |
|
|
318
|
-
| `useBalance(address, commitment?)` | Loads lamport balance for
|
|
319
|
-
| `useAccountInfo(address, options?)` | Loads account info
|
|
319
|
+
| `useBalance(address, commitment?)` | Loads lamport balance for an address string. |
|
|
320
|
+
| `useAccountInfo(address, options?)` | Loads normalized account info (executable, lamports, owner, space, data bytes). |
|
|
320
321
|
| `useProgramAccounts(programId, config?)` | Loads accounts owned by a program with optional filters, commitment, and `dataSlice`. |
|
|
321
322
|
| `useTransaction(handler, options?)` | Generic async transaction state helper with optional timeout settings. |
|
|
322
323
|
| `useTransactionConfirmation(options?)` | Confirms a submitted signature with reactive status and timeout/error state. |
|
|
323
|
-
| `useSignatureStatus(signature, options?)` | Reads a transaction signature status with optional polling
|
|
324
|
+
| `useSignatureStatus(signature, options?)` | Reads a transaction signature status with optional polling. |
|
|
324
325
|
| `useSignAndSendTransaction()` | Signs and sends a transaction through the configured wallet, with optional confirmation waiting. |
|
|
325
326
|
|
|
326
327
|
Direct composable subpaths:
|
|
@@ -341,7 +342,7 @@ Direct composable subpaths:
|
|
|
341
342
|
|
|
342
343
|
Other direct subpaths:
|
|
343
344
|
|
|
344
|
-
- `@vue-solana/vue/
|
|
345
|
+
- `@vue-solana/vue/kit`
|
|
345
346
|
- `@vue-solana/vue/buffer-polyfill`
|
|
346
347
|
|
|
347
348
|
## Caveats
|
|
@@ -350,7 +351,7 @@ Other direct subpaths:
|
|
|
350
351
|
- Public Solana RPC endpoints are useful for development, but production apps should use dedicated RPC infrastructure.
|
|
351
352
|
- Broad `useProgramAccounts()` scans can be expensive or blocked on public RPC nodes. Prefer narrow filters and `dataSlice`.
|
|
352
353
|
- Use `mainnet-beta` for Solana mainnet. `mainnet` is intentionally not accepted as a cluster alias.
|
|
353
|
-
- `@solana/web3-compat
|
|
354
|
+
- v2.0.0 removed `@solana/web3-compat` and the `web3` subpaths. Build transaction messages with `@solana/kit` and pass raw `Uint8Array` wire bytes to wallet flows. See the [Kit Migration guide](https://vue-solana-docs.vercel.app/guides/kit-migration) for migrating from v1.
|
|
354
355
|
- Desktop native app wallets are planned but not implemented yet.
|
|
355
356
|
|
|
356
357
|
## Status
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { Buffer, installSolanaBufferPolyfill } from '@vue-solana/core/buffer-polyfill';
|
|
2
|
-
import '@vue-solana/core/
|
|
2
|
+
import '@vue-solana/core/kit';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { Buffer, installSolanaBufferPolyfill } from '@vue-solana/core/buffer-polyfill';
|
|
2
|
-
import '@vue-solana/core/
|
|
2
|
+
import '@vue-solana/core/kit';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { Buffer, installSolanaBufferPolyfill } from '@vue-solana/core/buffer-polyfill';
|
|
2
|
-
import '@vue-solana/core/
|
|
2
|
+
import '@vue-solana/core/kit';
|
package/dist/index.cjs
CHANGED
|
@@ -1,20 +1,22 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const useAccountInfo = require('./shared/vue.
|
|
4
|
-
const useBalance = require('./shared/vue.
|
|
5
|
-
const useConnection = require('./shared/vue.
|
|
6
|
-
const useProgramAccounts = require('./shared/vue.
|
|
7
|
-
const useRpc = require('./shared/vue.
|
|
8
|
-
const useSignMessage = require('./shared/vue.
|
|
9
|
-
const useSignAndSendTransaction = require('./shared/vue.
|
|
10
|
-
const useSignatureStatus = require('./shared/vue.
|
|
11
|
-
const useSolana = require('./shared/vue.
|
|
12
|
-
const
|
|
13
|
-
const
|
|
3
|
+
const useAccountInfo = require('./shared/vue.BMencBpI.cjs');
|
|
4
|
+
const useBalance = require('./shared/vue.CEn2purG.cjs');
|
|
5
|
+
const useConnection = require('./shared/vue.CZwftA0L.cjs');
|
|
6
|
+
const useProgramAccounts = require('./shared/vue.C7yR7Cs0.cjs');
|
|
7
|
+
const useRpc = require('./shared/vue.__r7YYZE.cjs');
|
|
8
|
+
const useSignMessage = require('./shared/vue.CP1DPDX9.cjs');
|
|
9
|
+
const useSignAndSendTransaction = require('./shared/vue.CSJSK0Nq.cjs');
|
|
10
|
+
const useSignatureStatus = require('./shared/vue.XQFqlMId.cjs');
|
|
11
|
+
const useSolana = require('./shared/vue.BaR1VPhl.cjs');
|
|
12
|
+
const useSolanaClient = require('./shared/vue.k9Q6aN-0.cjs');
|
|
13
|
+
const useTokenAccounts = require('./shared/vue.B_LRH8SM.cjs');
|
|
14
|
+
const useTokenBalance = require('./shared/vue.CXHYdyKZ.cjs');
|
|
14
15
|
const useTransaction = require('./shared/vue.CE5i8KZZ.cjs');
|
|
15
|
-
const useTransactionConfirmation = require('./shared/vue.
|
|
16
|
-
const useWallet = require('./shared/vue.
|
|
17
|
-
const useWallets = require('./shared/vue.
|
|
16
|
+
const useTransactionConfirmation = require('./shared/vue.C32ozdA1.cjs');
|
|
17
|
+
const useWallet = require('./shared/vue.BAlo-tIh.cjs');
|
|
18
|
+
const useWallets = require('./shared/vue.DgCmU1RR.cjs');
|
|
19
|
+
const kit = require('@vue-solana/core/kit');
|
|
18
20
|
const errors = require('@vue-solana/core/errors');
|
|
19
21
|
const rpc = require('@vue-solana/core/rpc');
|
|
20
22
|
const timeout = require('@vue-solana/core/timeout');
|
|
@@ -22,6 +24,7 @@ const walletStandard = require('@vue-solana/core/wallet-standard');
|
|
|
22
24
|
const vue = require('vue');
|
|
23
25
|
const iosWallet = require('@vue-solana/core/ios-wallet');
|
|
24
26
|
require('@vue-solana/core/address');
|
|
27
|
+
require('./shared/vue.DNxOpDXz.cjs');
|
|
25
28
|
require('@vue-solana/core/wallet');
|
|
26
29
|
require('@vue-solana/core/transaction');
|
|
27
30
|
require('bs58');
|
|
@@ -225,13 +228,14 @@ function createSolanaPlugin(options = {}) {
|
|
|
225
228
|
wsEndpoint: context.wsEndpoint
|
|
226
229
|
});
|
|
227
230
|
try {
|
|
228
|
-
const
|
|
229
|
-
context.
|
|
231
|
+
const response = await timeout.withTimeout(
|
|
232
|
+
context.client.rpc.getLatestBlockhash().send(),
|
|
230
233
|
RPC_CHECK_TIMEOUT_MS,
|
|
231
234
|
() => new Error(
|
|
232
235
|
`RPC connection check timed out after ${RPC_CHECK_TIMEOUT_MS / 1e3} seconds.`
|
|
233
236
|
)
|
|
234
237
|
);
|
|
238
|
+
const blockhash = response.value;
|
|
235
239
|
if (checkId !== rpcCheckId) {
|
|
236
240
|
return;
|
|
237
241
|
}
|
|
@@ -372,6 +376,7 @@ exports.useSignatureStatus = useSignatureStatus.useSignatureStatus;
|
|
|
372
376
|
exports.solanaInjectionKey = useSolana.solanaInjectionKey;
|
|
373
377
|
exports.tryUseSolana = useSolana.tryUseSolana;
|
|
374
378
|
exports.useSolana = useSolana.useSolana;
|
|
379
|
+
exports.useSolanaClient = useSolanaClient.useSolanaClient;
|
|
375
380
|
exports.useTokenAccounts = useTokenAccounts.useTokenAccounts;
|
|
376
381
|
exports.useTokenBalance = useTokenBalance.useTokenBalance;
|
|
377
382
|
exports.useTransaction = useTransaction.useTransaction;
|
|
@@ -379,5 +384,8 @@ exports.getConfirmedTransactionStatus = useTransactionConfirmation.getConfirmedT
|
|
|
379
384
|
exports.useTransactionConfirmation = useTransactionConfirmation.useTransactionConfirmation;
|
|
380
385
|
exports.useWallet = useWallet.useWallet;
|
|
381
386
|
exports.useWallets = useWallets.useWallets;
|
|
387
|
+
exports.address = kit.address;
|
|
388
|
+
exports.createSolanaClient = kit.createSolanaClient;
|
|
389
|
+
exports.lamports = kit.lamports;
|
|
382
390
|
exports.VueSolana = VueSolana;
|
|
383
391
|
exports.createSolanaPlugin = createSolanaPlugin;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
export { UseAccountInfoOptions, useAccountInfo } from './useAccountInfo.cjs';
|
|
2
|
-
export { useBalance } from './useBalance.cjs';
|
|
1
|
+
export { AccountInfo, UseAccountInfoOptions, useAccountInfo } from './useAccountInfo.cjs';
|
|
2
|
+
export { BalanceInput, useBalance } from './useBalance.cjs';
|
|
3
3
|
export { useConnection } from './useConnection.cjs';
|
|
4
4
|
export { ProgramAccount, ProgramAccountDataSizeFilter, ProgramAccountDataSlice, ProgramAccountFilter, ProgramAccountMemcmpEncoding, ProgramAccountMemcmpFilter, UseProgramAccountsOptions, useProgramAccounts } from './useProgramAccounts.cjs';
|
|
5
5
|
export { useRpc } from './useRpc.cjs';
|
|
6
6
|
export { SignMessageStatus, useSignMessage } from './useSignMessage.cjs';
|
|
7
7
|
export { SignAndSendTransactionOptions, SignAndSendTransactionStatus, useSignAndSendTransaction } from './useSignAndSendTransaction.cjs';
|
|
8
|
-
export { UseSignatureStatusOptions, useSignatureStatus } from './useSignatureStatus.cjs';
|
|
8
|
+
export { SignatureStatus, UseSignatureStatusOptions, useSignatureStatus } from './useSignatureStatus.cjs';
|
|
9
9
|
export { tryUseSolana, useSolana } from './useSolana.cjs';
|
|
10
|
+
export { useSolanaClient } from './useSolanaClient.cjs';
|
|
10
11
|
export { UseTokenAccountsOptions, useTokenAccounts } from './useTokenAccounts.cjs';
|
|
11
12
|
export { useTokenBalance } from './useTokenBalance.cjs';
|
|
12
13
|
export { UseTransactionOptions, useTransaction } from './useTransaction.cjs';
|
|
@@ -14,15 +15,13 @@ export { TransactionConfirmationStatus, getConfirmedTransactionStatus, useTransa
|
|
|
14
15
|
export { useWallet } from './useWallet.cjs';
|
|
15
16
|
export { useWallets } from './useWallets.cjs';
|
|
16
17
|
export { S as SolanaConnectionStatus, V as VueSolanaContext, s as solanaInjectionKey } from './shared/vue.DL3z5PxP.cjs';
|
|
18
|
+
export { Address, Commitment, Lamports, Rpc, Signature, SolanaClient, SolanaRpcApi, address, createSolanaClient, lamports } from '@vue-solana/core/kit';
|
|
17
19
|
import { GetSolanaIosWalletsOptions } from '@vue-solana/core/ios-wallet';
|
|
18
20
|
import { RegisterSolanaMobileWalletOptions } from '@vue-solana/core/mobile-wallet';
|
|
19
21
|
import { SolanaConfig, SolanaWallet } from '@vue-solana/core/types';
|
|
20
22
|
import { App } from 'vue';
|
|
21
|
-
import '@vue-solana/core/address';
|
|
22
23
|
import '@vue-solana/core/errors';
|
|
23
|
-
import '@
|
|
24
|
-
import '@solana/web3-compat';
|
|
25
|
-
import '@vue-solana/core/spl-token';
|
|
24
|
+
import '@solana/kit';
|
|
26
25
|
import '@vue-solana/core/token-accounts';
|
|
27
26
|
|
|
28
27
|
interface VueSolanaPluginOptions extends SolanaConfig {
|
package/dist/index.d.mts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
export { UseAccountInfoOptions, useAccountInfo } from './useAccountInfo.mjs';
|
|
2
|
-
export { useBalance } from './useBalance.mjs';
|
|
1
|
+
export { AccountInfo, UseAccountInfoOptions, useAccountInfo } from './useAccountInfo.mjs';
|
|
2
|
+
export { BalanceInput, useBalance } from './useBalance.mjs';
|
|
3
3
|
export { useConnection } from './useConnection.mjs';
|
|
4
4
|
export { ProgramAccount, ProgramAccountDataSizeFilter, ProgramAccountDataSlice, ProgramAccountFilter, ProgramAccountMemcmpEncoding, ProgramAccountMemcmpFilter, UseProgramAccountsOptions, useProgramAccounts } from './useProgramAccounts.mjs';
|
|
5
5
|
export { useRpc } from './useRpc.mjs';
|
|
6
6
|
export { SignMessageStatus, useSignMessage } from './useSignMessage.mjs';
|
|
7
7
|
export { SignAndSendTransactionOptions, SignAndSendTransactionStatus, useSignAndSendTransaction } from './useSignAndSendTransaction.mjs';
|
|
8
|
-
export { UseSignatureStatusOptions, useSignatureStatus } from './useSignatureStatus.mjs';
|
|
8
|
+
export { SignatureStatus, UseSignatureStatusOptions, useSignatureStatus } from './useSignatureStatus.mjs';
|
|
9
9
|
export { tryUseSolana, useSolana } from './useSolana.mjs';
|
|
10
|
+
export { useSolanaClient } from './useSolanaClient.mjs';
|
|
10
11
|
export { UseTokenAccountsOptions, useTokenAccounts } from './useTokenAccounts.mjs';
|
|
11
12
|
export { useTokenBalance } from './useTokenBalance.mjs';
|
|
12
13
|
export { UseTransactionOptions, useTransaction } from './useTransaction.mjs';
|
|
@@ -14,15 +15,13 @@ export { TransactionConfirmationStatus, getConfirmedTransactionStatus, useTransa
|
|
|
14
15
|
export { useWallet } from './useWallet.mjs';
|
|
15
16
|
export { useWallets } from './useWallets.mjs';
|
|
16
17
|
export { S as SolanaConnectionStatus, V as VueSolanaContext, s as solanaInjectionKey } from './shared/vue.DL3z5PxP.mjs';
|
|
18
|
+
export { Address, Commitment, Lamports, Rpc, Signature, SolanaClient, SolanaRpcApi, address, createSolanaClient, lamports } from '@vue-solana/core/kit';
|
|
17
19
|
import { GetSolanaIosWalletsOptions } from '@vue-solana/core/ios-wallet';
|
|
18
20
|
import { RegisterSolanaMobileWalletOptions } from '@vue-solana/core/mobile-wallet';
|
|
19
21
|
import { SolanaConfig, SolanaWallet } from '@vue-solana/core/types';
|
|
20
22
|
import { App } from 'vue';
|
|
21
|
-
import '@vue-solana/core/address';
|
|
22
23
|
import '@vue-solana/core/errors';
|
|
23
|
-
import '@
|
|
24
|
-
import '@solana/web3-compat';
|
|
25
|
-
import '@vue-solana/core/spl-token';
|
|
24
|
+
import '@solana/kit';
|
|
26
25
|
import '@vue-solana/core/token-accounts';
|
|
27
26
|
|
|
28
27
|
interface VueSolanaPluginOptions extends SolanaConfig {
|
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
export { UseAccountInfoOptions, useAccountInfo } from './useAccountInfo.js';
|
|
2
|
-
export { useBalance } from './useBalance.js';
|
|
1
|
+
export { AccountInfo, UseAccountInfoOptions, useAccountInfo } from './useAccountInfo.js';
|
|
2
|
+
export { BalanceInput, useBalance } from './useBalance.js';
|
|
3
3
|
export { useConnection } from './useConnection.js';
|
|
4
4
|
export { ProgramAccount, ProgramAccountDataSizeFilter, ProgramAccountDataSlice, ProgramAccountFilter, ProgramAccountMemcmpEncoding, ProgramAccountMemcmpFilter, UseProgramAccountsOptions, useProgramAccounts } from './useProgramAccounts.js';
|
|
5
5
|
export { useRpc } from './useRpc.js';
|
|
6
6
|
export { SignMessageStatus, useSignMessage } from './useSignMessage.js';
|
|
7
7
|
export { SignAndSendTransactionOptions, SignAndSendTransactionStatus, useSignAndSendTransaction } from './useSignAndSendTransaction.js';
|
|
8
|
-
export { UseSignatureStatusOptions, useSignatureStatus } from './useSignatureStatus.js';
|
|
8
|
+
export { SignatureStatus, UseSignatureStatusOptions, useSignatureStatus } from './useSignatureStatus.js';
|
|
9
9
|
export { tryUseSolana, useSolana } from './useSolana.js';
|
|
10
|
+
export { useSolanaClient } from './useSolanaClient.js';
|
|
10
11
|
export { UseTokenAccountsOptions, useTokenAccounts } from './useTokenAccounts.js';
|
|
11
12
|
export { useTokenBalance } from './useTokenBalance.js';
|
|
12
13
|
export { UseTransactionOptions, useTransaction } from './useTransaction.js';
|
|
@@ -14,15 +15,13 @@ export { TransactionConfirmationStatus, getConfirmedTransactionStatus, useTransa
|
|
|
14
15
|
export { useWallet } from './useWallet.js';
|
|
15
16
|
export { useWallets } from './useWallets.js';
|
|
16
17
|
export { S as SolanaConnectionStatus, V as VueSolanaContext, s as solanaInjectionKey } from './shared/vue.DL3z5PxP.js';
|
|
18
|
+
export { Address, Commitment, Lamports, Rpc, Signature, SolanaClient, SolanaRpcApi, address, createSolanaClient, lamports } from '@vue-solana/core/kit';
|
|
17
19
|
import { GetSolanaIosWalletsOptions } from '@vue-solana/core/ios-wallet';
|
|
18
20
|
import { RegisterSolanaMobileWalletOptions } from '@vue-solana/core/mobile-wallet';
|
|
19
21
|
import { SolanaConfig, SolanaWallet } from '@vue-solana/core/types';
|
|
20
22
|
import { App } from 'vue';
|
|
21
|
-
import '@vue-solana/core/address';
|
|
22
23
|
import '@vue-solana/core/errors';
|
|
23
|
-
import '@
|
|
24
|
-
import '@solana/web3-compat';
|
|
25
|
-
import '@vue-solana/core/spl-token';
|
|
24
|
+
import '@solana/kit';
|
|
26
25
|
import '@vue-solana/core/token-accounts';
|
|
27
26
|
|
|
28
27
|
interface VueSolanaPluginOptions extends SolanaConfig {
|
package/dist/index.mjs
CHANGED
|
@@ -1,19 +1,21 @@
|
|
|
1
|
-
export { u as useAccountInfo } from './shared/vue.
|
|
2
|
-
export { u as useBalance } from './shared/vue.
|
|
3
|
-
export { u as useConnection } from './shared/vue.
|
|
4
|
-
export { u as useProgramAccounts } from './shared/vue.
|
|
5
|
-
export { u as useRpc } from './shared/vue.
|
|
6
|
-
export { u as useSignMessage } from './shared/vue.
|
|
7
|
-
export { u as useSignAndSendTransaction } from './shared/vue.
|
|
8
|
-
export { u as useSignatureStatus } from './shared/vue.
|
|
9
|
-
import { s as solanaInjectionKey } from './shared/vue.
|
|
10
|
-
export { t as tryUseSolana, u as useSolana } from './shared/vue.
|
|
11
|
-
export { u as
|
|
12
|
-
export { u as
|
|
1
|
+
export { u as useAccountInfo } from './shared/vue.dPRo2X5y.mjs';
|
|
2
|
+
export { u as useBalance } from './shared/vue.stUBDBI9.mjs';
|
|
3
|
+
export { u as useConnection } from './shared/vue.ChujsB0B.mjs';
|
|
4
|
+
export { u as useProgramAccounts } from './shared/vue.BbMPRDeO.mjs';
|
|
5
|
+
export { u as useRpc } from './shared/vue.3VLZmw05.mjs';
|
|
6
|
+
export { u as useSignMessage } from './shared/vue.CZO8TwJP.mjs';
|
|
7
|
+
export { u as useSignAndSendTransaction } from './shared/vue.WugzPOca.mjs';
|
|
8
|
+
export { u as useSignatureStatus } from './shared/vue.DL-yMCNc.mjs';
|
|
9
|
+
import { s as solanaInjectionKey } from './shared/vue.CnUlZSe8.mjs';
|
|
10
|
+
export { t as tryUseSolana, u as useSolana } from './shared/vue.CnUlZSe8.mjs';
|
|
11
|
+
export { u as useSolanaClient } from './shared/vue.BaFrF2PF.mjs';
|
|
12
|
+
export { u as useTokenAccounts } from './shared/vue.yQcL1yMv.mjs';
|
|
13
|
+
export { u as useTokenBalance } from './shared/vue.DP7qY8Rk.mjs';
|
|
13
14
|
export { u as useTransaction } from './shared/vue.C4d2JA8U.mjs';
|
|
14
|
-
export { g as getConfirmedTransactionStatus, u as useTransactionConfirmation } from './shared/vue.
|
|
15
|
-
export { u as useWallet } from './shared/vue.
|
|
16
|
-
export { u as useWallets } from './shared/vue.
|
|
15
|
+
export { g as getConfirmedTransactionStatus, u as useTransactionConfirmation } from './shared/vue.B2sFJ1xI.mjs';
|
|
16
|
+
export { u as useWallet } from './shared/vue.PJjEncbP.mjs';
|
|
17
|
+
export { u as useWallets } from './shared/vue.D7xFeC2m.mjs';
|
|
18
|
+
export { address, createSolanaClient, lamports } from '@vue-solana/core/kit';
|
|
17
19
|
import { createSolanaError, normalizeSolanaError } from '@vue-solana/core/errors';
|
|
18
20
|
import { createSolanaContext } from '@vue-solana/core/rpc';
|
|
19
21
|
import { withTimeout } from '@vue-solana/core/timeout';
|
|
@@ -21,6 +23,7 @@ import { getRegisteredSolanaWallets, getSolanaChain, adaptSolanaStandardWallet,
|
|
|
21
23
|
import { shallowRef, ref, triggerRef } from 'vue';
|
|
22
24
|
import { handleSolanaIosWalletCallback, getSolanaIosWallets, isSolanaIosWalletInfo, adaptSolanaIosWallet } from '@vue-solana/core/ios-wallet';
|
|
23
25
|
import '@vue-solana/core/address';
|
|
26
|
+
import './shared/vue.Bfu1dCKe.mjs';
|
|
24
27
|
import '@vue-solana/core/wallet';
|
|
25
28
|
import '@vue-solana/core/transaction';
|
|
26
29
|
import 'bs58';
|
|
@@ -224,13 +227,14 @@ function createSolanaPlugin(options = {}) {
|
|
|
224
227
|
wsEndpoint: context.wsEndpoint
|
|
225
228
|
});
|
|
226
229
|
try {
|
|
227
|
-
const
|
|
228
|
-
context.
|
|
230
|
+
const response = await withTimeout(
|
|
231
|
+
context.client.rpc.getLatestBlockhash().send(),
|
|
229
232
|
RPC_CHECK_TIMEOUT_MS,
|
|
230
233
|
() => new Error(
|
|
231
234
|
`RPC connection check timed out after ${RPC_CHECK_TIMEOUT_MS / 1e3} seconds.`
|
|
232
235
|
)
|
|
233
236
|
);
|
|
237
|
+
const blockhash = response.value;
|
|
234
238
|
if (checkId !== rpcCheckId) {
|
|
235
239
|
return;
|
|
236
240
|
}
|
package/dist/kit.cjs
ADDED
package/dist/kit.d.cts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Address, Commitment, Lamports, Rpc, Signature, SolanaClient, SolanaRpcApi, address, createSolanaClient, lamports } from '@vue-solana/core/kit';
|
package/dist/kit.d.mts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Address, Commitment, Lamports, Rpc, Signature, SolanaClient, SolanaRpcApi, address, createSolanaClient, lamports } from '@vue-solana/core/kit';
|
package/dist/kit.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Address, Commitment, Lamports, Rpc, Signature, SolanaClient, SolanaRpcApi, address, createSolanaClient, lamports } from '@vue-solana/core/kit';
|
package/dist/kit.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { address, createSolanaClient, lamports } from '@vue-solana/core/kit';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { computed } from 'vue';
|
|
2
|
-
import { u as useSolana } from './vue.
|
|
2
|
+
import { u as useSolana } from './vue.CnUlZSe8.mjs';
|
|
3
3
|
|
|
4
4
|
function useRpc() {
|
|
5
5
|
const solana = useSolana();
|
|
@@ -11,7 +11,7 @@ function useRpc() {
|
|
|
11
11
|
error: solana.error,
|
|
12
12
|
latestBlockhash: solana.latestBlockhash,
|
|
13
13
|
checkConnection: solana.checkConnection,
|
|
14
|
-
|
|
14
|
+
client: solana.client
|
|
15
15
|
};
|
|
16
16
|
}
|
|
17
17
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { confirmTransactionSignature } from '@vue-solana/core/transaction';
|
|
2
2
|
import { normalizeSolanaError } from '@vue-solana/core/errors';
|
|
3
3
|
import { ref } from 'vue';
|
|
4
|
-
import { u as useConnection } from './vue.
|
|
4
|
+
import { u as useConnection } from './vue.ChujsB0B.mjs';
|
|
5
5
|
|
|
6
6
|
function getConfirmedTransactionStatus(confirmation) {
|
|
7
7
|
if (confirmation.commitment === "finalized") {
|
|
@@ -10,7 +10,7 @@ function getConfirmedTransactionStatus(confirmation) {
|
|
|
10
10
|
return confirmation.commitment === "processed" ? "processed" : "confirmed";
|
|
11
11
|
}
|
|
12
12
|
function useTransactionConfirmation(defaultOptions = {}) {
|
|
13
|
-
const
|
|
13
|
+
const client = useConnection();
|
|
14
14
|
const signature = ref(null);
|
|
15
15
|
const confirmation = ref(null);
|
|
16
16
|
const status = ref("idle");
|
|
@@ -27,7 +27,7 @@ function useTransactionConfirmation(defaultOptions = {}) {
|
|
|
27
27
|
error.value = null;
|
|
28
28
|
try {
|
|
29
29
|
const nextConfirmation = await confirmTransactionSignature(
|
|
30
|
-
|
|
30
|
+
client,
|
|
31
31
|
nextSignature,
|
|
32
32
|
confirmationOptions
|
|
33
33
|
);
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
const errors = require('@vue-solana/core/errors');
|
|
4
4
|
const wallet = require('@vue-solana/core/wallet');
|
|
5
5
|
const vue = require('vue');
|
|
6
|
-
const useSolana = require('./vue.
|
|
6
|
+
const useSolana = require('./vue.BaR1VPhl.cjs');
|
|
7
7
|
|
|
8
8
|
function useWallet() {
|
|
9
9
|
const solana = useSolana.useSolana();
|
|
@@ -22,7 +22,7 @@ function useWallet() {
|
|
|
22
22
|
await connection;
|
|
23
23
|
vue.triggerRef(wallet$1);
|
|
24
24
|
console.info("[Vue Solana] Wallet connected", {
|
|
25
|
-
publicKey: activeWallet.publicKey
|
|
25
|
+
publicKey: activeWallet.publicKey ?? null
|
|
26
26
|
});
|
|
27
27
|
} catch (error) {
|
|
28
28
|
const normalizedError = errors.normalizeSolanaError(error, "RPC_FAILURE");
|
|
@@ -38,7 +38,7 @@ function useWallet() {
|
|
|
38
38
|
if (!activeWallet) {
|
|
39
39
|
return;
|
|
40
40
|
}
|
|
41
|
-
const publicKey = activeWallet.publicKey
|
|
41
|
+
const publicKey = activeWallet.publicKey ?? null;
|
|
42
42
|
disconnecting.value = true;
|
|
43
43
|
try {
|
|
44
44
|
await activeWallet.disconnect();
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const errors = require('@vue-solana/core/errors');
|
|
4
|
+
const vue = require('vue');
|
|
5
|
+
const address = require('@vue-solana/core/address');
|
|
6
|
+
const useConnection = require('./vue.CZwftA0L.cjs');
|
|
7
|
+
const useSolana = require('./vue.BaR1VPhl.cjs');
|
|
8
|
+
const decodeBase64 = require('./vue.DNxOpDXz.cjs');
|
|
9
|
+
|
|
10
|
+
function useAccountInfo(address$1, options = {}) {
|
|
11
|
+
const solana = useSolana.tryUseSolana();
|
|
12
|
+
const client = solana?.client ?? useConnection.useConnection();
|
|
13
|
+
const accountInfo = vue.shallowRef(null);
|
|
14
|
+
const loading = vue.shallowRef(false);
|
|
15
|
+
const error = vue.shallowRef(null);
|
|
16
|
+
let refreshId = 0;
|
|
17
|
+
async function refresh() {
|
|
18
|
+
const requestId = ++refreshId;
|
|
19
|
+
const value = vue.toValue(address$1);
|
|
20
|
+
if (!value || !solana) {
|
|
21
|
+
accountInfo.value = null;
|
|
22
|
+
loading.value = false;
|
|
23
|
+
error.value = null;
|
|
24
|
+
return null;
|
|
25
|
+
}
|
|
26
|
+
loading.value = true;
|
|
27
|
+
error.value = null;
|
|
28
|
+
try {
|
|
29
|
+
const parsedAddress = address.parseAddress(value);
|
|
30
|
+
if (!parsedAddress) {
|
|
31
|
+
accountInfo.value = null;
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
34
|
+
const { value: account } = await client.rpc.getAccountInfo(parsedAddress, {
|
|
35
|
+
encoding: "base64",
|
|
36
|
+
commitment: options.commitment
|
|
37
|
+
}).send();
|
|
38
|
+
const nextAccountInfo = account ? normalizeAccountInfo(account) : null;
|
|
39
|
+
if (requestId === refreshId) {
|
|
40
|
+
accountInfo.value = nextAccountInfo;
|
|
41
|
+
}
|
|
42
|
+
return nextAccountInfo;
|
|
43
|
+
} catch (cause) {
|
|
44
|
+
const normalizedError = errors.normalizeSolanaError(cause, "RPC_FAILURE");
|
|
45
|
+
if (requestId === refreshId) {
|
|
46
|
+
accountInfo.value = null;
|
|
47
|
+
error.value = normalizedError;
|
|
48
|
+
}
|
|
49
|
+
throw normalizedError;
|
|
50
|
+
} finally {
|
|
51
|
+
if (requestId === refreshId) {
|
|
52
|
+
loading.value = false;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
vue.onMounted(() => {
|
|
57
|
+
void refresh().catch(() => void 0);
|
|
58
|
+
});
|
|
59
|
+
vue.watch(
|
|
60
|
+
() => vue.toValue(address$1),
|
|
61
|
+
() => {
|
|
62
|
+
void refresh().catch(() => void 0);
|
|
63
|
+
}
|
|
64
|
+
);
|
|
65
|
+
return {
|
|
66
|
+
accountInfo,
|
|
67
|
+
loading,
|
|
68
|
+
error,
|
|
69
|
+
refresh
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
function normalizeAccountInfo(account) {
|
|
73
|
+
return {
|
|
74
|
+
executable: account.executable,
|
|
75
|
+
lamports: Number(account.lamports),
|
|
76
|
+
owner: account.owner,
|
|
77
|
+
space: Number(account.space),
|
|
78
|
+
data: decodeBase64.decodeBase64(account.data[0])
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
exports.useAccountInfo = useAccountInfo;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const address = require('@vue-solana/core/address');
|
|
4
|
-
const errors = require('@vue-solana/core/errors');
|
|
5
3
|
const tokenAccounts = require('@vue-solana/core/token-accounts');
|
|
4
|
+
const errors = require('@vue-solana/core/errors');
|
|
5
|
+
const address = require('@vue-solana/core/address');
|
|
6
6
|
const vue = require('vue');
|
|
7
|
-
const useConnection = require('./vue.
|
|
8
|
-
const useSolana = require('./vue.
|
|
7
|
+
const useConnection = require('./vue.CZwftA0L.cjs');
|
|
8
|
+
const useSolana = require('./vue.BaR1VPhl.cjs');
|
|
9
9
|
|
|
10
10
|
function useTokenAccounts(owner, options) {
|
|
11
11
|
const solana = useSolana.tryUseSolana();
|
|
12
|
-
const
|
|
12
|
+
const client = solana?.client ?? useConnection.useConnection();
|
|
13
13
|
const tokenAccounts$1 = vue.shallowRef([]);
|
|
14
14
|
const loading = vue.shallowRef(false);
|
|
15
15
|
const error = vue.shallowRef(null);
|
|
@@ -26,17 +26,16 @@ function useTokenAccounts(owner, options) {
|
|
|
26
26
|
loading.value = true;
|
|
27
27
|
error.value = null;
|
|
28
28
|
try {
|
|
29
|
-
const
|
|
30
|
-
if (!
|
|
29
|
+
const parsedAddress = address.parseAddress(value);
|
|
30
|
+
if (!parsedAddress) {
|
|
31
31
|
tokenAccounts$1.value = [];
|
|
32
32
|
loading.value = false;
|
|
33
33
|
return [];
|
|
34
34
|
}
|
|
35
|
-
const
|
|
35
|
+
const nextAccounts = await tokenAccounts.getTokenAccountsByOwner(client, parsedAddress, {
|
|
36
36
|
commitment: options?.commitment,
|
|
37
37
|
programId: options?.programId
|
|
38
|
-
};
|
|
39
|
-
const nextAccounts = await tokenAccounts.getTokenAccountsByOwner(connection, publicKey, opts);
|
|
38
|
+
});
|
|
40
39
|
if (requestId === refreshId) {
|
|
41
40
|
tokenAccounts$1.value = nextAccounts;
|
|
42
41
|
}
|
|
@@ -18,7 +18,7 @@ function getSsrContext() {
|
|
|
18
18
|
cluster: "devnet",
|
|
19
19
|
endpoint: "",
|
|
20
20
|
wsEndpoint: "",
|
|
21
|
-
|
|
21
|
+
client: createUnavailableProxy(),
|
|
22
22
|
wallet: vue.shallowRef(null),
|
|
23
23
|
status: vue.ref("idle"),
|
|
24
24
|
error: vue.ref(null),
|
|
@@ -36,7 +36,7 @@ function getSsrContext() {
|
|
|
36
36
|
};
|
|
37
37
|
return ssrContext;
|
|
38
38
|
}
|
|
39
|
-
function
|
|
39
|
+
function createUnavailableProxy() {
|
|
40
40
|
return new Proxy(
|
|
41
41
|
{},
|
|
42
42
|
{
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import { parsePublicKey } from '@vue-solana/core/address';
|
|
2
1
|
import { normalizeSolanaError } from '@vue-solana/core/errors';
|
|
3
2
|
import { shallowRef, onMounted, onUnmounted, watch, toValue } from 'vue';
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
3
|
+
import { parseAddress } from '@vue-solana/core/address';
|
|
4
|
+
import { u as useConnection } from './vue.ChujsB0B.mjs';
|
|
5
|
+
import { t as tryUseSolana } from './vue.CnUlZSe8.mjs';
|
|
6
|
+
import { d as decodeBase64 } from './vue.Bfu1dCKe.mjs';
|
|
6
7
|
|
|
7
8
|
function useProgramAccounts(programId, options = {}) {
|
|
8
9
|
const solana = tryUseSolana();
|
|
9
|
-
const
|
|
10
|
+
const client = solana?.client ?? useConnection();
|
|
10
11
|
const accounts = shallowRef([]);
|
|
11
12
|
const loading = shallowRef(false);
|
|
12
13
|
const error = shallowRef(null);
|
|
@@ -23,16 +24,27 @@ function useProgramAccounts(programId, options = {}) {
|
|
|
23
24
|
loading.value = true;
|
|
24
25
|
error.value = null;
|
|
25
26
|
try {
|
|
26
|
-
const
|
|
27
|
-
if (!
|
|
27
|
+
const parsedAddress = parseAddress(value);
|
|
28
|
+
if (!parsedAddress) {
|
|
28
29
|
accounts.value = [];
|
|
29
30
|
return [];
|
|
30
31
|
}
|
|
31
|
-
const
|
|
32
|
+
const { value: response } = await client.rpc.getProgramAccounts(parsedAddress, {
|
|
33
|
+
encoding: "base64",
|
|
32
34
|
commitment: options.commitment,
|
|
33
35
|
dataSlice: options.dataSlice,
|
|
34
36
|
filters: options.filters
|
|
35
|
-
});
|
|
37
|
+
}).send();
|
|
38
|
+
const nextAccounts = response.map(({ pubkey, account }) => ({
|
|
39
|
+
pubkey,
|
|
40
|
+
account: {
|
|
41
|
+
executable: account.executable,
|
|
42
|
+
lamports: Number(account.lamports),
|
|
43
|
+
owner: account.owner,
|
|
44
|
+
space: Number(account.space),
|
|
45
|
+
data: decodeBase64(account.data[0])
|
|
46
|
+
}
|
|
47
|
+
}));
|
|
36
48
|
if (requestId === refreshId) {
|
|
37
49
|
accounts.value = nextAccounts;
|
|
38
50
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
function decodeBase64(value) {
|
|
2
|
+
const binary = atob(value);
|
|
3
|
+
const bytes = new Uint8Array(binary.length);
|
|
4
|
+
for (let index = 0; index < binary.length; index += 1) {
|
|
5
|
+
bytes[index] = binary.charCodeAt(index);
|
|
6
|
+
}
|
|
7
|
+
return bytes;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export { decodeBase64 as d };
|