@vue-solana/vue 1.0.0 → 1.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/dist/index.cjs +5 -0
- package/dist/index.d.cts +4 -0
- package/dist/index.d.mts +4 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.mjs +3 -0
- package/dist/shared/vue.BM8Qjk74.cjs +76 -0
- package/dist/shared/vue.BPuN7ieB.mjs +74 -0
- package/dist/shared/vue.DYCd9oyI.mjs +71 -0
- package/dist/shared/vue.Diugnf4a.cjs +73 -0
- package/dist/useTokenAccounts.cjs +14 -0
- package/dist/useTokenAccounts.d.cts +19 -0
- package/dist/useTokenAccounts.d.mts +19 -0
- package/dist/useTokenAccounts.d.ts +19 -0
- package/dist/useTokenAccounts.mjs +8 -0
- package/dist/useTokenBalance.cjs +14 -0
- package/dist/useTokenBalance.d.cts +15 -0
- package/dist/useTokenBalance.d.mts +15 -0
- package/dist/useTokenBalance.d.ts +15 -0
- package/dist/useTokenBalance.mjs +8 -0
- package/package.json +12 -2
package/dist/index.cjs
CHANGED
|
@@ -9,6 +9,8 @@ const useSignMessage = require('./shared/vue.Dp894nYb.cjs');
|
|
|
9
9
|
const useSignAndSendTransaction = require('./shared/vue.CMJANJ4a.cjs');
|
|
10
10
|
const useSignatureStatus = require('./shared/vue.CXNFQf3l.cjs');
|
|
11
11
|
const useSolana = require('./shared/vue.eNXmiI3a.cjs');
|
|
12
|
+
const useTokenAccounts = require('./shared/vue.Diugnf4a.cjs');
|
|
13
|
+
const useTokenBalance = require('./shared/vue.BM8Qjk74.cjs');
|
|
12
14
|
const useTransaction = require('./shared/vue.CE5i8KZZ.cjs');
|
|
13
15
|
const useTransactionConfirmation = require('./shared/vue.CZohWxBN.cjs');
|
|
14
16
|
const useWallet = require('./shared/vue.o-mWY2Yg.cjs');
|
|
@@ -23,6 +25,7 @@ require('@vue-solana/core/address');
|
|
|
23
25
|
require('@vue-solana/core/wallet');
|
|
24
26
|
require('@vue-solana/core/transaction');
|
|
25
27
|
require('bs58');
|
|
28
|
+
require('@vue-solana/core/token-accounts');
|
|
26
29
|
|
|
27
30
|
const SELECTED_WALLET_STORAGE_KEY = "vue-solana:selected-wallet";
|
|
28
31
|
function readSelectedWallet() {
|
|
@@ -369,6 +372,8 @@ exports.useSignatureStatus = useSignatureStatus.useSignatureStatus;
|
|
|
369
372
|
exports.solanaInjectionKey = useSolana.solanaInjectionKey;
|
|
370
373
|
exports.tryUseSolana = useSolana.tryUseSolana;
|
|
371
374
|
exports.useSolana = useSolana.useSolana;
|
|
375
|
+
exports.useTokenAccounts = useTokenAccounts.useTokenAccounts;
|
|
376
|
+
exports.useTokenBalance = useTokenBalance.useTokenBalance;
|
|
372
377
|
exports.useTransaction = useTransaction.useTransaction;
|
|
373
378
|
exports.getConfirmedTransactionStatus = useTransactionConfirmation.getConfirmedTransactionStatus;
|
|
374
379
|
exports.useTransactionConfirmation = useTransactionConfirmation.useTransactionConfirmation;
|
package/dist/index.d.cts
CHANGED
|
@@ -7,6 +7,8 @@ export { SignMessageStatus, useSignMessage } from './useSignMessage.cjs';
|
|
|
7
7
|
export { SignAndSendTransactionOptions, SignAndSendTransactionStatus, useSignAndSendTransaction } from './useSignAndSendTransaction.cjs';
|
|
8
8
|
export { UseSignatureStatusOptions, useSignatureStatus } from './useSignatureStatus.cjs';
|
|
9
9
|
export { tryUseSolana, useSolana } from './useSolana.cjs';
|
|
10
|
+
export { UseTokenAccountsOptions, useTokenAccounts } from './useTokenAccounts.cjs';
|
|
11
|
+
export { useTokenBalance } from './useTokenBalance.cjs';
|
|
10
12
|
export { UseTransactionOptions, useTransaction } from './useTransaction.cjs';
|
|
11
13
|
export { TransactionConfirmationStatus, getConfirmedTransactionStatus, useTransactionConfirmation } from './useTransactionConfirmation.cjs';
|
|
12
14
|
export { useWallet } from './useWallet.cjs';
|
|
@@ -20,6 +22,8 @@ import '@vue-solana/core/address';
|
|
|
20
22
|
import '@vue-solana/core/errors';
|
|
21
23
|
import '@vue-solana/core/web3';
|
|
22
24
|
import '@solana/web3-compat';
|
|
25
|
+
import '@vue-solana/core/spl-token';
|
|
26
|
+
import '@vue-solana/core/token-accounts';
|
|
23
27
|
|
|
24
28
|
interface VueSolanaPluginOptions extends SolanaConfig {
|
|
25
29
|
wallet?: SolanaWallet | null;
|
package/dist/index.d.mts
CHANGED
|
@@ -7,6 +7,8 @@ export { SignMessageStatus, useSignMessage } from './useSignMessage.mjs';
|
|
|
7
7
|
export { SignAndSendTransactionOptions, SignAndSendTransactionStatus, useSignAndSendTransaction } from './useSignAndSendTransaction.mjs';
|
|
8
8
|
export { UseSignatureStatusOptions, useSignatureStatus } from './useSignatureStatus.mjs';
|
|
9
9
|
export { tryUseSolana, useSolana } from './useSolana.mjs';
|
|
10
|
+
export { UseTokenAccountsOptions, useTokenAccounts } from './useTokenAccounts.mjs';
|
|
11
|
+
export { useTokenBalance } from './useTokenBalance.mjs';
|
|
10
12
|
export { UseTransactionOptions, useTransaction } from './useTransaction.mjs';
|
|
11
13
|
export { TransactionConfirmationStatus, getConfirmedTransactionStatus, useTransactionConfirmation } from './useTransactionConfirmation.mjs';
|
|
12
14
|
export { useWallet } from './useWallet.mjs';
|
|
@@ -20,6 +22,8 @@ import '@vue-solana/core/address';
|
|
|
20
22
|
import '@vue-solana/core/errors';
|
|
21
23
|
import '@vue-solana/core/web3';
|
|
22
24
|
import '@solana/web3-compat';
|
|
25
|
+
import '@vue-solana/core/spl-token';
|
|
26
|
+
import '@vue-solana/core/token-accounts';
|
|
23
27
|
|
|
24
28
|
interface VueSolanaPluginOptions extends SolanaConfig {
|
|
25
29
|
wallet?: SolanaWallet | null;
|
package/dist/index.d.ts
CHANGED
|
@@ -7,6 +7,8 @@ export { SignMessageStatus, useSignMessage } from './useSignMessage.js';
|
|
|
7
7
|
export { SignAndSendTransactionOptions, SignAndSendTransactionStatus, useSignAndSendTransaction } from './useSignAndSendTransaction.js';
|
|
8
8
|
export { UseSignatureStatusOptions, useSignatureStatus } from './useSignatureStatus.js';
|
|
9
9
|
export { tryUseSolana, useSolana } from './useSolana.js';
|
|
10
|
+
export { UseTokenAccountsOptions, useTokenAccounts } from './useTokenAccounts.js';
|
|
11
|
+
export { useTokenBalance } from './useTokenBalance.js';
|
|
10
12
|
export { UseTransactionOptions, useTransaction } from './useTransaction.js';
|
|
11
13
|
export { TransactionConfirmationStatus, getConfirmedTransactionStatus, useTransactionConfirmation } from './useTransactionConfirmation.js';
|
|
12
14
|
export { useWallet } from './useWallet.js';
|
|
@@ -20,6 +22,8 @@ import '@vue-solana/core/address';
|
|
|
20
22
|
import '@vue-solana/core/errors';
|
|
21
23
|
import '@vue-solana/core/web3';
|
|
22
24
|
import '@solana/web3-compat';
|
|
25
|
+
import '@vue-solana/core/spl-token';
|
|
26
|
+
import '@vue-solana/core/token-accounts';
|
|
23
27
|
|
|
24
28
|
interface VueSolanaPluginOptions extends SolanaConfig {
|
|
25
29
|
wallet?: SolanaWallet | null;
|
package/dist/index.mjs
CHANGED
|
@@ -8,6 +8,8 @@ export { u as useSignAndSendTransaction } from './shared/vue.BBNHeOeb.mjs';
|
|
|
8
8
|
export { u as useSignatureStatus } from './shared/vue.DZWyk9E_.mjs';
|
|
9
9
|
import { s as solanaInjectionKey } from './shared/vue.DCDTsSjf.mjs';
|
|
10
10
|
export { t as tryUseSolana, u as useSolana } from './shared/vue.DCDTsSjf.mjs';
|
|
11
|
+
export { u as useTokenAccounts } from './shared/vue.DYCd9oyI.mjs';
|
|
12
|
+
export { u as useTokenBalance } from './shared/vue.BPuN7ieB.mjs';
|
|
11
13
|
export { u as useTransaction } from './shared/vue.C4d2JA8U.mjs';
|
|
12
14
|
export { g as getConfirmedTransactionStatus, u as useTransactionConfirmation } from './shared/vue.DaoqgzJC.mjs';
|
|
13
15
|
export { u as useWallet } from './shared/vue.B7w1CC4R.mjs';
|
|
@@ -22,6 +24,7 @@ import '@vue-solana/core/address';
|
|
|
22
24
|
import '@vue-solana/core/wallet';
|
|
23
25
|
import '@vue-solana/core/transaction';
|
|
24
26
|
import 'bs58';
|
|
27
|
+
import '@vue-solana/core/token-accounts';
|
|
25
28
|
|
|
26
29
|
const SELECTED_WALLET_STORAGE_KEY = "vue-solana:selected-wallet";
|
|
27
30
|
function readSelectedWallet() {
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const address = require('@vue-solana/core/address');
|
|
4
|
+
const errors = require('@vue-solana/core/errors');
|
|
5
|
+
const tokenAccounts = require('@vue-solana/core/token-accounts');
|
|
6
|
+
const vue = require('vue');
|
|
7
|
+
const useConnection = require('./vue.Bii4W61L.cjs');
|
|
8
|
+
const useSolana = require('./vue.eNXmiI3a.cjs');
|
|
9
|
+
|
|
10
|
+
function useTokenBalance(mint, owner) {
|
|
11
|
+
const solana = useSolana.tryUseSolana();
|
|
12
|
+
const connection = solana?.connection ?? useConnection.useConnection();
|
|
13
|
+
const balance = vue.shallowRef(null);
|
|
14
|
+
const decimals = vue.shallowRef(null);
|
|
15
|
+
const loading = vue.shallowRef(false);
|
|
16
|
+
const error = vue.shallowRef(null);
|
|
17
|
+
let refreshId = 0;
|
|
18
|
+
async function refresh() {
|
|
19
|
+
const requestId = ++refreshId;
|
|
20
|
+
const mintValue = vue.toValue(mint);
|
|
21
|
+
const ownerValue = vue.toValue(owner);
|
|
22
|
+
if (!mintValue || !ownerValue || !solana) {
|
|
23
|
+
balance.value = null;
|
|
24
|
+
decimals.value = null;
|
|
25
|
+
loading.value = false;
|
|
26
|
+
error.value = null;
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
29
|
+
loading.value = true;
|
|
30
|
+
error.value = null;
|
|
31
|
+
try {
|
|
32
|
+
const mintKey = address.parsePublicKey(mintValue);
|
|
33
|
+
const ownerKey = address.parsePublicKey(ownerValue);
|
|
34
|
+
if (!mintKey || !ownerKey) {
|
|
35
|
+
balance.value = null;
|
|
36
|
+
decimals.value = null;
|
|
37
|
+
loading.value = false;
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
40
|
+
const nextBalance = await tokenAccounts.getTokenBalance(connection, mintKey, ownerKey);
|
|
41
|
+
if (requestId === refreshId) {
|
|
42
|
+
balance.value = nextBalance?.amount ?? null;
|
|
43
|
+
decimals.value = nextBalance?.decimals ?? null;
|
|
44
|
+
}
|
|
45
|
+
return nextBalance;
|
|
46
|
+
} catch (cause) {
|
|
47
|
+
const normalizedError = errors.normalizeSolanaError(cause, "RPC_FAILURE");
|
|
48
|
+
if (requestId === refreshId) {
|
|
49
|
+
error.value = normalizedError;
|
|
50
|
+
}
|
|
51
|
+
throw normalizedError;
|
|
52
|
+
} finally {
|
|
53
|
+
if (requestId === refreshId) {
|
|
54
|
+
loading.value = false;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
vue.onMounted(() => {
|
|
59
|
+
void refresh().catch(() => void 0);
|
|
60
|
+
});
|
|
61
|
+
vue.watch(
|
|
62
|
+
() => [vue.toValue(mint), vue.toValue(owner)],
|
|
63
|
+
() => {
|
|
64
|
+
void refresh().catch(() => void 0);
|
|
65
|
+
}
|
|
66
|
+
);
|
|
67
|
+
return {
|
|
68
|
+
balance,
|
|
69
|
+
decimals,
|
|
70
|
+
loading,
|
|
71
|
+
error,
|
|
72
|
+
refresh
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
exports.useTokenBalance = useTokenBalance;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { parsePublicKey } from '@vue-solana/core/address';
|
|
2
|
+
import { normalizeSolanaError } from '@vue-solana/core/errors';
|
|
3
|
+
import { getTokenBalance } from '@vue-solana/core/token-accounts';
|
|
4
|
+
import { shallowRef, onMounted, watch, toValue } from 'vue';
|
|
5
|
+
import { u as useConnection } from './vue.CKx4lRew.mjs';
|
|
6
|
+
import { t as tryUseSolana } from './vue.DCDTsSjf.mjs';
|
|
7
|
+
|
|
8
|
+
function useTokenBalance(mint, owner) {
|
|
9
|
+
const solana = tryUseSolana();
|
|
10
|
+
const connection = solana?.connection ?? useConnection();
|
|
11
|
+
const balance = shallowRef(null);
|
|
12
|
+
const decimals = shallowRef(null);
|
|
13
|
+
const loading = shallowRef(false);
|
|
14
|
+
const error = shallowRef(null);
|
|
15
|
+
let refreshId = 0;
|
|
16
|
+
async function refresh() {
|
|
17
|
+
const requestId = ++refreshId;
|
|
18
|
+
const mintValue = toValue(mint);
|
|
19
|
+
const ownerValue = toValue(owner);
|
|
20
|
+
if (!mintValue || !ownerValue || !solana) {
|
|
21
|
+
balance.value = null;
|
|
22
|
+
decimals.value = null;
|
|
23
|
+
loading.value = false;
|
|
24
|
+
error.value = null;
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
loading.value = true;
|
|
28
|
+
error.value = null;
|
|
29
|
+
try {
|
|
30
|
+
const mintKey = parsePublicKey(mintValue);
|
|
31
|
+
const ownerKey = parsePublicKey(ownerValue);
|
|
32
|
+
if (!mintKey || !ownerKey) {
|
|
33
|
+
balance.value = null;
|
|
34
|
+
decimals.value = null;
|
|
35
|
+
loading.value = false;
|
|
36
|
+
return null;
|
|
37
|
+
}
|
|
38
|
+
const nextBalance = await getTokenBalance(connection, mintKey, ownerKey);
|
|
39
|
+
if (requestId === refreshId) {
|
|
40
|
+
balance.value = nextBalance?.amount ?? null;
|
|
41
|
+
decimals.value = nextBalance?.decimals ?? null;
|
|
42
|
+
}
|
|
43
|
+
return nextBalance;
|
|
44
|
+
} catch (cause) {
|
|
45
|
+
const normalizedError = normalizeSolanaError(cause, "RPC_FAILURE");
|
|
46
|
+
if (requestId === refreshId) {
|
|
47
|
+
error.value = normalizedError;
|
|
48
|
+
}
|
|
49
|
+
throw normalizedError;
|
|
50
|
+
} finally {
|
|
51
|
+
if (requestId === refreshId) {
|
|
52
|
+
loading.value = false;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
onMounted(() => {
|
|
57
|
+
void refresh().catch(() => void 0);
|
|
58
|
+
});
|
|
59
|
+
watch(
|
|
60
|
+
() => [toValue(mint), toValue(owner)],
|
|
61
|
+
() => {
|
|
62
|
+
void refresh().catch(() => void 0);
|
|
63
|
+
}
|
|
64
|
+
);
|
|
65
|
+
return {
|
|
66
|
+
balance,
|
|
67
|
+
decimals,
|
|
68
|
+
loading,
|
|
69
|
+
error,
|
|
70
|
+
refresh
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export { useTokenBalance as u };
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { parsePublicKey } from '@vue-solana/core/address';
|
|
2
|
+
import { normalizeSolanaError } from '@vue-solana/core/errors';
|
|
3
|
+
import { getTokenAccountsByOwner } from '@vue-solana/core/token-accounts';
|
|
4
|
+
import { shallowRef, onMounted, watch, toValue } from 'vue';
|
|
5
|
+
import { u as useConnection } from './vue.CKx4lRew.mjs';
|
|
6
|
+
import { t as tryUseSolana } from './vue.DCDTsSjf.mjs';
|
|
7
|
+
|
|
8
|
+
function useTokenAccounts(owner, options) {
|
|
9
|
+
const solana = tryUseSolana();
|
|
10
|
+
const connection = solana?.connection ?? useConnection();
|
|
11
|
+
const tokenAccounts = shallowRef([]);
|
|
12
|
+
const loading = shallowRef(false);
|
|
13
|
+
const error = shallowRef(null);
|
|
14
|
+
let refreshId = 0;
|
|
15
|
+
async function refresh() {
|
|
16
|
+
const requestId = ++refreshId;
|
|
17
|
+
const value = toValue(owner);
|
|
18
|
+
if (!value || !solana) {
|
|
19
|
+
tokenAccounts.value = [];
|
|
20
|
+
loading.value = false;
|
|
21
|
+
error.value = null;
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
loading.value = true;
|
|
25
|
+
error.value = null;
|
|
26
|
+
try {
|
|
27
|
+
const publicKey = parsePublicKey(value);
|
|
28
|
+
if (!publicKey) {
|
|
29
|
+
tokenAccounts.value = [];
|
|
30
|
+
loading.value = false;
|
|
31
|
+
return [];
|
|
32
|
+
}
|
|
33
|
+
const opts = {
|
|
34
|
+
commitment: options?.commitment,
|
|
35
|
+
programId: options?.programId
|
|
36
|
+
};
|
|
37
|
+
const nextAccounts = await getTokenAccountsByOwner(connection, publicKey, opts);
|
|
38
|
+
if (requestId === refreshId) {
|
|
39
|
+
tokenAccounts.value = nextAccounts;
|
|
40
|
+
}
|
|
41
|
+
return nextAccounts;
|
|
42
|
+
} catch (cause) {
|
|
43
|
+
const normalizedError = normalizeSolanaError(cause, "RPC_FAILURE");
|
|
44
|
+
if (requestId === refreshId) {
|
|
45
|
+
error.value = normalizedError;
|
|
46
|
+
}
|
|
47
|
+
throw normalizedError;
|
|
48
|
+
} finally {
|
|
49
|
+
if (requestId === refreshId) {
|
|
50
|
+
loading.value = false;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
onMounted(() => {
|
|
55
|
+
void refresh().catch(() => void 0);
|
|
56
|
+
});
|
|
57
|
+
watch(
|
|
58
|
+
() => toValue(owner),
|
|
59
|
+
() => {
|
|
60
|
+
void refresh().catch(() => void 0);
|
|
61
|
+
}
|
|
62
|
+
);
|
|
63
|
+
return {
|
|
64
|
+
tokenAccounts,
|
|
65
|
+
loading,
|
|
66
|
+
error,
|
|
67
|
+
refresh
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export { useTokenAccounts as u };
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const address = require('@vue-solana/core/address');
|
|
4
|
+
const errors = require('@vue-solana/core/errors');
|
|
5
|
+
const tokenAccounts = require('@vue-solana/core/token-accounts');
|
|
6
|
+
const vue = require('vue');
|
|
7
|
+
const useConnection = require('./vue.Bii4W61L.cjs');
|
|
8
|
+
const useSolana = require('./vue.eNXmiI3a.cjs');
|
|
9
|
+
|
|
10
|
+
function useTokenAccounts(owner, options) {
|
|
11
|
+
const solana = useSolana.tryUseSolana();
|
|
12
|
+
const connection = solana?.connection ?? useConnection.useConnection();
|
|
13
|
+
const tokenAccounts$1 = vue.shallowRef([]);
|
|
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(owner);
|
|
20
|
+
if (!value || !solana) {
|
|
21
|
+
tokenAccounts$1.value = [];
|
|
22
|
+
loading.value = false;
|
|
23
|
+
error.value = null;
|
|
24
|
+
return null;
|
|
25
|
+
}
|
|
26
|
+
loading.value = true;
|
|
27
|
+
error.value = null;
|
|
28
|
+
try {
|
|
29
|
+
const publicKey = address.parsePublicKey(value);
|
|
30
|
+
if (!publicKey) {
|
|
31
|
+
tokenAccounts$1.value = [];
|
|
32
|
+
loading.value = false;
|
|
33
|
+
return [];
|
|
34
|
+
}
|
|
35
|
+
const opts = {
|
|
36
|
+
commitment: options?.commitment,
|
|
37
|
+
programId: options?.programId
|
|
38
|
+
};
|
|
39
|
+
const nextAccounts = await tokenAccounts.getTokenAccountsByOwner(connection, publicKey, opts);
|
|
40
|
+
if (requestId === refreshId) {
|
|
41
|
+
tokenAccounts$1.value = nextAccounts;
|
|
42
|
+
}
|
|
43
|
+
return nextAccounts;
|
|
44
|
+
} catch (cause) {
|
|
45
|
+
const normalizedError = errors.normalizeSolanaError(cause, "RPC_FAILURE");
|
|
46
|
+
if (requestId === refreshId) {
|
|
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(owner),
|
|
61
|
+
() => {
|
|
62
|
+
void refresh().catch(() => void 0);
|
|
63
|
+
}
|
|
64
|
+
);
|
|
65
|
+
return {
|
|
66
|
+
tokenAccounts: tokenAccounts$1,
|
|
67
|
+
loading,
|
|
68
|
+
error,
|
|
69
|
+
refresh
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
exports.useTokenAccounts = useTokenAccounts;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const useTokenAccounts = require('./shared/vue.Diugnf4a.cjs');
|
|
4
|
+
require('@vue-solana/core/address');
|
|
5
|
+
require('@vue-solana/core/errors');
|
|
6
|
+
require('@vue-solana/core/token-accounts');
|
|
7
|
+
require('vue');
|
|
8
|
+
require('./shared/vue.Bii4W61L.cjs');
|
|
9
|
+
require('./shared/vue.C5C3l0RQ.cjs');
|
|
10
|
+
require('./shared/vue.eNXmiI3a.cjs');
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
exports.useTokenAccounts = useTokenAccounts.useTokenAccounts;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import * as vue from 'vue';
|
|
2
|
+
import { MaybeRefOrGetter } from 'vue';
|
|
3
|
+
import { Commitment, PublicKey } from '@vue-solana/core/web3';
|
|
4
|
+
import { TokenAccount } from '@vue-solana/core/spl-token';
|
|
5
|
+
import { SolanaError } from '@vue-solana/core/errors';
|
|
6
|
+
|
|
7
|
+
interface UseTokenAccountsOptions {
|
|
8
|
+
commitment?: Commitment;
|
|
9
|
+
programId?: PublicKey;
|
|
10
|
+
}
|
|
11
|
+
declare function useTokenAccounts(owner: MaybeRefOrGetter<PublicKey | string | null | undefined>, options?: UseTokenAccountsOptions): {
|
|
12
|
+
tokenAccounts: vue.ShallowRef<TokenAccount[], TokenAccount[]>;
|
|
13
|
+
loading: vue.ShallowRef<boolean, boolean>;
|
|
14
|
+
error: vue.ShallowRef<SolanaError | null, SolanaError | null>;
|
|
15
|
+
refresh: () => Promise<TokenAccount[] | null>;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export { useTokenAccounts };
|
|
19
|
+
export type { UseTokenAccountsOptions };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import * as vue from 'vue';
|
|
2
|
+
import { MaybeRefOrGetter } from 'vue';
|
|
3
|
+
import { Commitment, PublicKey } from '@vue-solana/core/web3';
|
|
4
|
+
import { TokenAccount } from '@vue-solana/core/spl-token';
|
|
5
|
+
import { SolanaError } from '@vue-solana/core/errors';
|
|
6
|
+
|
|
7
|
+
interface UseTokenAccountsOptions {
|
|
8
|
+
commitment?: Commitment;
|
|
9
|
+
programId?: PublicKey;
|
|
10
|
+
}
|
|
11
|
+
declare function useTokenAccounts(owner: MaybeRefOrGetter<PublicKey | string | null | undefined>, options?: UseTokenAccountsOptions): {
|
|
12
|
+
tokenAccounts: vue.ShallowRef<TokenAccount[], TokenAccount[]>;
|
|
13
|
+
loading: vue.ShallowRef<boolean, boolean>;
|
|
14
|
+
error: vue.ShallowRef<SolanaError | null, SolanaError | null>;
|
|
15
|
+
refresh: () => Promise<TokenAccount[] | null>;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export { useTokenAccounts };
|
|
19
|
+
export type { UseTokenAccountsOptions };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import * as vue from 'vue';
|
|
2
|
+
import { MaybeRefOrGetter } from 'vue';
|
|
3
|
+
import { Commitment, PublicKey } from '@vue-solana/core/web3';
|
|
4
|
+
import { TokenAccount } from '@vue-solana/core/spl-token';
|
|
5
|
+
import { SolanaError } from '@vue-solana/core/errors';
|
|
6
|
+
|
|
7
|
+
interface UseTokenAccountsOptions {
|
|
8
|
+
commitment?: Commitment;
|
|
9
|
+
programId?: PublicKey;
|
|
10
|
+
}
|
|
11
|
+
declare function useTokenAccounts(owner: MaybeRefOrGetter<PublicKey | string | null | undefined>, options?: UseTokenAccountsOptions): {
|
|
12
|
+
tokenAccounts: vue.ShallowRef<TokenAccount[], TokenAccount[]>;
|
|
13
|
+
loading: vue.ShallowRef<boolean, boolean>;
|
|
14
|
+
error: vue.ShallowRef<SolanaError | null, SolanaError | null>;
|
|
15
|
+
refresh: () => Promise<TokenAccount[] | null>;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export { useTokenAccounts };
|
|
19
|
+
export type { UseTokenAccountsOptions };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { u as useTokenAccounts } from './shared/vue.DYCd9oyI.mjs';
|
|
2
|
+
import '@vue-solana/core/address';
|
|
3
|
+
import '@vue-solana/core/errors';
|
|
4
|
+
import '@vue-solana/core/token-accounts';
|
|
5
|
+
import 'vue';
|
|
6
|
+
import './shared/vue.CKx4lRew.mjs';
|
|
7
|
+
import './shared/vue.ChnRkpDR.mjs';
|
|
8
|
+
import './shared/vue.DCDTsSjf.mjs';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const useTokenBalance = require('./shared/vue.BM8Qjk74.cjs');
|
|
4
|
+
require('@vue-solana/core/address');
|
|
5
|
+
require('@vue-solana/core/errors');
|
|
6
|
+
require('@vue-solana/core/token-accounts');
|
|
7
|
+
require('vue');
|
|
8
|
+
require('./shared/vue.Bii4W61L.cjs');
|
|
9
|
+
require('./shared/vue.C5C3l0RQ.cjs');
|
|
10
|
+
require('./shared/vue.eNXmiI3a.cjs');
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
exports.useTokenBalance = useTokenBalance.useTokenBalance;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as _vue_solana_core_token_accounts from '@vue-solana/core/token-accounts';
|
|
2
|
+
import * as vue from 'vue';
|
|
3
|
+
import { MaybeRefOrGetter } from 'vue';
|
|
4
|
+
import { PublicKey } from '@vue-solana/core/web3';
|
|
5
|
+
import { SolanaError } from '@vue-solana/core/errors';
|
|
6
|
+
|
|
7
|
+
declare function useTokenBalance(mint: MaybeRefOrGetter<PublicKey | string | null | undefined>, owner: MaybeRefOrGetter<PublicKey | string | null | undefined>): {
|
|
8
|
+
balance: vue.ShallowRef<bigint | null, bigint | null>;
|
|
9
|
+
decimals: vue.ShallowRef<number | null, number | null>;
|
|
10
|
+
loading: vue.ShallowRef<boolean, boolean>;
|
|
11
|
+
error: vue.ShallowRef<SolanaError | null, SolanaError | null>;
|
|
12
|
+
refresh: () => Promise<_vue_solana_core_token_accounts.TokenBalanceResult | null>;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export { useTokenBalance };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as _vue_solana_core_token_accounts from '@vue-solana/core/token-accounts';
|
|
2
|
+
import * as vue from 'vue';
|
|
3
|
+
import { MaybeRefOrGetter } from 'vue';
|
|
4
|
+
import { PublicKey } from '@vue-solana/core/web3';
|
|
5
|
+
import { SolanaError } from '@vue-solana/core/errors';
|
|
6
|
+
|
|
7
|
+
declare function useTokenBalance(mint: MaybeRefOrGetter<PublicKey | string | null | undefined>, owner: MaybeRefOrGetter<PublicKey | string | null | undefined>): {
|
|
8
|
+
balance: vue.ShallowRef<bigint | null, bigint | null>;
|
|
9
|
+
decimals: vue.ShallowRef<number | null, number | null>;
|
|
10
|
+
loading: vue.ShallowRef<boolean, boolean>;
|
|
11
|
+
error: vue.ShallowRef<SolanaError | null, SolanaError | null>;
|
|
12
|
+
refresh: () => Promise<_vue_solana_core_token_accounts.TokenBalanceResult | null>;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export { useTokenBalance };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as _vue_solana_core_token_accounts from '@vue-solana/core/token-accounts';
|
|
2
|
+
import * as vue from 'vue';
|
|
3
|
+
import { MaybeRefOrGetter } from 'vue';
|
|
4
|
+
import { PublicKey } from '@vue-solana/core/web3';
|
|
5
|
+
import { SolanaError } from '@vue-solana/core/errors';
|
|
6
|
+
|
|
7
|
+
declare function useTokenBalance(mint: MaybeRefOrGetter<PublicKey | string | null | undefined>, owner: MaybeRefOrGetter<PublicKey | string | null | undefined>): {
|
|
8
|
+
balance: vue.ShallowRef<bigint | null, bigint | null>;
|
|
9
|
+
decimals: vue.ShallowRef<number | null, number | null>;
|
|
10
|
+
loading: vue.ShallowRef<boolean, boolean>;
|
|
11
|
+
error: vue.ShallowRef<SolanaError | null, SolanaError | null>;
|
|
12
|
+
refresh: () => Promise<_vue_solana_core_token_accounts.TokenBalanceResult | null>;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export { useTokenBalance };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { u as useTokenBalance } from './shared/vue.BPuN7ieB.mjs';
|
|
2
|
+
import '@vue-solana/core/address';
|
|
3
|
+
import '@vue-solana/core/errors';
|
|
4
|
+
import '@vue-solana/core/token-accounts';
|
|
5
|
+
import 'vue';
|
|
6
|
+
import './shared/vue.CKx4lRew.mjs';
|
|
7
|
+
import './shared/vue.ChnRkpDR.mjs';
|
|
8
|
+
import './shared/vue.DCDTsSjf.mjs';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vue-solana/vue",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "Vue plugin and composables for Solana applications.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"keywords": [
|
|
@@ -100,6 +100,16 @@
|
|
|
100
100
|
"import": "./dist/useSignAndSendTransaction.mjs",
|
|
101
101
|
"require": "./dist/useSignAndSendTransaction.cjs"
|
|
102
102
|
},
|
|
103
|
+
"./useTokenBalance": {
|
|
104
|
+
"types": "./dist/useTokenBalance.d.ts",
|
|
105
|
+
"import": "./dist/useTokenBalance.mjs",
|
|
106
|
+
"require": "./dist/useTokenBalance.cjs"
|
|
107
|
+
},
|
|
108
|
+
"./useTokenAccounts": {
|
|
109
|
+
"types": "./dist/useTokenAccounts.d.ts",
|
|
110
|
+
"import": "./dist/useTokenAccounts.mjs",
|
|
111
|
+
"require": "./dist/useTokenAccounts.cjs"
|
|
112
|
+
},
|
|
103
113
|
"./web3": {
|
|
104
114
|
"types": "./dist/web3.d.ts",
|
|
105
115
|
"import": "./dist/web3.mjs",
|
|
@@ -115,7 +125,7 @@
|
|
|
115
125
|
"dependencies": {
|
|
116
126
|
"@solana/web3-compat": "^0.0.21",
|
|
117
127
|
"bs58": "^6.0.0",
|
|
118
|
-
"@vue-solana/core": "1.
|
|
128
|
+
"@vue-solana/core": "1.1.0"
|
|
119
129
|
},
|
|
120
130
|
"peerDependencies": {
|
|
121
131
|
"vue": "^3.5.0"
|