@helium/helium-react-hooks 0.2.21 → 0.2.22-next.33
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/package.json +8 -8
- package/lib/cjs/hooks/useAnchorAccount.js +0 -21
- package/lib/cjs/hooks/useAnchorAccount.js.map +0 -1
- package/lib/cjs/hooks/useAnchorAccounts.js +0 -37
- package/lib/cjs/hooks/useAnchorAccounts.js.map +0 -1
- package/lib/cjs/hooks/useAnchorProvider.js +0 -19
- package/lib/cjs/hooks/useAnchorProvider.js.map +0 -1
- package/lib/cjs/hooks/useAssociatedTokenAccount.js +0 -33
- package/lib/cjs/hooks/useAssociatedTokenAccount.js.map +0 -1
- package/lib/cjs/hooks/useAssociatedTokenAddress.js +0 -29
- package/lib/cjs/hooks/useAssociatedTokenAddress.js.map +0 -1
- package/lib/cjs/hooks/useIdl.js +0 -42
- package/lib/cjs/hooks/useIdl.js.map +0 -1
- package/lib/cjs/hooks/useIdlAccount.js +0 -32
- package/lib/cjs/hooks/useIdlAccount.js.map +0 -1
- package/lib/cjs/hooks/useIdlAccounts.js +0 -33
- package/lib/cjs/hooks/useIdlAccounts.js.map +0 -1
- package/lib/cjs/hooks/useInterval.js +0 -20
- package/lib/cjs/hooks/useInterval.js.map +0 -1
- package/lib/cjs/hooks/useMint.js +0 -15
- package/lib/cjs/hooks/useMint.js.map +0 -1
- package/lib/cjs/hooks/useOwnedAmount.js +0 -28
- package/lib/cjs/hooks/useOwnedAmount.js.map +0 -1
- package/lib/cjs/hooks/useSolOwnedAmount.js +0 -14
- package/lib/cjs/hooks/useSolOwnedAmount.js.map +0 -1
- package/lib/cjs/hooks/useSolanaUnixNow.js +0 -42
- package/lib/cjs/hooks/useSolanaUnixNow.js.map +0 -1
- package/lib/cjs/hooks/useTokenAccount.js +0 -13
- package/lib/cjs/hooks/useTokenAccount.js.map +0 -1
- package/lib/cjs/index.js +0 -31
- package/lib/cjs/index.js.map +0 -1
- package/lib/esm/src/hooks/useAnchorAccount.js +0 -20
- package/lib/esm/src/hooks/useAnchorAccount.js.map +0 -1
- package/lib/esm/src/hooks/useAnchorAccounts.js +0 -24
- package/lib/esm/src/hooks/useAnchorAccounts.js.map +0 -1
- package/lib/esm/src/hooks/useAnchorProvider.js +0 -15
- package/lib/esm/src/hooks/useAnchorProvider.js.map +0 -1
- package/lib/esm/src/hooks/useAssociatedTokenAccount.js +0 -29
- package/lib/esm/src/hooks/useAssociatedTokenAccount.js.map +0 -1
- package/lib/esm/src/hooks/useAssociatedTokenAddress.js +0 -16
- package/lib/esm/src/hooks/useAssociatedTokenAddress.js.map +0 -1
- package/lib/esm/src/hooks/useIdl.js +0 -42
- package/lib/esm/src/hooks/useIdl.js.map +0 -1
- package/lib/esm/src/hooks/useIdlAccount.js +0 -28
- package/lib/esm/src/hooks/useIdlAccount.js.map +0 -1
- package/lib/esm/src/hooks/useIdlAccounts.js +0 -28
- package/lib/esm/src/hooks/useIdlAccounts.js.map +0 -1
- package/lib/esm/src/hooks/useInterval.js +0 -16
- package/lib/esm/src/hooks/useInterval.js.map +0 -1
- package/lib/esm/src/hooks/useMint.js +0 -10
- package/lib/esm/src/hooks/useMint.js.map +0 -1
- package/lib/esm/src/hooks/useOwnedAmount.js +0 -24
- package/lib/esm/src/hooks/useOwnedAmount.js.map +0 -1
- package/lib/esm/src/hooks/useSolOwnedAmount.js +0 -10
- package/lib/esm/src/hooks/useSolOwnedAmount.js.map +0 -1
- package/lib/esm/src/hooks/useSolanaUnixNow.js +0 -29
- package/lib/esm/src/hooks/useSolanaUnixNow.js.map +0 -1
- package/lib/esm/src/hooks/useTokenAccount.js +0 -9
- package/lib/esm/src/hooks/useTokenAccount.js.map +0 -1
- package/lib/esm/src/index.js +0 -14
- package/lib/esm/src/index.js.map +0 -1
- package/lib/esm/tsconfig.esm.tsbuildinfo +0 -1
- package/lib/types/src/hooks/useAnchorAccount.d.ts +0 -8
- package/lib/types/src/hooks/useAnchorAccount.d.ts.map +0 -1
- package/lib/types/src/hooks/useAnchorAccounts.d.ts +0 -8
- package/lib/types/src/hooks/useAnchorAccounts.d.ts.map +0 -1
- package/lib/types/src/hooks/useAnchorProvider.d.ts +0 -3
- package/lib/types/src/hooks/useAnchorProvider.d.ts.map +0 -1
- package/lib/types/src/hooks/useAssociatedTokenAccount.d.ts +0 -16
- package/lib/types/src/hooks/useAssociatedTokenAccount.d.ts.map +0 -1
- package/lib/types/src/hooks/useAssociatedTokenAddress.d.ts +0 -8
- package/lib/types/src/hooks/useAssociatedTokenAddress.d.ts.map +0 -1
- package/lib/types/src/hooks/useIdl.d.ts +0 -7
- package/lib/types/src/hooks/useIdl.d.ts.map +0 -1
- package/lib/types/src/hooks/useIdlAccount.d.ts +0 -6
- package/lib/types/src/hooks/useIdlAccount.d.ts.map +0 -1
- package/lib/types/src/hooks/useIdlAccounts.d.ts +0 -7
- package/lib/types/src/hooks/useIdlAccounts.d.ts.map +0 -1
- package/lib/types/src/hooks/useInterval.d.ts +0 -2
- package/lib/types/src/hooks/useInterval.d.ts.map +0 -1
- package/lib/types/src/hooks/useMint.d.ts +0 -6
- package/lib/types/src/hooks/useMint.d.ts.map +0 -1
- package/lib/types/src/hooks/useOwnedAmount.d.ts +0 -7
- package/lib/types/src/hooks/useOwnedAmount.d.ts.map +0 -1
- package/lib/types/src/hooks/useSolOwnedAmount.d.ts +0 -6
- package/lib/types/src/hooks/useSolOwnedAmount.d.ts.map +0 -1
- package/lib/types/src/hooks/useSolanaUnixNow.d.ts +0 -2
- package/lib/types/src/hooks/useSolanaUnixNow.d.ts.map +0 -1
- package/lib/types/src/hooks/useTokenAccount.d.ts +0 -5
- package/lib/types/src/hooks/useTokenAccount.d.ts.map +0 -1
- package/lib/types/src/index.d.ts +0 -14
- package/lib/types/src/index.d.ts.map +0 -1
package/package.json
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
7
7
|
},
|
|
8
8
|
"license": "Apache-2.0",
|
|
9
|
-
"version": "0.2.
|
|
9
|
+
"version": "0.2.22-next.33+2a1e1998",
|
|
10
10
|
"description": "React hooks for helium",
|
|
11
11
|
"repository": {
|
|
12
12
|
"type": "git",
|
|
@@ -33,11 +33,11 @@
|
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@coral-xyz/anchor": "^0.26.0",
|
|
36
|
-
"@helium/account-fetch-cache": "^0.2.
|
|
37
|
-
"@helium/account-fetch-cache-hooks": "^0.2.
|
|
38
|
-
"@solana/spl-token": "^0.3.
|
|
39
|
-
"@solana/web3.js": "^1.
|
|
40
|
-
"bs58": "^
|
|
36
|
+
"@helium/account-fetch-cache": "^0.2.22-next.33+2a1e1998",
|
|
37
|
+
"@helium/account-fetch-cache-hooks": "^0.2.22-next.33+2a1e1998",
|
|
38
|
+
"@solana/spl-token": "^0.3.8",
|
|
39
|
+
"@solana/web3.js": "^1.78.4",
|
|
40
|
+
"bs58": "^4.0.1",
|
|
41
41
|
"pako": "^2.0.3",
|
|
42
42
|
"react-async-hook": "^4.0.0"
|
|
43
43
|
},
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"@solana/wallet-adapter-react": "^0.15.32",
|
|
46
46
|
"git-format-staged": "^2.1.3",
|
|
47
47
|
"ts-loader": "^9.2.3",
|
|
48
|
-
"typescript": "^4.
|
|
48
|
+
"typescript": "^4.8.4",
|
|
49
49
|
"yarn": "^1.22.18"
|
|
50
50
|
},
|
|
51
51
|
"peerDependencies": {
|
|
@@ -55,5 +55,5 @@
|
|
|
55
55
|
},
|
|
56
56
|
"keywords": [],
|
|
57
57
|
"author": "",
|
|
58
|
-
"gitHead": "
|
|
58
|
+
"gitHead": "2a1e19980d74c21b5f51834540421b3c8a0a045e"
|
|
59
59
|
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useAnchorAccount = void 0;
|
|
4
|
-
const account_fetch_cache_hooks_1 = require("@helium/account-fetch-cache-hooks");
|
|
5
|
-
const useIdl_1 = require("./useIdl");
|
|
6
|
-
const useIdlAccount_1 = require("./useIdlAccount");
|
|
7
|
-
const react_1 = require("react");
|
|
8
|
-
function useAnchorAccount(key, type,
|
|
9
|
-
// Perf optimization - set if the account will never change, to lower websocket usage.
|
|
10
|
-
isStatic = false) {
|
|
11
|
-
const { account: rawAccount } = (0, account_fetch_cache_hooks_1.useAccount)(key);
|
|
12
|
-
const { info: idl, error, loading } = (0, useIdl_1.useIdl)(rawAccount === null || rawAccount === void 0 ? void 0 : rawAccount.owner);
|
|
13
|
-
(0, react_1.useEffect)(() => {
|
|
14
|
-
if (!loading && rawAccount && !idl) {
|
|
15
|
-
console.warn(`Idl not found for ${rawAccount.owner.toBase58()}`);
|
|
16
|
-
}
|
|
17
|
-
}, [idl, loading, rawAccount]);
|
|
18
|
-
return Object.assign(Object.assign({}, (0, useIdlAccount_1.useIdlAccount)(key, idl, type, isStatic)), { error });
|
|
19
|
-
}
|
|
20
|
-
exports.useAnchorAccount = useAnchorAccount;
|
|
21
|
-
//# sourceMappingURL=useAnchorAccount.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useAnchorAccount.js","sourceRoot":"","sources":["../../../src/hooks/useAnchorAccount.ts"],"names":[],"mappings":";;;AAEA,iFAAgF;AAEhF,qCAAkC;AAClC,mDAAgD;AAChD,iCAAkC;AAElC,SAAgB,gBAAgB,CAC9B,GAA0B,EAC1B,IAAO;AACP,sFAAsF;AACtF,WAAoB,KAAK;IAIzB,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,GAAG,IAAA,sCAAU,EAAC,GAAG,CAAC,CAAC;IAChD,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,IAAA,eAAM,EAAM,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,KAAK,CAAC,CAAC;IACrE,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,IAAI,CAAC,OAAO,IAAI,UAAU,IAAI,CAAC,GAAG,EAAE;YAClC,OAAO,CAAC,IAAI,CAAC,qBAAqB,UAAU,CAAC,KAAK,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;SAClE;IACH,CAAC,EAAE,CAAC,GAAG,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC,CAAC;IAE/B,uCACK,IAAA,6BAAa,EAAC,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,QAAQ,CAAC,KAC1C,KAAK,IACL;AACJ,CAAC;AApBD,4CAoBC"}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
-
var t = {};
|
|
4
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
-
t[p] = s[p];
|
|
6
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
-
t[p[i]] = s[p[i]];
|
|
10
|
-
}
|
|
11
|
-
return t;
|
|
12
|
-
};
|
|
13
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
-
exports.useAnchorAccounts = void 0;
|
|
15
|
-
const account_fetch_cache_hooks_1 = require("@helium/account-fetch-cache-hooks");
|
|
16
|
-
const useIdl_1 = require("./useIdl");
|
|
17
|
-
const useIdlAccounts_1 = require("./useIdlAccounts");
|
|
18
|
-
const react_1 = require("react");
|
|
19
|
-
function useAnchorAccounts(keys, type,
|
|
20
|
-
// Perf optimization - set if the account will never change, to lower websocket usage.
|
|
21
|
-
isStatic = false) {
|
|
22
|
-
const { accounts: rawAccounts } = (0, account_fetch_cache_hooks_1.useAccounts)(keys);
|
|
23
|
-
const owner = (0, react_1.useMemo)(() => {
|
|
24
|
-
var _a, _b;
|
|
25
|
-
return (_b = (_a = rawAccounts === null || rawAccounts === void 0 ? void 0 : rawAccounts.find((a) => a.account)) === null || _a === void 0 ? void 0 : _a.account) === null || _b === void 0 ? void 0 : _b.owner;
|
|
26
|
-
}, [rawAccounts]);
|
|
27
|
-
const { info: idl, error, loading } = (0, useIdl_1.useIdl)(owner);
|
|
28
|
-
(0, react_1.useEffect)(() => {
|
|
29
|
-
if (!loading && owner && !idl) {
|
|
30
|
-
console.warn(`Idl not found for ${owner.toBase58()}`);
|
|
31
|
-
}
|
|
32
|
-
}, [idl, loading, owner]);
|
|
33
|
-
const _a = (0, useIdlAccounts_1.useIdlAccounts)(keys, idl, type, isStatic), { error: useAccErr } = _a, result = __rest(_a, ["error"]);
|
|
34
|
-
return Object.assign(Object.assign({}, result), { error: error || useAccErr });
|
|
35
|
-
}
|
|
36
|
-
exports.useAnchorAccounts = useAnchorAccounts;
|
|
37
|
-
//# sourceMappingURL=useAnchorAccounts.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useAnchorAccounts.js","sourceRoot":"","sources":["../../../src/hooks/useAnchorAccounts.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAEA,iFAG2C;AAE3C,qCAAkC;AAClC,qDAAkD;AAClD,iCAA2C;AAE3C,SAAgB,iBAAiB,CAI/B,IAA6B,EAC7B,IAAO;AACP,sFAAsF;AACtF,WAAoB,KAAK;IAIzB,MAAM,EAAE,QAAQ,EAAE,WAAW,EAAE,GAAG,IAAA,uCAAW,EAAC,IAAI,CAAC,CAAC;IACpD,MAAM,KAAK,GAAG,IAAA,eAAO,EAAC,GAAG,EAAE;;QACzB,OAAO,MAAA,MAAA,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,0CAAE,OAAO,0CAAE,KAAK,CAAC;IAC7D,CAAC,EAAE,CAAC,WAAW,CAAC,CAAC,CAAC;IAClB,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,IAAA,eAAM,EAAM,KAAK,CAAC,CAAC;IACzD,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,IAAI,CAAC,OAAO,IAAI,KAAK,IAAI,CAAC,GAAG,EAAE;YAC7B,OAAO,CAAC,IAAI,CAAC,qBAAqB,KAAK,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;SACvD;IACH,CAAC,EAAE,CAAC,GAAG,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC;IAE1B,MAAM,KAAkC,IAAA,+BAAc,EACpD,IAAI,EACJ,GAAG,EACH,IAAI,EACJ,QAAQ,CACT,EALK,EAAE,KAAK,EAAE,SAAS,OAKvB,EAL4B,MAAM,cAA7B,SAA+B,CAKpC,CAAC;IACF,uCACK,MAAM,KACT,KAAK,EAAE,KAAK,IAAI,SAAS,IACzB;AACJ,CAAC;AAhCD,8CAgCC"}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useAnchorProvider = void 0;
|
|
4
|
-
const anchor_1 = require("@coral-xyz/anchor");
|
|
5
|
-
const wallet_adapter_react_1 = require("@solana/wallet-adapter-react");
|
|
6
|
-
const react_1 = require("react");
|
|
7
|
-
function useAnchorProvider() {
|
|
8
|
-
const { connection } = (0, wallet_adapter_react_1.useConnection)();
|
|
9
|
-
const { wallet } = (0, wallet_adapter_react_1.useWallet)();
|
|
10
|
-
return (0, react_1.useMemo)(() => {
|
|
11
|
-
if (wallet && connection) {
|
|
12
|
-
return new anchor_1.AnchorProvider(connection, wallet.adapter, {
|
|
13
|
-
commitment: "confirmed",
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
}, [connection, wallet]);
|
|
17
|
-
}
|
|
18
|
-
exports.useAnchorProvider = useAnchorProvider;
|
|
19
|
-
//# sourceMappingURL=useAnchorProvider.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useAnchorProvider.js","sourceRoot":"","sources":["../../../src/hooks/useAnchorProvider.ts"],"names":[],"mappings":";;;AAAA,8CAAmD;AACnD,uEAAwE;AACxE,iCAAgC;AAGhC,SAAgB,iBAAiB;IAC/B,MAAM,EAAE,UAAU,EAAE,GAAG,IAAA,oCAAa,GAAE,CAAC;IACvC,MAAM,EAAE,MAAM,EAAE,GAAG,IAAA,gCAAS,GAAE,CAAC;IAC/B,OAAO,IAAA,eAAO,EAAC,GAAG,EAAE;QAClB,IAAI,MAAM,IAAI,UAAU,EAAE;YACxB,OAAO,IAAI,uBAAc,CAAC,UAAU,EAAE,MAAM,CAAC,OAAc,EAAE;gBAC3D,UAAU,EAAE,WAAW;aACxB,CAAC,CAAC;SACJ;IACH,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC,CAAC;AAC3B,CAAC;AAVD,8CAUC"}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useAssociatedTokenAccount = void 0;
|
|
4
|
-
const react_1 = require("react");
|
|
5
|
-
const useAssociatedTokenAddress_1 = require("./useAssociatedTokenAddress");
|
|
6
|
-
const useTokenAccount_1 = require("./useTokenAccount");
|
|
7
|
-
/**
|
|
8
|
-
* Get the associcated token account for this wallet, or the account itself is this address is already an ata
|
|
9
|
-
*
|
|
10
|
-
* @param walletOrAta
|
|
11
|
-
* @param mint
|
|
12
|
-
* @returns
|
|
13
|
-
*/
|
|
14
|
-
function useAssociatedTokenAccount(walletOrAta, mint) {
|
|
15
|
-
const { result: associatedTokenAddress, loading: loading } = (0, useAssociatedTokenAddress_1.useAssociatedTokenAddress)(walletOrAta, mint);
|
|
16
|
-
const { info: associatedAccount, loading: loading2 } = (0, useTokenAccount_1.useTokenAccount)(associatedTokenAddress);
|
|
17
|
-
const result = (0, react_1.useMemo)(() => {
|
|
18
|
-
if ((associatedAccount === null || associatedAccount === void 0 ? void 0 : associatedAccount.mint) === mint) {
|
|
19
|
-
// The passed value is the ata
|
|
20
|
-
return associatedAccount;
|
|
21
|
-
}
|
|
22
|
-
else {
|
|
23
|
-
return associatedAccount;
|
|
24
|
-
}
|
|
25
|
-
}, [associatedAccount, associatedAccount, mint]);
|
|
26
|
-
return {
|
|
27
|
-
associatedAccount: result,
|
|
28
|
-
loading: loading || loading2,
|
|
29
|
-
associatedAccountKey: associatedTokenAddress,
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
exports.useAssociatedTokenAccount = useAssociatedTokenAccount;
|
|
33
|
-
//# sourceMappingURL=useAssociatedTokenAccount.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useAssociatedTokenAccount.js","sourceRoot":"","sources":["../../../src/hooks/useAssociatedTokenAccount.ts"],"names":[],"mappings":";;;AAEA,iCAAgC;AAChC,2EAAwE;AACxE,uDAAoD;AAQpD;;;;;;GAMG;AACH,SAAgB,yBAAyB,CACvC,WAAyC,EACzC,IAAkC;IAElC,MAAM,EAAE,MAAM,EAAE,sBAAsB,EAAE,OAAO,EAAE,OAAO,EAAE,GACxD,IAAA,qDAAyB,EAAC,WAAW,EAAE,IAAI,CAAC,CAAC;IAC/C,MAAM,EAAE,IAAI,EAAE,iBAAiB,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,IAAA,iCAAe,EACpE,sBAAsB,CACvB,CAAC;IAEF,MAAM,MAAM,GAAG,IAAA,eAAO,EAAC,GAAG,EAAE;QAC1B,IAAI,CAAA,iBAAiB,aAAjB,iBAAiB,uBAAjB,iBAAiB,CAAE,IAAI,MAAK,IAAI,EAAE;YACpC,8BAA8B;YAC9B,OAAO,iBAAiB,CAAC;SAC1B;aAAM;YACL,OAAO,iBAAiB,CAAC;SAC1B;IACH,CAAC,EAAE,CAAC,iBAAiB,EAAE,iBAAiB,EAAE,IAAI,CAAC,CAAC,CAAC;IAEjD,OAAO;QACL,iBAAiB,EAAE,MAAM;QACzB,OAAO,EAAE,OAAO,IAAI,QAAQ;QAC5B,oBAAoB,EAAE,sBAAsB;KAC7C,CAAC;AACJ,CAAC;AAxBD,8DAwBC"}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.useAssociatedTokenAddress = void 0;
|
|
13
|
-
const spl_token_1 = require("@solana/spl-token");
|
|
14
|
-
const react_async_hook_1 = require("react-async-hook");
|
|
15
|
-
const fetch = (wallet, mint) => __awaiter(void 0, void 0, void 0, function* () {
|
|
16
|
-
if (!wallet || !mint) {
|
|
17
|
-
return undefined;
|
|
18
|
-
}
|
|
19
|
-
const associatedTokenAddress = yield (0, spl_token_1.getAssociatedTokenAddress)(mint, wallet, true);
|
|
20
|
-
return associatedTokenAddress;
|
|
21
|
-
});
|
|
22
|
-
function useAssociatedTokenAddress(wallet, mint) {
|
|
23
|
-
const { result, loading } = (0, react_async_hook_1.useAsync)(() => __awaiter(this, void 0, void 0, function* () {
|
|
24
|
-
return fetch(wallet, mint);
|
|
25
|
-
}), [mint === null || mint === void 0 ? void 0 : mint.toBase58(), wallet === null || wallet === void 0 ? void 0 : wallet.toBase58()]);
|
|
26
|
-
return { result, loading };
|
|
27
|
-
}
|
|
28
|
-
exports.useAssociatedTokenAddress = useAssociatedTokenAddress;
|
|
29
|
-
//# sourceMappingURL=useAssociatedTokenAddress.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useAssociatedTokenAddress.js","sourceRoot":"","sources":["../../../src/hooks/useAssociatedTokenAddress.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,iDAE2B;AAE3B,uDAA4C;AAM5C,MAAM,KAAK,GAAG,CACZ,MAAoC,EACpC,IAAkC,EACF,EAAE;IAClC,IAAI,CAAC,MAAM,IAAI,CAAC,IAAI,EAAE;QACpB,OAAO,SAAS,CAAC;KAClB;IAED,MAAM,sBAAsB,GAAG,MAAM,IAAA,qCAAyB,EAC5D,IAAI,EACJ,MAAM,EACN,IAAI,CACL,CAAA;IACD,OAAO,sBAAsB,CAAA;AAC/B,CAAC,CAAA,CAAC;AAEF,SAAgB,yBAAyB,CACvC,MAAoC,EACpC,IAAkC;IAElC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,IAAA,2BAAQ,EAAC,GAAS,EAAE;QAC9C,OAAO,KAAK,CAAC,MAAM,EAAE,IAAI,CAAC,CAAA;IAC5B,CAAC,CAAA,EAAE,CAAC,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,QAAQ,EAAE,EAAE,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,QAAQ,EAAE,CAAC,CAAC,CAAA;IAE1C,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC;AAC7B,CAAC;AATD,8DASC"}
|
package/lib/cjs/hooks/useIdl.js
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useIdl = void 0;
|
|
4
|
-
const idl_1 = require("@coral-xyz/anchor/dist/cjs/idl");
|
|
5
|
-
const bytes_1 = require("@coral-xyz/anchor/dist/cjs/utils/bytes");
|
|
6
|
-
const account_fetch_cache_hooks_1 = require("@helium/account-fetch-cache-hooks");
|
|
7
|
-
const sha256_1 = require("@noble/hashes/sha256");
|
|
8
|
-
const web3_js_1 = require("@solana/web3.js");
|
|
9
|
-
const pako_1 = require("pako");
|
|
10
|
-
const react_1 = require("react");
|
|
11
|
-
function useIdl(programId) {
|
|
12
|
-
const [idlError, setIdlError] = (0, react_1.useState)();
|
|
13
|
-
const idlKey = (0, react_1.useMemo)(() => {
|
|
14
|
-
if (programId) {
|
|
15
|
-
const base = web3_js_1.PublicKey.findProgramAddressSync([], programId)[0];
|
|
16
|
-
const buffer = Buffer.concat([
|
|
17
|
-
base.toBuffer(),
|
|
18
|
-
Buffer.from("anchor:idl"),
|
|
19
|
-
programId.toBuffer(),
|
|
20
|
-
]);
|
|
21
|
-
const publicKeyBytes = (0, sha256_1.sha256)(buffer);
|
|
22
|
-
return new web3_js_1.PublicKey(publicKeyBytes);
|
|
23
|
-
}
|
|
24
|
-
}, [programId === null || programId === void 0 ? void 0 : programId.toBase58()]);
|
|
25
|
-
const idlParser = (0, react_1.useMemo)(() => {
|
|
26
|
-
return (_, data) => {
|
|
27
|
-
try {
|
|
28
|
-
const idlData = (0, idl_1.decodeIdlAccount)(Buffer.from(data.data.subarray(8)));
|
|
29
|
-
const inflatedIdl = (0, pako_1.inflate)(idlData.data);
|
|
30
|
-
return JSON.parse(bytes_1.utf8.decode(inflatedIdl));
|
|
31
|
-
}
|
|
32
|
-
catch (e) {
|
|
33
|
-
console.error(e);
|
|
34
|
-
setIdlError(e);
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
}, []);
|
|
38
|
-
const result = (0, account_fetch_cache_hooks_1.useAccount)(idlKey, idlParser);
|
|
39
|
-
return Object.assign(Object.assign({}, result), { loading: result.loading, error: idlError });
|
|
40
|
-
}
|
|
41
|
-
exports.useIdl = useIdl;
|
|
42
|
-
//# sourceMappingURL=useIdl.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useIdl.js","sourceRoot":"","sources":["../../../src/hooks/useIdl.ts"],"names":[],"mappings":";;;AACA,wDAAkE;AAClE,kEAA8D;AAE9D,iFAAgF;AAChF,iDAA8C;AAC9C,6CAA4C;AAC5C,+BAA+B;AAC/B,iCAA0C;AAE1C,SAAgB,MAAM,CACpB,SAAgC;IAEhC,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,IAAA,gBAAQ,GAAqB,CAAC;IAC9D,MAAM,MAAM,GAAG,IAAA,eAAO,EAAC,GAAG,EAAE;QAC1B,IAAI,SAAS,EAAE;YACb,MAAM,IAAI,GAAG,mBAAS,CAAC,sBAAsB,CAAC,EAAE,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;YAChE,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;gBAC3B,IAAI,CAAC,QAAQ,EAAE;gBACf,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC;gBACzB,SAAS,CAAC,QAAQ,EAAE;aACrB,CAAC,CAAC;YACH,MAAM,cAAc,GAAG,IAAA,eAAM,EAAC,MAAM,CAAC,CAAC;YACtC,OAAO,IAAI,mBAAS,CAAC,cAAc,CAAC,CAAC;SACtC;IACH,CAAC,EAAE,CAAC,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,QAAQ,EAAE,CAAC,CAAC,CAAC;IAC5B,MAAM,SAAS,GAA4B,IAAA,eAAO,EAAC,GAAG,EAAE;QACtD,OAAO,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE;YACjB,IAAI;gBACF,MAAM,OAAO,GAAG,IAAA,sBAAgB,EAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;gBACrE,MAAM,WAAW,GAAG,IAAA,cAAO,EAAC,OAAO,CAAC,IAAI,CAAC,CAAC;gBAC1C,OAAO,IAAI,CAAC,KAAK,CAAC,YAAI,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC;aAC7C;YAAC,OAAO,CAAM,EAAE;gBACf,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;gBACjB,WAAW,CAAC,CAAC,CAAC,CAAC;aAChB;QACH,CAAC,CAAC;IACJ,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,MAAM,MAAM,GAAG,IAAA,sCAAU,EAAC,MAAM,EAAE,SAAS,CAAC,CAAC;IAC7C,uCACK,MAAM,KACT,OAAO,EAAE,MAAM,CAAC,OAAO,EACvB,KAAK,EAAE,QAAQ,IACf;AACJ,CAAC;AAnCD,wBAmCC"}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useIdlAccount = void 0;
|
|
4
|
-
const anchor_1 = require("@coral-xyz/anchor");
|
|
5
|
-
const account_fetch_cache_hooks_1 = require("@helium/account-fetch-cache-hooks");
|
|
6
|
-
const react_1 = require("react");
|
|
7
|
-
const useIdlAccounts_1 = require("./useIdlAccounts");
|
|
8
|
-
function useIdlAccount(key, idl, type,
|
|
9
|
-
// Perf optimization - set if the account will never change, to lower websocket usage.
|
|
10
|
-
isStatic = false) {
|
|
11
|
-
const parser = (0, react_1.useMemo)(() => {
|
|
12
|
-
if (idl) {
|
|
13
|
-
const coder = new anchor_1.BorshAccountsCoder(idl);
|
|
14
|
-
const tpe = (0, useIdlAccounts_1.capitalizeFirstChar)(type);
|
|
15
|
-
return (pubkey, data) => {
|
|
16
|
-
try {
|
|
17
|
-
if (data.data.length === 0)
|
|
18
|
-
return;
|
|
19
|
-
const decoded = coder.decode(tpe, data.data);
|
|
20
|
-
decoded.pubkey = pubkey;
|
|
21
|
-
return decoded;
|
|
22
|
-
}
|
|
23
|
-
catch (e) {
|
|
24
|
-
console.error(e);
|
|
25
|
-
}
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
}, [idl, type]);
|
|
29
|
-
return (0, account_fetch_cache_hooks_1.useAccount)(key, parser, isStatic);
|
|
30
|
-
}
|
|
31
|
-
exports.useIdlAccount = useIdlAccount;
|
|
32
|
-
//# sourceMappingURL=useIdlAccount.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useIdlAccount.js","sourceRoot":"","sources":["../../../src/hooks/useIdlAccount.ts"],"names":[],"mappings":";;;AAAA,8CAAyE;AAGzE,iFAAgF;AAEhF,iCAAgC;AAChC,qDAAuD;AAEvD,SAAgB,aAAa,CAC3B,GAA0B,EAC1B,GAAoB,EACpB,IAAO;AACP,sFAAsF;AACtF,WAAoB,KAAK;IAEzB,MAAM,MAAM,GAEI,IAAA,eAAO,EAAC,GAAG,EAAE;QAC3B,IAAI,GAAG,EAAE;YACP,MAAM,KAAK,GAAG,IAAI,2BAAkB,CAAC,GAAG,CAAC,CAAC;YAC1C,MAAM,GAAG,GAAG,IAAA,oCAAmB,EAAC,IAAI,CAAC,CAAC;YACtC,OAAO,CAAC,MAAM,EAAE,IAAI,EAAE,EAAE;gBACtB,IAAI;oBACF,IAAI,IAAI,CAAC,IAAI,CAAC,MAAM,KAAK,CAAC;wBAAE,OAAO;oBACnC,MAAM,OAAO,GAAG,KAAK,CAAC,MAAM,CAAC,GAAG,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;oBAC7C,OAAO,CAAC,MAAM,GAAG,MAAM,CAAC;oBACxB,OAAO,OAAO,CAAC;iBAChB;gBAAC,OAAO,CAAM,EAAE;oBACf,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;iBAClB;YACH,CAAC,CAAC;SACH;IACH,CAAC,EAAE,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC,CAAC;IAChB,OAAO,IAAA,sCAAU,EAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC;AAC3C,CAAC;AA1BD,sCA0BC"}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useIdlAccounts = exports.capitalizeFirstChar = void 0;
|
|
4
|
-
const anchor_1 = require("@coral-xyz/anchor");
|
|
5
|
-
const account_fetch_cache_hooks_1 = require("@helium/account-fetch-cache-hooks");
|
|
6
|
-
const react_1 = require("react");
|
|
7
|
-
const capitalizeFirstChar = (str) => str.charAt(0).toUpperCase() + str.substring(1);
|
|
8
|
-
exports.capitalizeFirstChar = capitalizeFirstChar;
|
|
9
|
-
function useIdlAccounts(keys, idl, type,
|
|
10
|
-
// Perf optimization - set if the account will never change, to lower websocket usage.
|
|
11
|
-
isStatic = false) {
|
|
12
|
-
const parser = (0, react_1.useMemo)(() => {
|
|
13
|
-
if (idl) {
|
|
14
|
-
const coder = new anchor_1.BorshAccountsCoder(idl);
|
|
15
|
-
const tpe = (0, exports.capitalizeFirstChar)(type);
|
|
16
|
-
return (pubkey, data) => {
|
|
17
|
-
try {
|
|
18
|
-
if (data.data.length === 0)
|
|
19
|
-
return;
|
|
20
|
-
const decoded = coder.decode(tpe, data.data);
|
|
21
|
-
decoded.pubkey = pubkey;
|
|
22
|
-
return decoded;
|
|
23
|
-
}
|
|
24
|
-
catch (e) {
|
|
25
|
-
console.error(e);
|
|
26
|
-
}
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
}, [idl, type]);
|
|
30
|
-
return (0, account_fetch_cache_hooks_1.useAccounts)(keys, parser, isStatic);
|
|
31
|
-
}
|
|
32
|
-
exports.useIdlAccounts = useIdlAccounts;
|
|
33
|
-
//# sourceMappingURL=useIdlAccounts.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useIdlAccounts.js","sourceRoot":"","sources":["../../../src/hooks/useIdlAccounts.ts"],"names":[],"mappings":";;;AAAA,8CAAyE;AAGzE,iFAG2C;AAE3C,iCAAgC;AAEzB,MAAM,mBAAmB,GAAG,CAAC,GAAG,EAAE,EAAE,CACzC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;AADpC,QAAA,mBAAmB,uBACiB;AAEjD,SAAgB,cAAc,CAC5B,IAA6B,EAC7B,GAAoB,EACpB,IAAO;AACP,sFAAsF;AACtF,WAAoB,KAAK;IAEzB,MAAM,MAAM,GACV,IAAA,eAAO,EAAC,GAAG,EAAE;QACX,IAAI,GAAG,EAAE;YACP,MAAM,KAAK,GAAG,IAAI,2BAAkB,CAAC,GAAG,CAAC,CAAC;YAC1C,MAAM,GAAG,GAAG,IAAA,2BAAmB,EAAC,IAAI,CAAC,CAAC;YACtC,OAAO,CAAC,MAAM,EAAE,IAAI,EAAE,EAAE;gBACtB,IAAI;oBACF,IAAI,IAAI,CAAC,IAAI,CAAC,MAAM,KAAK,CAAC;wBAAE,OAAO;oBACnC,MAAM,OAAO,GAAG,KAAK,CAAC,MAAM,CAAC,GAAG,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;oBAC7C,OAAO,CAAC,MAAM,GAAG,MAAM,CAAC;oBACxB,OAAO,OAAO,CAAC;iBAChB;gBAAC,OAAO,CAAM,EAAE;oBACf,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;iBAClB;YACH,CAAC,CAAC;SACH;IACH,CAAC,EAAE,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC,CAAC;IAClB,OAAO,IAAA,uCAAW,EAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC;AAC7C,CAAC;AAzBD,wCAyBC"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useInterval = void 0;
|
|
4
|
-
const react_1 = require("react");
|
|
5
|
-
function useInterval(callback, delay, deps = []) {
|
|
6
|
-
const savedCallbackRef = (0, react_1.useRef)();
|
|
7
|
-
(0, react_1.useEffect)(() => {
|
|
8
|
-
savedCallbackRef.current = callback;
|
|
9
|
-
}, [callback]);
|
|
10
|
-
(0, react_1.useEffect)(() => {
|
|
11
|
-
const handler = (...args) => savedCallbackRef.current(...args);
|
|
12
|
-
if (delay !== null) {
|
|
13
|
-
handler();
|
|
14
|
-
const intervalId = setInterval(handler, delay);
|
|
15
|
-
return () => clearInterval(intervalId);
|
|
16
|
-
}
|
|
17
|
-
}, [delay, ...deps]);
|
|
18
|
-
}
|
|
19
|
-
exports.useInterval = useInterval;
|
|
20
|
-
//# sourceMappingURL=useInterval.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useInterval.js","sourceRoot":"","sources":["../../../src/hooks/useInterval.ts"],"names":[],"mappings":";;;AAAA,iCAA0C;AAE1C,SAAgB,WAAW,CACzB,QAAkC,EAClC,KAAoB,EACpB,OAAc,EAAE;IAEhB,MAAM,gBAAgB,GAAG,IAAA,cAAM,GAA4B,CAAC;IAE5D,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,gBAAgB,CAAC,OAAO,GAAG,QAAQ,CAAC;IACtC,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC;IAEf,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,MAAM,OAAO,GAAG,CAAC,GAAG,IAAW,EAAE,EAAE,CAAC,gBAAgB,CAAC,OAAQ,CAAC,GAAG,IAAI,CAAC,CAAC;QAEvE,IAAI,KAAK,KAAK,IAAI,EAAE;YAClB,OAAO,EAAE,CAAC;YACV,MAAM,UAAU,GAAG,WAAW,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;YAC/C,OAAO,GAAG,EAAE,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;SACxC;IACH,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,IAAI,CAAC,CAAC,CAAC;AACvB,CAAC;AApBD,kCAoBC"}
|
package/lib/cjs/hooks/useMint.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useMint = exports.MintParser = void 0;
|
|
4
|
-
const account_fetch_cache_hooks_1 = require("@helium/account-fetch-cache-hooks");
|
|
5
|
-
const spl_token_1 = require("@solana/spl-token");
|
|
6
|
-
const MintParser = (pubKey, info) => {
|
|
7
|
-
const data = (0, spl_token_1.unpackMint)(pubKey, info);
|
|
8
|
-
return data;
|
|
9
|
-
};
|
|
10
|
-
exports.MintParser = MintParser;
|
|
11
|
-
function useMint(key) {
|
|
12
|
-
return (0, account_fetch_cache_hooks_1.useAccount)(key, exports.MintParser);
|
|
13
|
-
}
|
|
14
|
-
exports.useMint = useMint;
|
|
15
|
-
//# sourceMappingURL=useMint.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useMint.js","sourceRoot":"","sources":["../../../src/hooks/useMint.ts"],"names":[],"mappings":";;;AAAA,iFAAgF;AAChF,iDAAqD;AAG9C,MAAM,UAAU,GAAG,CAAC,MAAiB,EAAE,IAAyB,EAAE,EAAE;IACzE,MAAM,IAAI,GAAG,IAAA,sBAAU,EAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IAEtC,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AAJW,QAAA,UAAU,cAIrB;AAEF,SAAgB,OAAO,CAAC,GAAiC;IACvD,OAAO,IAAA,sCAAU,EAAC,GAAG,EAAE,kBAAU,CAAC,CAAC;AACrC,CAAC;AAFD,0BAEC"}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useOwnedAmount = void 0;
|
|
4
|
-
const spl_token_1 = require("@solana/spl-token");
|
|
5
|
-
const react_1 = require("react");
|
|
6
|
-
const useAssociatedTokenAccount_1 = require("./useAssociatedTokenAccount");
|
|
7
|
-
const useMint_1 = require("./useMint");
|
|
8
|
-
const useSolOwnedAmount_1 = require("./useSolOwnedAmount");
|
|
9
|
-
function useOwnedAmount(wallet, mint) {
|
|
10
|
-
const { amount: solOwnedAmount } = (0, useSolOwnedAmount_1.useSolOwnedAmount)(wallet || undefined);
|
|
11
|
-
const { associatedAccount, loading: loadingAssoc } = (0, useAssociatedTokenAccount_1.useAssociatedTokenAccount)(wallet, mint);
|
|
12
|
-
const { info: mintAcc, loading: loadingMint } = (0, useMint_1.useMint)(mint);
|
|
13
|
-
const amount = (0, react_1.useMemo)(() => {
|
|
14
|
-
if (mint === null || mint === void 0 ? void 0 : mint.equals(spl_token_1.NATIVE_MINT)) {
|
|
15
|
-
return solOwnedAmount;
|
|
16
|
-
}
|
|
17
|
-
else if (associatedAccount) {
|
|
18
|
-
return associatedAccount.amount;
|
|
19
|
-
}
|
|
20
|
-
}, [solOwnedAmount, associatedAccount === null || associatedAccount === void 0 ? void 0 : associatedAccount.amount]);
|
|
21
|
-
return {
|
|
22
|
-
loading: loadingAssoc || loadingMint,
|
|
23
|
-
amount,
|
|
24
|
-
decimals: mintAcc === null || mintAcc === void 0 ? void 0 : mintAcc.decimals,
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
exports.useOwnedAmount = useOwnedAmount;
|
|
28
|
-
//# sourceMappingURL=useOwnedAmount.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useOwnedAmount.js","sourceRoot":"","sources":["../../../src/hooks/useOwnedAmount.ts"],"names":[],"mappings":";;;AAAA,iDAAgD;AAEhD,iCAAgC;AAChC,2EAAwE;AACxE,uCAAoC;AACpC,2DAAwD;AAExD,SAAgB,cAAc,CAC5B,MAAoC,EACpC,IAAkC;IAElC,MAAM,EAAE,MAAM,EAAE,cAAc,EAAE,GAAG,IAAA,qCAAiB,EAAC,MAAM,IAAI,SAAS,CAAC,CAAC;IAC1E,MAAM,EAAE,iBAAiB,EAAE,OAAO,EAAE,YAAY,EAAE,GAChD,IAAA,qDAAyB,EAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IAC1C,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,GAAG,IAAA,iBAAO,EAAC,IAAI,CAAC,CAAC;IAE9D,MAAM,MAAM,GAAG,IAAA,eAAO,EAAC,GAAG,EAAE;QAC1B,IAAI,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,MAAM,CAAC,uBAAW,CAAC,EAAE;YAC7B,OAAO,cAAc,CAAA;SACtB;aAAM,IAAI,iBAAiB,EAAE;YAC5B,OAAO,iBAAiB,CAAC,MAAM,CAAA;SAChC;IACH,CAAC,EAAE,CAAC,cAAc,EAAE,iBAAiB,aAAjB,iBAAiB,uBAAjB,iBAAiB,CAAE,MAAM,CAAC,CAAC,CAAC;IAChD,OAAO;QACL,OAAO,EAAE,YAAY,IAAI,WAAW;QACpC,MAAM;QACN,QAAQ,EAAE,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,QAAQ;KAC5B,CAAC;AACJ,CAAC;AArBD,wCAqBC"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useSolOwnedAmount = void 0;
|
|
4
|
-
const account_fetch_cache_hooks_1 = require("@helium/account-fetch-cache-hooks");
|
|
5
|
-
const parser = (_, account) => BigInt(account.lamports);
|
|
6
|
-
function useSolOwnedAmount(ownerPublicKey) {
|
|
7
|
-
const { info: lamports, loading } = (0, account_fetch_cache_hooks_1.useAccount)(ownerPublicKey, parser);
|
|
8
|
-
return {
|
|
9
|
-
amount: lamports,
|
|
10
|
-
loading,
|
|
11
|
-
};
|
|
12
|
-
}
|
|
13
|
-
exports.useSolOwnedAmount = useSolOwnedAmount;
|
|
14
|
-
//# sourceMappingURL=useSolOwnedAmount.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useSolOwnedAmount.js","sourceRoot":"","sources":["../../../src/hooks/useSolOwnedAmount.ts"],"names":[],"mappings":";;;AAAA,iFAA+D;AAG/D,MAAM,MAAM,GAAG,CAAC,CAAY,EAAE,OAA4B,EAAE,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;AACxF,SAAgB,iBAAiB,CAAC,cAA0B;IAI1D,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,IAAA,sCAAU,EAC5C,cAAc,EACd,MAAM,CACP,CAAC;IAEF,OAAO;QACL,MAAM,EAAE,QAAQ;QAChB,OAAO;KACR,CAAC;AACJ,CAAC;AAbD,8CAaC"}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.useSolanaUnixNow = void 0;
|
|
13
|
-
const react_1 = require("react");
|
|
14
|
-
const web3_js_1 = require("@solana/web3.js");
|
|
15
|
-
const react_async_hook_1 = require("react-async-hook");
|
|
16
|
-
const wallet_adapter_react_1 = require("@solana/wallet-adapter-react");
|
|
17
|
-
const useSolanaUnixNow = (refreshInterval = 10000) => {
|
|
18
|
-
const { connection } = (0, wallet_adapter_react_1.useConnection)();
|
|
19
|
-
const connectionWithoutCache = (0, react_1.useMemo)(() => {
|
|
20
|
-
if (connection) {
|
|
21
|
-
return new web3_js_1.Connection(connection.rpcEndpoint);
|
|
22
|
-
}
|
|
23
|
-
}, [connection === null || connection === void 0 ? void 0 : connection.rpcEndpoint]);
|
|
24
|
-
const [refresh, setRefresh] = (0, react_1.useState)(0);
|
|
25
|
-
const { result: unixTs } = (0, react_async_hook_1.useAsync)((connectionWithoutCache, _) => __awaiter(void 0, void 0, void 0, function* () {
|
|
26
|
-
if (connectionWithoutCache) {
|
|
27
|
-
const clock = yield connectionWithoutCache.getAccountInfo(web3_js_1.SYSVAR_CLOCK_PUBKEY);
|
|
28
|
-
return Number(clock.data.readBigInt64LE(8 * 4));
|
|
29
|
-
}
|
|
30
|
-
}), [connectionWithoutCache, refresh]);
|
|
31
|
-
(0, react_1.useEffect)(() => {
|
|
32
|
-
const interval = setInterval(() => {
|
|
33
|
-
setRefresh((prev) => prev + 1);
|
|
34
|
-
}, refreshInterval);
|
|
35
|
-
return () => {
|
|
36
|
-
clearInterval(interval);
|
|
37
|
-
};
|
|
38
|
-
}, []);
|
|
39
|
-
return unixTs;
|
|
40
|
-
};
|
|
41
|
-
exports.useSolanaUnixNow = useSolanaUnixNow;
|
|
42
|
-
//# sourceMappingURL=useSolanaUnixNow.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useSolanaUnixNow.js","sourceRoot":"","sources":["../../../src/hooks/useSolanaUnixNow.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,iCAAqD;AACrD,6CAAkE;AAClE,uDAA4C;AAC5C,uEAA6D;AAEtD,MAAM,gBAAgB,GAAG,CAAC,kBAA0B,KAAK,EAAsB,EAAE;IACtF,MAAM,EAAE,UAAU,EAAE,GAAG,IAAA,oCAAa,GAAE,CAAC;IACvC,MAAM,sBAAsB,GAAG,IAAA,eAAO,EAAC,GAAG,EAAE;QAC1C,IAAI,UAAU,EAAE;YACd,OAAO,IAAI,oBAAU,CAAC,UAAU,CAAC,WAAW,CAAC,CAAA;SAC9C;IACH,CAAC,EAAE,CAAC,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,WAAW,CAAC,CAAC,CAAA;IAC7B,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,IAAA,gBAAQ,EAAC,CAAC,CAAC,CAAC;IAE1C,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,IAAA,2BAAQ,EACjC,CAAO,sBAA8C,EAAE,CAAS,EAAE,EAAE;QAClE,IAAI,sBAAsB,EAAE;YAC1B,MAAM,KAAK,GAAG,MAAM,sBAAsB,CAAC,cAAc,CACvD,6BAAmB,CACpB,CAAC;YACF,OAAO,MAAM,CAAC,KAAM,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;SAClD;IACH,CAAC,CAAA,EACD,CAAC,sBAAsB,EAAE,OAAO,CAAC,CAClC,CAAC;IAEF,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,MAAM,QAAQ,GAAG,WAAW,CAAC,GAAG,EAAE;YAChC,UAAU,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC;QACjC,CAAC,EAAE,eAAe,CAAC,CAAA;QAEnB,OAAO,GAAG,EAAE;YACV,aAAa,CAAC,QAAQ,CAAC,CAAC;QAC1B,CAAC,CAAA;IACH,CAAC,EAAE,EAAE,CAAC,CAAA;IAGN,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AAjCW,QAAA,gBAAgB,oBAiC3B"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useTokenAccount = void 0;
|
|
4
|
-
const account_fetch_cache_hooks_1 = require("@helium/account-fetch-cache-hooks");
|
|
5
|
-
const spl_token_1 = require("@solana/spl-token");
|
|
6
|
-
const parser = (pubkey, acct) => {
|
|
7
|
-
return (0, spl_token_1.unpackAccount)(pubkey, acct);
|
|
8
|
-
};
|
|
9
|
-
function useTokenAccount(address) {
|
|
10
|
-
return (0, account_fetch_cache_hooks_1.useAccount)(address, parser);
|
|
11
|
-
}
|
|
12
|
-
exports.useTokenAccount = useTokenAccount;
|
|
13
|
-
//# sourceMappingURL=useTokenAccount.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useTokenAccount.js","sourceRoot":"","sources":["../../../src/hooks/useTokenAccount.ts"],"names":[],"mappings":";;;AAAA,iFAAgF;AAChF,iDAA2D;AAG3D,MAAM,MAAM,GAAG,CACb,MAAiB,EACjB,IAAyB,EACJ,EAAE;IACvB,OAAO,IAAA,yBAAa,EAAC,MAAM,EAAE,IAAI,CAAC,CAAC;AACrC,CAAC,CAAC;AAEF,SAAgB,eAAe,CAC7B,OAAqC;IAErC,OAAO,IAAA,sCAAU,EAAC,OAAO,EAAE,MAAM,CAAC,CAAC;AACrC,CAAC;AAJD,0CAIC"}
|
package/lib/cjs/index.js
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useAnchorProvider = exports.useSolanaUnixNow = exports.useAssociatedTokenAddress = exports.useTokenAccount = exports.useSolOwnedAmount = exports.useOwnedAmount = exports.MintParser = exports.useMint = exports.useAssociatedTokenAccount = exports.useInterval = exports.useAnchorAccounts = exports.useAnchorAccount = exports.useIdlAccounts = exports.useIdlAccount = void 0;
|
|
4
|
-
var useIdlAccount_1 = require("./hooks/useIdlAccount");
|
|
5
|
-
Object.defineProperty(exports, "useIdlAccount", { enumerable: true, get: function () { return useIdlAccount_1.useIdlAccount; } });
|
|
6
|
-
var useIdlAccounts_1 = require("./hooks/useIdlAccounts");
|
|
7
|
-
Object.defineProperty(exports, "useIdlAccounts", { enumerable: true, get: function () { return useIdlAccounts_1.useIdlAccounts; } });
|
|
8
|
-
var useAnchorAccount_1 = require("./hooks/useAnchorAccount");
|
|
9
|
-
Object.defineProperty(exports, "useAnchorAccount", { enumerable: true, get: function () { return useAnchorAccount_1.useAnchorAccount; } });
|
|
10
|
-
var useAnchorAccounts_1 = require("./hooks/useAnchorAccounts");
|
|
11
|
-
Object.defineProperty(exports, "useAnchorAccounts", { enumerable: true, get: function () { return useAnchorAccounts_1.useAnchorAccounts; } });
|
|
12
|
-
var useInterval_1 = require("./hooks/useInterval");
|
|
13
|
-
Object.defineProperty(exports, "useInterval", { enumerable: true, get: function () { return useInterval_1.useInterval; } });
|
|
14
|
-
var useAssociatedTokenAccount_1 = require("./hooks/useAssociatedTokenAccount");
|
|
15
|
-
Object.defineProperty(exports, "useAssociatedTokenAccount", { enumerable: true, get: function () { return useAssociatedTokenAccount_1.useAssociatedTokenAccount; } });
|
|
16
|
-
var useMint_1 = require("./hooks/useMint");
|
|
17
|
-
Object.defineProperty(exports, "useMint", { enumerable: true, get: function () { return useMint_1.useMint; } });
|
|
18
|
-
Object.defineProperty(exports, "MintParser", { enumerable: true, get: function () { return useMint_1.MintParser; } });
|
|
19
|
-
var useOwnedAmount_1 = require("./hooks/useOwnedAmount");
|
|
20
|
-
Object.defineProperty(exports, "useOwnedAmount", { enumerable: true, get: function () { return useOwnedAmount_1.useOwnedAmount; } });
|
|
21
|
-
var useSolOwnedAmount_1 = require("./hooks/useSolOwnedAmount");
|
|
22
|
-
Object.defineProperty(exports, "useSolOwnedAmount", { enumerable: true, get: function () { return useSolOwnedAmount_1.useSolOwnedAmount; } });
|
|
23
|
-
var useTokenAccount_1 = require("./hooks/useTokenAccount");
|
|
24
|
-
Object.defineProperty(exports, "useTokenAccount", { enumerable: true, get: function () { return useTokenAccount_1.useTokenAccount; } });
|
|
25
|
-
var useAssociatedTokenAddress_1 = require("./hooks/useAssociatedTokenAddress");
|
|
26
|
-
Object.defineProperty(exports, "useAssociatedTokenAddress", { enumerable: true, get: function () { return useAssociatedTokenAddress_1.useAssociatedTokenAddress; } });
|
|
27
|
-
var useSolanaUnixNow_1 = require("./hooks/useSolanaUnixNow");
|
|
28
|
-
Object.defineProperty(exports, "useSolanaUnixNow", { enumerable: true, get: function () { return useSolanaUnixNow_1.useSolanaUnixNow; } });
|
|
29
|
-
var useAnchorProvider_1 = require("./hooks/useAnchorProvider");
|
|
30
|
-
Object.defineProperty(exports, "useAnchorProvider", { enumerable: true, get: function () { return useAnchorProvider_1.useAnchorProvider; } });
|
|
31
|
-
//# sourceMappingURL=index.js.map
|
package/lib/cjs/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AAAA,uDAAsD;AAA7C,8GAAA,aAAa,OAAA;AACtB,yDAAwD;AAA/C,gHAAA,cAAc,OAAA;AACvB,6DAA4D;AAAnD,oHAAA,gBAAgB,OAAA;AACzB,+DAA8D;AAArD,sHAAA,iBAAiB,OAAA;AAC1B,mDAAkD;AAAzC,0GAAA,WAAW,OAAA;AACpB,+EAA8E;AAArE,sIAAA,yBAAyB,OAAA;AAClC,2CAAsD;AAA7C,kGAAA,OAAO,OAAA;AAAE,qGAAA,UAAU,OAAA;AAC5B,yDAAwD;AAA/C,gHAAA,cAAc,OAAA;AACvB,+DAA8D;AAArD,sHAAA,iBAAiB,OAAA;AAC1B,2DAA0D;AAAjD,kHAAA,eAAe,OAAA;AACxB,+EAA8E;AAArE,sIAAA,yBAAyB,OAAA;AAClC,6DAA4D;AAAnD,oHAAA,gBAAgB,OAAA;AACzB,+DAA8D;AAArD,sHAAA,iBAAiB,OAAA"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { useAccount } from "@helium/account-fetch-cache-hooks";
|
|
2
|
-
import { useIdl } from "./useIdl";
|
|
3
|
-
import { useIdlAccount } from "./useIdlAccount";
|
|
4
|
-
import { useEffect } from "react";
|
|
5
|
-
export function useAnchorAccount(key, type,
|
|
6
|
-
// Perf optimization - set if the account will never change, to lower websocket usage.
|
|
7
|
-
isStatic = false) {
|
|
8
|
-
const { account: rawAccount } = useAccount(key);
|
|
9
|
-
const { info: idl, error, loading } = useIdl(rawAccount?.owner);
|
|
10
|
-
useEffect(() => {
|
|
11
|
-
if (!loading && rawAccount && !idl) {
|
|
12
|
-
console.warn(`Idl not found for ${rawAccount.owner.toBase58()}`);
|
|
13
|
-
}
|
|
14
|
-
}, [idl, loading, rawAccount]);
|
|
15
|
-
return {
|
|
16
|
-
...useIdlAccount(key, idl, type, isStatic),
|
|
17
|
-
error,
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
//# sourceMappingURL=useAnchorAccount.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useAnchorAccount.js","sourceRoot":"","sources":["../../../../src/hooks/useAnchorAccount.ts"],"names":[],"mappings":"AAEA,OAAO,EAAmB,UAAU,EAAE,MAAM,mCAAmC,CAAC;AAEhF,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElC,MAAM,UAAU,gBAAgB,CAC9B,GAA0B,EAC1B,IAAO;AACP,sFAAsF;AACtF,WAAoB,KAAK;IAIzB,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,GAAG,UAAU,CAAC,GAAG,CAAC,CAAC;IAChD,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,MAAM,CAAM,UAAU,EAAE,KAAK,CAAC,CAAC;IACrE,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,CAAC,OAAO,IAAI,UAAU,IAAI,CAAC,GAAG,EAAE;YAClC,OAAO,CAAC,IAAI,CAAC,qBAAqB,UAAU,CAAC,KAAK,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;SAClE;IACH,CAAC,EAAE,CAAC,GAAG,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC,CAAC;IAE/B,OAAO;QACL,GAAG,aAAa,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,QAAQ,CAAC;QAC1C,KAAK;KACN,CAAC;AACJ,CAAC"}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { useAccounts } from "@helium/account-fetch-cache-hooks";
|
|
2
|
-
import { useIdl } from "./useIdl";
|
|
3
|
-
import { useIdlAccounts } from "./useIdlAccounts";
|
|
4
|
-
import { useEffect, useMemo } from "react";
|
|
5
|
-
export function useAnchorAccounts(keys, type,
|
|
6
|
-
// Perf optimization - set if the account will never change, to lower websocket usage.
|
|
7
|
-
isStatic = false) {
|
|
8
|
-
const { accounts: rawAccounts } = useAccounts(keys);
|
|
9
|
-
const owner = useMemo(() => {
|
|
10
|
-
return rawAccounts?.find((a) => a.account)?.account?.owner;
|
|
11
|
-
}, [rawAccounts]);
|
|
12
|
-
const { info: idl, error, loading } = useIdl(owner);
|
|
13
|
-
useEffect(() => {
|
|
14
|
-
if (!loading && owner && !idl) {
|
|
15
|
-
console.warn(`Idl not found for ${owner.toBase58()}`);
|
|
16
|
-
}
|
|
17
|
-
}, [idl, loading, owner]);
|
|
18
|
-
const { error: useAccErr, ...result } = useIdlAccounts(keys, idl, type, isStatic);
|
|
19
|
-
return {
|
|
20
|
-
...result,
|
|
21
|
-
error: error || useAccErr,
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
//# sourceMappingURL=useAnchorAccounts.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useAnchorAccounts.js","sourceRoot":"","sources":["../../../../src/hooks/useAnchorAccounts.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,WAAW,EACZ,MAAM,mCAAmC,CAAC;AAE3C,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAE3C,MAAM,UAAU,iBAAiB,CAI/B,IAA6B,EAC7B,IAAO;AACP,sFAAsF;AACtF,WAAoB,KAAK;IAIzB,MAAM,EAAE,QAAQ,EAAE,WAAW,EAAE,GAAG,WAAW,CAAC,IAAI,CAAC,CAAC;IACpD,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,EAAE;QACzB,OAAO,WAAW,EAAE,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,OAAO,EAAE,KAAK,CAAC;IAC7D,CAAC,EAAE,CAAC,WAAW,CAAC,CAAC,CAAC;IAClB,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,MAAM,CAAM,KAAK,CAAC,CAAC;IACzD,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,CAAC,OAAO,IAAI,KAAK,IAAI,CAAC,GAAG,EAAE;YAC7B,OAAO,CAAC,IAAI,CAAC,qBAAqB,KAAK,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;SACvD;IACH,CAAC,EAAE,CAAC,GAAG,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC;IAE1B,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,GAAG,MAAM,EAAE,GAAG,cAAc,CACpD,IAAI,EACJ,GAAG,EACH,IAAI,EACJ,QAAQ,CACT,CAAC;IACF,OAAO;QACL,GAAG,MAAM;QACT,KAAK,EAAE,KAAK,IAAI,SAAS;KAC1B,CAAC;AACJ,CAAC"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { AnchorProvider } from "@coral-xyz/anchor";
|
|
2
|
-
import { useConnection, useWallet } from "@solana/wallet-adapter-react";
|
|
3
|
-
import { useMemo } from "react";
|
|
4
|
-
export function useAnchorProvider() {
|
|
5
|
-
const { connection } = useConnection();
|
|
6
|
-
const { wallet } = useWallet();
|
|
7
|
-
return useMemo(() => {
|
|
8
|
-
if (wallet && connection) {
|
|
9
|
-
return new AnchorProvider(connection, wallet.adapter, {
|
|
10
|
-
commitment: "confirmed",
|
|
11
|
-
});
|
|
12
|
-
}
|
|
13
|
-
}, [connection, wallet]);
|
|
14
|
-
}
|
|
15
|
-
//# sourceMappingURL=useAnchorProvider.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useAnchorProvider.js","sourceRoot":"","sources":["../../../../src/hooks/useAnchorProvider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACxE,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAGhC,MAAM,UAAU,iBAAiB;IAC/B,MAAM,EAAE,UAAU,EAAE,GAAG,aAAa,EAAE,CAAC;IACvC,MAAM,EAAE,MAAM,EAAE,GAAG,SAAS,EAAE,CAAC;IAC/B,OAAO,OAAO,CAAC,GAAG,EAAE;QAClB,IAAI,MAAM,IAAI,UAAU,EAAE;YACxB,OAAO,IAAI,cAAc,CAAC,UAAU,EAAE,MAAM,CAAC,OAAc,EAAE;gBAC3D,UAAU,EAAE,WAAW;aACxB,CAAC,CAAC;SACJ;IACH,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC,CAAC;AAC3B,CAAC"}
|