@cordystackx/cordy_minikit 3.0.0 → 3.0.2
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 +24 -18
- package/dist/client/jwt.d.ts +0 -3
- package/dist/client/jwt.d.ts.map +1 -1
- package/dist/client/jwt.js +0 -3
- package/dist/client/runtimeConfig.d.ts +52 -0
- package/dist/client/runtimeConfig.d.ts.map +1 -0
- package/dist/client/runtimeConfig.js +15 -0
- package/dist/client/transfer.d.ts +3 -42
- package/dist/client/transfer.d.ts.map +1 -1
- package/dist/client/transfer.js +48 -60
- package/dist/client.d.ts +1 -1
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +1 -1
- package/dist/client__provider.js +2 -2
- package/dist/config/walletConfig.d.ts +3 -1
- package/dist/config/walletConfig.d.ts.map +1 -1
- package/dist/config/walletConfig.js +5 -31
- package/dist/controllers/Get_Balance.d.ts +1 -1
- package/dist/controllers/Get_Balance.d.ts.map +1 -1
- package/dist/controllers/Get_Balance.js +8 -3
- package/dist/controllers/StellarButton.js +1 -1
- package/dist/controllers/Transactions.d.ts +2 -0
- package/dist/controllers/Transactions.d.ts.map +1 -1
- package/dist/controllers/Transactions.js +20 -11
- package/dist/controllers/WagmiButton.js +1 -1
- package/dist/controllers/index.d.ts +0 -1
- package/dist/controllers/index.d.ts.map +1 -1
- package/dist/controllers/index.js +0 -1
- package/dist/controllers/loadStellarBalance.d.ts.map +1 -1
- package/dist/controllers/loadStellarBalance.js +11 -12
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/package.json +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/dist/controllers/AirDrop_Faucet.d.ts +0 -2
- package/dist/controllers/AirDrop_Faucet.d.ts.map +0 -1
- package/dist/controllers/AirDrop_Faucet.js +0 -93
|
@@ -19,7 +19,7 @@ export type TokenBalanceResult = {
|
|
|
19
19
|
};
|
|
20
20
|
/** Shared ERC-20 balance reader used by wallet status and the Cordy API. */
|
|
21
21
|
export declare function readTokenBalance(address: string, options?: TokenBalanceOptions): Promise<TokenBalanceResult>;
|
|
22
|
-
/**
|
|
22
|
+
/** @deprecated Use `cordy.balance({ asset })` for an explicit success or error result. */
|
|
23
23
|
export default function getTokenBalance(address: string, decimals?: number): Promise<{
|
|
24
24
|
balance: string;
|
|
25
25
|
symbol: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Get_Balance.d.ts","sourceRoot":"","sources":["../../controllers/Get_Balance.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAqD,KAAK,QAAQ,EAAE,MAAM,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"Get_Balance.d.ts","sourceRoot":"","sources":["../../controllers/Get_Balance.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAqD,KAAK,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAI1F,MAAM,MAAM,mBAAmB,GAAG;IAChC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,gBAAgB,CAAC,EAAE,QAAQ,CAAC;IAC5B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,4EAA4E;AAC5E,wBAAsB,gBAAgB,CACpC,OAAO,EAAE,MAAM,EACf,OAAO,GAAE,mBAAwB,GAChC,OAAO,CAAC,kBAAkB,CAAC,CAyF7B;AAED,0FAA0F;AAC1F,wBAA8B,eAAe,CAC3C,OAAO,EAAE,MAAM,EACf,QAAQ,CAAC,EAAE,MAAM,GAChB,OAAO,CAAC;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC,CAQ9C"}
|
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
import { Contract, formatUnits, isAddress, JsonRpcProvider } from "ethers";
|
|
2
2
|
import ERC20_ABI from "../config/ERC20_ABI.json";
|
|
3
|
+
import { getCordyRuntimeConfig } from "../client/runtimeConfig";
|
|
3
4
|
/** Shared ERC-20 balance reader used by wallet status and the Cordy API. */
|
|
4
5
|
export async function readTokenBalance(address, options = {}) {
|
|
5
|
-
const
|
|
6
|
-
const
|
|
6
|
+
const assets = getCordyRuntimeConfig();
|
|
7
|
+
const configuredChainId = options.expectedChainId ?? assets?.networks?.[0]?.chainId;
|
|
8
|
+
const chainAssets = assets?.evm?.filter((asset) => (asset.chainId ?? assets.networks?.[0]?.chainId) === configuredChainId) ?? [];
|
|
9
|
+
const defaultAsset = chainAssets.find((asset) => asset.contractAddress) || chainAssets[0];
|
|
10
|
+
const tokenAddress = options.tokenAddress || defaultAsset?.contractAddress;
|
|
11
|
+
const rpcUrl = options.rpcUrl || defaultAsset?.rpcUrl || assets?.networks?.find((network) => network.chainId === configuredChainId)?.rpcUrl;
|
|
7
12
|
const provider = options.provider || (rpcUrl ? new JsonRpcProvider(rpcUrl) : undefined);
|
|
8
13
|
if (!tokenAddress)
|
|
9
14
|
throw new Error("No EVM token address is configured.");
|
|
@@ -89,7 +94,7 @@ export async function readTokenBalance(address, options = {}) {
|
|
|
89
94
|
chainId,
|
|
90
95
|
};
|
|
91
96
|
}
|
|
92
|
-
/**
|
|
97
|
+
/** @deprecated Use `cordy.balance({ asset })` for an explicit success or error result. */
|
|
93
98
|
export default async function getTokenBalance(address, decimals) {
|
|
94
99
|
try {
|
|
95
100
|
const result = await readTokenBalance(address, { decimals });
|
|
@@ -21,7 +21,7 @@ export default function StellarWalletButton({ onConnect, onStatusChange, }) {
|
|
|
21
21
|
onStatusChange?.({ isPending: true });
|
|
22
22
|
try {
|
|
23
23
|
if (!isStellarEnvironmentConfigured()) {
|
|
24
|
-
throw new Error("Stellar
|
|
24
|
+
throw new Error("Stellar is not configured. Add stellarNetwork and Stellar assets to the JSON passed to ProvidersClientWrapper.");
|
|
25
25
|
}
|
|
26
26
|
const connection = await isConnected();
|
|
27
27
|
if (!connection.isConnected) {
|
|
@@ -2,7 +2,9 @@ type CordyStackStellarTransOptions = {
|
|
|
2
2
|
memo?: string;
|
|
3
3
|
source?: string;
|
|
4
4
|
};
|
|
5
|
+
/** @deprecated Use `cordy.transfer(amount, recipient, { asset })` instead. */
|
|
5
6
|
export default function CordyStackTrans(address: string, cost: number): Promise<boolean>;
|
|
7
|
+
/** @deprecated Use `cordy.transfer(amount, recipient, { asset: "XLM", memo })` instead. */
|
|
6
8
|
export declare function CordyStackTransStellar(address: string, cost: number, options?: CordyStackStellarTransOptions): Promise<boolean>;
|
|
7
9
|
export {};
|
|
8
10
|
//# sourceMappingURL=Transactions.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Transactions.d.ts","sourceRoot":"","sources":["../../controllers/Transactions.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Transactions.d.ts","sourceRoot":"","sources":["../../controllers/Transactions.tsx"],"names":[],"mappings":"AAOA,KAAK,6BAA6B,GAAG;IACnC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,8EAA8E;AAC9E,wBAA8B,eAAe,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,oBA4D1E;AAED,2FAA2F;AAC3F,wBAAsB,sBAAsB,CAC1C,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE,6BAAkC,oBAyF5C"}
|
|
@@ -1,18 +1,21 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { ethers, parseUnits } from 'ethers';
|
|
3
|
-
import { Horizon, Asset, BASE_FEE, Memo,
|
|
3
|
+
import { Horizon, Asset, BASE_FEE, Memo, Operation, TransactionBuilder } from "@stellar/stellar-sdk";
|
|
4
4
|
import { getNetworkDetails, requestAccess, signTransaction as freighterSignTransaction } from "@stellar/freighter-api";
|
|
5
5
|
import tokenAbi from '../config/ERC20_ABI.json';
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const stellarRpc = process.env.NEXT_PUBLIC_STELLAR_HORIZON || "https://horizon-testnet.stellar.org";
|
|
9
|
-
const stellarNetwork = process.env.NEXT_PUBLIC_STELLAR_NETWORK_PASSPHRASE || Networks.TESTNET;
|
|
6
|
+
import { getCordyRuntimeConfig } from '../client/runtimeConfig';
|
|
7
|
+
/** @deprecated Use `cordy.transfer(amount, recipient, { asset })` instead. */
|
|
10
8
|
export default async function CordyStackTrans(address, cost) {
|
|
11
9
|
if (!address) {
|
|
12
10
|
console.error("Address Not Found");
|
|
13
11
|
return false;
|
|
14
12
|
}
|
|
15
13
|
try {
|
|
14
|
+
const runtimeConfig = getCordyRuntimeConfig();
|
|
15
|
+
const defaultNetwork = runtimeConfig?.networks?.[0];
|
|
16
|
+
const defaultAsset = runtimeConfig?.evm?.find((asset) => (asset.chainId ?? defaultNetwork?.chainId) === defaultNetwork?.chainId && asset.contractAddress);
|
|
17
|
+
const tokenAddress = defaultAsset?.contractAddress || "";
|
|
18
|
+
const rpcEndpoint = defaultAsset?.rpcUrl || defaultNetwork?.rpcUrl || "";
|
|
16
19
|
const ethereum = window?.ethereum;
|
|
17
20
|
if (!ethereum) {
|
|
18
21
|
console.error("Ethereum provider not found");
|
|
@@ -21,11 +24,11 @@ export default async function CordyStackTrans(address, cost) {
|
|
|
21
24
|
const provider = new ethers.BrowserProvider(ethereum);
|
|
22
25
|
const signer = await provider.getSigner();
|
|
23
26
|
if (!tokenAddress) {
|
|
24
|
-
console.error("
|
|
27
|
+
console.error("No EVM token is configured in the assets JSON");
|
|
25
28
|
return false;
|
|
26
29
|
}
|
|
27
30
|
if (!rpcEndpoint) {
|
|
28
|
-
console.error("
|
|
31
|
+
console.error("No EVM network RPC is configured in the assets JSON");
|
|
29
32
|
return false;
|
|
30
33
|
}
|
|
31
34
|
const tokenContract = new ethers.Contract(tokenAddress, tokenAbi, signer);
|
|
@@ -54,6 +57,7 @@ export default async function CordyStackTrans(address, cost) {
|
|
|
54
57
|
}
|
|
55
58
|
}
|
|
56
59
|
;
|
|
60
|
+
/** @deprecated Use `cordy.transfer(amount, recipient, { asset: "XLM", memo })` instead. */
|
|
57
61
|
export async function CordyStackTransStellar(address, cost, options = {}) {
|
|
58
62
|
if (!address) {
|
|
59
63
|
console.error("Address Not Found");
|
|
@@ -68,6 +72,11 @@ export async function CordyStackTransStellar(address, cost, options = {}) {
|
|
|
68
72
|
return false;
|
|
69
73
|
}
|
|
70
74
|
try {
|
|
75
|
+
const stellarConfig = getCordyRuntimeConfig()?.stellarNetwork;
|
|
76
|
+
if (!stellarConfig?.horizonUrl || !stellarConfig.networkPassphrase) {
|
|
77
|
+
console.error("Stellar network configuration is missing from the assets JSON");
|
|
78
|
+
return false;
|
|
79
|
+
}
|
|
71
80
|
const access = await requestAccess();
|
|
72
81
|
const sourceAddress = options.source || access.address;
|
|
73
82
|
if (!sourceAddress) {
|
|
@@ -75,16 +84,16 @@ export async function CordyStackTransStellar(address, cost, options = {}) {
|
|
|
75
84
|
return false;
|
|
76
85
|
}
|
|
77
86
|
const networkDetails = await getNetworkDetails();
|
|
78
|
-
const networkPassphrase = networkDetails.networkPassphrase ||
|
|
87
|
+
const networkPassphrase = networkDetails.networkPassphrase || stellarConfig.networkPassphrase;
|
|
79
88
|
if (!networkPassphrase) {
|
|
80
89
|
console.error("Stellar network passphrase not found");
|
|
81
90
|
return false;
|
|
82
91
|
}
|
|
83
|
-
if (networkDetails.networkPassphrase && networkDetails.networkPassphrase !==
|
|
84
|
-
console.error("Stellar network mismatch. Expected",
|
|
92
|
+
if (networkDetails.networkPassphrase && networkDetails.networkPassphrase !== stellarConfig.networkPassphrase) {
|
|
93
|
+
console.error("Stellar network mismatch. Expected", stellarConfig.networkPassphrase, "got", networkDetails.networkPassphrase);
|
|
85
94
|
return false;
|
|
86
95
|
}
|
|
87
|
-
const server = new Horizon.Server(
|
|
96
|
+
const server = new Horizon.Server(stellarConfig.horizonUrl);
|
|
88
97
|
const sourceAccount = await server.loadAccount(sourceAddress);
|
|
89
98
|
const asset = Asset.native();
|
|
90
99
|
const payment = Operation.payment({
|
|
@@ -34,7 +34,7 @@ export default function WalletButton({ onStatusChange, connectorGroup = "all", }
|
|
|
34
34
|
setPendingConnector(connector);
|
|
35
35
|
try {
|
|
36
36
|
if (!isEvmEnvironmentConfigured()) {
|
|
37
|
-
throw new Error("EVM
|
|
37
|
+
throw new Error("EVM is not configured. Add an EVM network and at least one asset to the JSON passed to ProvidersClientWrapper.");
|
|
38
38
|
}
|
|
39
39
|
await connectAsync({ connector });
|
|
40
40
|
if (typeof window !== "undefined")
|
|
@@ -2,7 +2,6 @@ export { default as WalletButton } from "./WagmiButton";
|
|
|
2
2
|
export { default as CordyStackTrans } from "./Transactions";
|
|
3
3
|
export { CordyStackTransStellar } from "./Transactions";
|
|
4
4
|
export { default as getTokenBalance } from "./Get_Balance";
|
|
5
|
-
export { default as AirDropFuacet } from "./AirDrop_Faucet";
|
|
6
5
|
export { default as Get_Account_Info } from "./Get_Account_Info";
|
|
7
6
|
export { default as StellarWalletButton } from "./StellarButton";
|
|
8
7
|
export { default as loadStellarBalance } from "./loadStellarBalance";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../controllers/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,eAAe,CAAC;AAExD,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAC5D,OAAO,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AAExD,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,eAAe,CAAC;AAE3D,OAAO,EAAE,OAAO,IAAI,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../controllers/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,eAAe,CAAC;AAExD,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAC5D,OAAO,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AAExD,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,eAAe,CAAC;AAE3D,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEjE,OAAO,EAAE,OAAO,IAAI,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAEjE,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAErE,OAAO,EAAE,OAAO,IAAI,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAE/D,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,oBAAoB,CAAC"}
|
|
@@ -2,7 +2,6 @@ export { default as WalletButton } from "./WagmiButton";
|
|
|
2
2
|
export { default as CordyStackTrans } from "./Transactions";
|
|
3
3
|
export { CordyStackTransStellar } from "./Transactions";
|
|
4
4
|
export { default as getTokenBalance } from "./Get_Balance";
|
|
5
|
-
export { default as AirDropFuacet } from "./AirDrop_Faucet";
|
|
6
5
|
export { default as Get_Account_Info } from "./Get_Account_Info";
|
|
7
6
|
export { default as StellarWalletButton } from "./StellarButton";
|
|
8
7
|
export { default as loadStellarBalance } from "./loadStellarBalance";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loadStellarBalance.d.ts","sourceRoot":"","sources":["../../controllers/loadStellarBalance.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"loadStellarBalance.d.ts","sourceRoot":"","sources":["../../controllers/loadStellarBalance.ts"],"names":[],"mappings":"AAIA,wBAAgB,8BAA8B,IAAI,OAAO,CAExD;AAED,MAAM,MAAM,mBAAmB,GAC3B;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,QAAQ,CAAC;IAAC,iBAAiB,CAAC,EAAE,MAAM,CAAA;CAAE,GAC9D;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,QAAQ,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,iBAAiB,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAEjG,MAAM,MAAM,qBAAqB,GAAG;IAClC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,mBAAmB,CAAC;IAC5B,MAAM,CAAC,EAAE,mBAAmB,EAAE,CAAC;IAC/B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IACjC,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,8EAA8E;AAC9E,wBAA8B,kBAAkB,CAC9C,SAAS,EAAE,MAAM,EACjB,OAAO,GAAE,qBAA0B,GAClC,OAAO,CAAC,oBAAoB,CAAC,CAwD/B"}
|
|
@@ -1,21 +1,20 @@
|
|
|
1
1
|
import { Horizon } from "@stellar/stellar-sdk";
|
|
2
2
|
import { getNetworkDetails } from "@stellar/freighter-api";
|
|
3
|
-
|
|
4
|
-
const STELLAR_NETWORK_PASSPHRASE = process.env.NEXT_PUBLIC_STELLAR_NETWORK_PASSPHRASE;
|
|
3
|
+
import { getCordyRuntimeConfig, isStellarConfigReady } from "../client/runtimeConfig";
|
|
5
4
|
export function isStellarEnvironmentConfigured() {
|
|
6
|
-
return
|
|
7
|
-
STELLAR_NETWORK_PASSPHRASE &&
|
|
8
|
-
process.env.NEXT_PUBLIC_STELLAR_CONTRACT_ID);
|
|
5
|
+
return isStellarConfigReady();
|
|
9
6
|
}
|
|
10
7
|
/** Shared Stellar account balance reader for wallet status and Cordy APIs. */
|
|
11
8
|
export default async function loadStellarBalance(accountId, options = {}) {
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
const runtimeConfig = getCordyRuntimeConfig();
|
|
10
|
+
const stellarConfig = runtimeConfig?.stellarNetwork;
|
|
11
|
+
const horizonUrl = options.horizonUrl || stellarConfig?.horizonUrl;
|
|
12
|
+
const configuredPassphrase = options.networkPassphrase || stellarConfig?.networkPassphrase;
|
|
13
|
+
if (!isStellarEnvironmentConfigured() || !horizonUrl || !configuredPassphrase) {
|
|
14
|
+
throw new Error("Stellar is not configured. Add stellarNetwork and Stellar assets to the JSON passed to ProvidersClientWrapper.");
|
|
14
15
|
}
|
|
15
|
-
const horizonUrl = STELLAR_HORIZON;
|
|
16
|
-
const configuredPassphrase = STELLAR_NETWORK_PASSPHRASE;
|
|
17
16
|
const networkDetails = await getNetworkDetails();
|
|
18
|
-
const expectedPassphrase =
|
|
17
|
+
const expectedPassphrase = configuredPassphrase;
|
|
19
18
|
const freighterPassphrase = networkDetails.networkPassphrase;
|
|
20
19
|
if (freighterPassphrase && freighterPassphrase !== expectedPassphrase) {
|
|
21
20
|
throw new Error(`Freighter network mismatch. Expected ${expectedPassphrase}, got ${freighterPassphrase}.`);
|
|
@@ -24,7 +23,7 @@ export default async function loadStellarBalance(accountId, options = {}) {
|
|
|
24
23
|
const requestedSymbol = options.asset?.symbol || options.assetSymbol || "XLM";
|
|
25
24
|
let asset = options.asset;
|
|
26
25
|
if (!asset) {
|
|
27
|
-
const candidates = (options.assets ?? []).filter((candidate) => candidate.symbol.toLowerCase() === requestedSymbol.toLowerCase() &&
|
|
26
|
+
const candidates = (options.assets ?? runtimeConfig?.stellar ?? []).filter((candidate) => candidate.symbol.toLowerCase() === requestedSymbol.toLowerCase() &&
|
|
28
27
|
(!candidate.networkPassphrase || candidate.networkPassphrase === networkPassphrase));
|
|
29
28
|
if (candidates.length > 1) {
|
|
30
29
|
throw new Error(`More than one ${requestedSymbol} asset matches this Stellar network; make the JSON entries unique.`);
|
|
@@ -39,7 +38,7 @@ export default async function loadStellarBalance(accountId, options = {}) {
|
|
|
39
38
|
if (asset.networkPassphrase && asset.networkPassphrase !== networkPassphrase) {
|
|
40
39
|
throw new Error(`The ${asset.symbol} asset is not configured for the connected Stellar network.`);
|
|
41
40
|
}
|
|
42
|
-
const server = new Horizon.Server(
|
|
41
|
+
const server = new Horizon.Server(horizonUrl);
|
|
43
42
|
const account = await server.loadAccount(accountId);
|
|
44
43
|
const balance = asset.type === "native"
|
|
45
44
|
? account.balances.find((item) => item.asset_type === "native")
|
package/dist/index.d.ts
CHANGED
|
@@ -3,8 +3,8 @@ export { default as getConfig } from "./config/walletConfig";
|
|
|
3
3
|
export { useWalletModal } from "./wagmi__providers";
|
|
4
4
|
export { ConnectWalletBT } from "./components";
|
|
5
5
|
export { CordyStackTrans, CordyStackTransStellar, useWalletStatus, useDisconnectWallets, WalletButton, StellarWalletButton } from "./controllers";
|
|
6
|
-
export { cordy,
|
|
6
|
+
export { cordy, jwt_verify, jwt_disconnect } from "./client";
|
|
7
7
|
export type { JwtDisconnectResult, JwtSessionRequestOptions, JwtSessionResult } from "./client";
|
|
8
8
|
export { configureCordyAssets, cordy_balance, cordy_configure, cordy_bridge, cordy_swap, cordy_transfer } from "./client/transfer";
|
|
9
|
-
export type { CordyAssetsConfig, CordyBalanceOptions, CordyBalanceResult, CordyTransferOptions, CordyTransferResult, CordySwapResult, CordyBridgeResult, CordyBridgeSide, EvmAssetConfig, EvmNetworkConfig, StellarAssetConfig } from "./client/transfer";
|
|
9
|
+
export type { CordyAssetsConfig, CordyBalanceOptions, CordyBalanceResult, CordyTransferOptions, CordyTransferResult, CordySwapResult, CordyBridgeResult, CordyBridgeSide, EvmAssetConfig, EvmNetworkConfig, StellarAssetConfig, StellarNetworkConfig } from "./client/transfer";
|
|
10
10
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,IAAI,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAGvE,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAG7D,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAGpD,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAG/C,OAAO,EACL,eAAe,EACf,sBAAsB,EACtB,eAAe,EACf,oBAAoB,EACpB,YAAY,EACZ,mBAAmB,EACpB,MAAM,eAAe,CAAC;AAGvB,OAAO,EAAE,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,IAAI,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAGvE,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAG7D,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAGpD,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAG/C,OAAO,EACL,eAAe,EACf,sBAAsB,EACtB,eAAe,EACf,oBAAoB,EACpB,YAAY,EACZ,mBAAmB,EACpB,MAAM,eAAe,CAAC;AAGvB,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC7D,YAAY,EAAE,mBAAmB,EAAE,wBAAwB,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAEhG,OAAO,EAAE,oBAAoB,EAAE,aAAa,EAAE,eAAe,EAAE,YAAY,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnI,YAAY,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,eAAe,EAAE,iBAAiB,EAAE,eAAe,EAAE,cAAc,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -9,5 +9,5 @@ export { ConnectWalletBT } from "./components";
|
|
|
9
9
|
//Controllers
|
|
10
10
|
export { CordyStackTrans, CordyStackTransStellar, useWalletStatus, useDisconnectWallets, WalletButton, StellarWalletButton } from "./controllers";
|
|
11
11
|
// Client-side JWT session helpers (safe for browser imports).
|
|
12
|
-
export { cordy,
|
|
12
|
+
export { cordy, jwt_verify, jwt_disconnect } from "./client";
|
|
13
13
|
export { configureCordyAssets, cordy_balance, cordy_configure, cordy_bridge, cordy_swap, cordy_transfer } from "./client/transfer";
|