veilix-sdk 0.0.2 → 0.0.3
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 +2 -5
- package/dist/{VeilixSDK-DBfh30Dv.d.ts → VeilixSDK-gVJF57i3.d.ts} +4 -8
- package/dist/{VeilixSDK-Dg8RSskQ.d.cts → VeilixSDK-zBJW48DL.d.cts} +4 -8
- package/dist/circuits/paths.cjs.map +1 -1
- package/dist/circuits/paths.js.map +1 -1
- package/dist/index.cjs +5 -16
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +5 -16
- package/dist/index.js.map +1 -1
- package/dist/react/index.cjs +7 -19
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.d.cts +2 -3
- package/dist/react/index.d.ts +2 -3
- package/dist/react/index.js +7 -19
- package/dist/react/index.js.map +1 -1
- package/package.json +1 -1
package/dist/react/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { N as Network, V as VeilixSDK } from '../VeilixSDK-
|
|
1
|
+
import { N as Network, V as VeilixSDK } from '../VeilixSDK-zBJW48DL.cjs';
|
|
2
2
|
import '@solana/web3.js';
|
|
3
3
|
import '@switchboard-xyz/common';
|
|
4
4
|
import '@coral-xyz/anchor';
|
|
@@ -6,7 +6,6 @@ import '@coral-xyz/anchor/dist/cjs/provider';
|
|
|
6
6
|
import '../constants-9OPXLj27.cjs';
|
|
7
7
|
|
|
8
8
|
type UseVeilixSdkOptions = {
|
|
9
|
-
rangeApiKey: string;
|
|
10
9
|
/** Target Solana cluster. */
|
|
11
10
|
network: Network;
|
|
12
11
|
/** Override circuit artifact base path/URL (see {@link VeilixSdkInitOptions.circuitPathsBase}). */
|
|
@@ -22,7 +21,7 @@ type UseVeilixSdkOptions = {
|
|
|
22
21
|
* import { useVeilixSdk } from "veilix-sdk/react";
|
|
23
22
|
*
|
|
24
23
|
* function MyComponent() {
|
|
25
|
-
* const sdk = useVeilixSdk({
|
|
24
|
+
* const sdk = useVeilixSdk({ network: "mainnet" });
|
|
26
25
|
* if (!sdk) return null;
|
|
27
26
|
* // ...
|
|
28
27
|
* }
|
package/dist/react/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { N as Network, V as VeilixSDK } from '../VeilixSDK-
|
|
1
|
+
import { N as Network, V as VeilixSDK } from '../VeilixSDK-gVJF57i3.js';
|
|
2
2
|
import '@solana/web3.js';
|
|
3
3
|
import '@switchboard-xyz/common';
|
|
4
4
|
import '@coral-xyz/anchor';
|
|
@@ -6,7 +6,6 @@ import '@coral-xyz/anchor/dist/cjs/provider';
|
|
|
6
6
|
import '../constants-9OPXLj27.js';
|
|
7
7
|
|
|
8
8
|
type UseVeilixSdkOptions = {
|
|
9
|
-
rangeApiKey: string;
|
|
10
9
|
/** Target Solana cluster. */
|
|
11
10
|
network: Network;
|
|
12
11
|
/** Override circuit artifact base path/URL (see {@link VeilixSdkInitOptions.circuitPathsBase}). */
|
|
@@ -22,7 +21,7 @@ type UseVeilixSdkOptions = {
|
|
|
22
21
|
* import { useVeilixSdk } from "veilix-sdk/react";
|
|
23
22
|
*
|
|
24
23
|
* function MyComponent() {
|
|
25
|
-
* const sdk = useVeilixSdk({
|
|
24
|
+
* const sdk = useVeilixSdk({ network: "mainnet" });
|
|
26
25
|
* if (!sdk) return null;
|
|
27
26
|
* // ...
|
|
28
27
|
* }
|
package/dist/react/index.js
CHANGED
|
@@ -3570,8 +3570,9 @@ var INDEXER_URLS_BY_NETWORK = {
|
|
|
3570
3570
|
function getIndexerUrlForNetwork(network) {
|
|
3571
3571
|
return INDEXER_URLS_BY_NETWORK[network];
|
|
3572
3572
|
}
|
|
3573
|
-
var
|
|
3574
|
-
var
|
|
3573
|
+
var RISK_API_URL = "https://api.veilixprotocol.com";
|
|
3574
|
+
var MAINNET_RISK_API_URL = RISK_API_URL;
|
|
3575
|
+
var DEVNET_RISK_API_URL = RISK_API_URL;
|
|
3575
3576
|
var RISK_API_URLS_BY_NETWORK = {
|
|
3576
3577
|
mainnet: MAINNET_RISK_API_URL,
|
|
3577
3578
|
devnet: DEVNET_RISK_API_URL
|
|
@@ -3796,7 +3797,6 @@ async function createRuntimeConfig(options) {
|
|
|
3796
3797
|
const program = new Program(getIdlForNetwork(network), provider);
|
|
3797
3798
|
const circuitPaths = options.circuitPathsBase !== void 0 ? resolveCircuitPathsFromBase(options.circuitPathsBase) : resolveBrowserCircuitPaths() ?? void 0;
|
|
3798
3799
|
return {
|
|
3799
|
-
rangeApiKey: options.rangeApiKey,
|
|
3800
3800
|
rpcEndpoint,
|
|
3801
3801
|
network,
|
|
3802
3802
|
programId: getProgramIdForNetwork(network),
|
|
@@ -3842,9 +3842,6 @@ function resolveAllowedTokenFromMint(mint) {
|
|
|
3842
3842
|
`veilix-sdk: token mint ${normalized} is not supported on ${getConfig().network}`
|
|
3843
3843
|
);
|
|
3844
3844
|
}
|
|
3845
|
-
function getRangeApiKey() {
|
|
3846
|
-
return getConfig().rangeApiKey;
|
|
3847
|
-
}
|
|
3848
3845
|
function getRpcEndpoint() {
|
|
3849
3846
|
return getConfig().rpcEndpoint;
|
|
3850
3847
|
}
|
|
@@ -12583,11 +12580,8 @@ function getRangeRiskScoreJob(address) {
|
|
|
12583
12580
|
tasks: [
|
|
12584
12581
|
{
|
|
12585
12582
|
httpTask: {
|
|
12586
|
-
url:
|
|
12587
|
-
headers: [
|
|
12588
|
-
{ key: "accept", value: "application/json" },
|
|
12589
|
-
{ key: "X-API-KEY", value: "${RANGE_API_KEY}" }
|
|
12590
|
-
]
|
|
12583
|
+
url: `${RISK_API_URL}/v1/risk/address?address=${address}&network=solana`,
|
|
12584
|
+
headers: [{ key: "accept", value: "application/json" }]
|
|
12591
12585
|
}
|
|
12592
12586
|
},
|
|
12593
12587
|
{ jsonParseTask: { path: "$.riskScore" } },
|
|
@@ -12605,7 +12599,6 @@ function getRangeRiskScoreJob(address) {
|
|
|
12605
12599
|
}
|
|
12606
12600
|
async function getOracleQuote(payer, addressToCheck) {
|
|
12607
12601
|
const rpcUrl = getRpcEndpoint();
|
|
12608
|
-
const rangeApiKey = getRangeApiKey();
|
|
12609
12602
|
const queue = await sb.getQueue({
|
|
12610
12603
|
solanaRPCUrl: rpcUrl,
|
|
12611
12604
|
queueAddress: getDepositQueueAddress()
|
|
@@ -12619,7 +12612,6 @@ async function getOracleQuote(payer, addressToCheck) {
|
|
|
12619
12612
|
maxJobRangePct: 100
|
|
12620
12613
|
};
|
|
12621
12614
|
const sigVerifyIx = await queue.fetchQuoteIx(crossbarClient, [feed], {
|
|
12622
|
-
variableOverrides: { RANGE_API_KEY: rangeApiKey },
|
|
12623
12615
|
numSignatures: 1,
|
|
12624
12616
|
instructionIdx: 0
|
|
12625
12617
|
});
|
|
@@ -13891,9 +13883,6 @@ var VeilixSDK = class _VeilixSDK {
|
|
|
13891
13883
|
getConfig() {
|
|
13892
13884
|
return this.config;
|
|
13893
13885
|
}
|
|
13894
|
-
getRangeApiKey() {
|
|
13895
|
-
return this.config.rangeApiKey;
|
|
13896
|
-
}
|
|
13897
13886
|
getRpcEndpoint() {
|
|
13898
13887
|
return this.config.rpcEndpoint;
|
|
13899
13888
|
}
|
|
@@ -14151,7 +14140,7 @@ var VeilixSDK = class _VeilixSDK {
|
|
|
14151
14140
|
|
|
14152
14141
|
// src/react/useVeilixSdk.ts
|
|
14153
14142
|
function useVeilixSdk(options) {
|
|
14154
|
-
const {
|
|
14143
|
+
const { network, circuitPathsBase } = options;
|
|
14155
14144
|
const { connection } = useConnection();
|
|
14156
14145
|
const wallet = useWallet();
|
|
14157
14146
|
const [sdk, setSdk] = useState(null);
|
|
@@ -14162,7 +14151,6 @@ function useVeilixSdk(options) {
|
|
|
14162
14151
|
}
|
|
14163
14152
|
let cancelled = false;
|
|
14164
14153
|
void VeilixSDK.create({
|
|
14165
|
-
rangeApiKey,
|
|
14166
14154
|
network,
|
|
14167
14155
|
connection,
|
|
14168
14156
|
wallet,
|
|
@@ -14175,7 +14163,7 @@ function useVeilixSdk(options) {
|
|
|
14175
14163
|
return () => {
|
|
14176
14164
|
cancelled = true;
|
|
14177
14165
|
};
|
|
14178
|
-
}, [connection, wallet,
|
|
14166
|
+
}, [connection, wallet, network, circuitPathsBase]);
|
|
14179
14167
|
return sdk;
|
|
14180
14168
|
}
|
|
14181
14169
|
/**
|