@orderly.network/default-solana-adapter 2.9.1 → 2.10.0-alpha.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.d.mts +9 -1
- package/dist/index.d.ts +9 -1
- package/dist/index.js +66 -15
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +72 -17
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -5
package/dist/index.d.mts
CHANGED
|
@@ -10,7 +10,7 @@ declare global {
|
|
|
10
10
|
};
|
|
11
11
|
}
|
|
12
12
|
}
|
|
13
|
-
declare const _default: "2.
|
|
13
|
+
declare const _default: "2.10.0-alpha.0";
|
|
14
14
|
|
|
15
15
|
interface SolanaAdapterOption {
|
|
16
16
|
provider: SolanaWalletProvider;
|
|
@@ -63,6 +63,8 @@ declare class DefaultSolanaWalletAdapter extends BaseWalletAdapter<SolanaAdapter
|
|
|
63
63
|
domain: SignatureDomain;
|
|
64
64
|
}>;
|
|
65
65
|
getBalance(): Promise<bigint>;
|
|
66
|
+
getBalances(addresses: string[]): Promise<bigint[]>;
|
|
67
|
+
getBalanceByAddress(address: string): Promise<bigint>;
|
|
66
68
|
call(address: string, method: string, params: any[], options?: {
|
|
67
69
|
abi: any;
|
|
68
70
|
}): Promise<bigint>;
|
|
@@ -77,6 +79,12 @@ declare class DefaultSolanaWalletAdapter extends BaseWalletAdapter<SolanaAdapter
|
|
|
77
79
|
callOnChain(chain: API.NetworkInfos, address: string, method: string, params: any[], options: {
|
|
78
80
|
abi: any;
|
|
79
81
|
}): Promise<any>;
|
|
82
|
+
estimateGasFee(contractAddress: string, method: string, payload: {
|
|
83
|
+
from: string;
|
|
84
|
+
to?: string;
|
|
85
|
+
data: any[];
|
|
86
|
+
value?: bigint;
|
|
87
|
+
}): Promise<bigint>;
|
|
80
88
|
pollTransactionReceiptWithBackoff(txHash: string, baseInterval?: number, maxInterval?: number, maxRetries?: number): Promise<any>;
|
|
81
89
|
}
|
|
82
90
|
|
package/dist/index.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ declare global {
|
|
|
10
10
|
};
|
|
11
11
|
}
|
|
12
12
|
}
|
|
13
|
-
declare const _default: "2.
|
|
13
|
+
declare const _default: "2.10.0-alpha.0";
|
|
14
14
|
|
|
15
15
|
interface SolanaAdapterOption {
|
|
16
16
|
provider: SolanaWalletProvider;
|
|
@@ -63,6 +63,8 @@ declare class DefaultSolanaWalletAdapter extends BaseWalletAdapter<SolanaAdapter
|
|
|
63
63
|
domain: SignatureDomain;
|
|
64
64
|
}>;
|
|
65
65
|
getBalance(): Promise<bigint>;
|
|
66
|
+
getBalances(addresses: string[]): Promise<bigint[]>;
|
|
67
|
+
getBalanceByAddress(address: string): Promise<bigint>;
|
|
66
68
|
call(address: string, method: string, params: any[], options?: {
|
|
67
69
|
abi: any;
|
|
68
70
|
}): Promise<bigint>;
|
|
@@ -77,6 +79,12 @@ declare class DefaultSolanaWalletAdapter extends BaseWalletAdapter<SolanaAdapter
|
|
|
77
79
|
callOnChain(chain: API.NetworkInfos, address: string, method: string, params: any[], options: {
|
|
78
80
|
abi: any;
|
|
79
81
|
}): Promise<any>;
|
|
82
|
+
estimateGasFee(contractAddress: string, method: string, payload: {
|
|
83
|
+
from: string;
|
|
84
|
+
to?: string;
|
|
85
|
+
data: any[];
|
|
86
|
+
value?: bigint;
|
|
87
|
+
}): Promise<bigint>;
|
|
80
88
|
pollTransactionReceiptWithBackoff(txHash: string, baseInterval?: number, maxInterval?: number, maxRetries?: number): Promise<any>;
|
|
81
89
|
}
|
|
82
90
|
|
package/dist/index.js
CHANGED
|
@@ -76,9 +76,9 @@ module.exports = __toCommonJS(index_exports);
|
|
|
76
76
|
// src/version.ts
|
|
77
77
|
if (typeof window !== "undefined") {
|
|
78
78
|
window.__ORDERLY_VERSION__ = window.__ORDERLY_VERSION__ || {};
|
|
79
|
-
window.__ORDERLY_VERSION__["@orderly.network/default-solana-adapter"] = "2.
|
|
79
|
+
window.__ORDERLY_VERSION__["@orderly.network/default-solana-adapter"] = "2.10.0-alpha.0";
|
|
80
80
|
}
|
|
81
|
-
var version_default = "2.
|
|
81
|
+
var version_default = "2.10.0-alpha.0";
|
|
82
82
|
|
|
83
83
|
// src/walletAdapter.ts
|
|
84
84
|
var ed = __toESM(require("@noble/ed25519"));
|
|
@@ -3018,10 +3018,6 @@ function getDepositQuoteFee(_0) {
|
|
|
3018
3018
|
}
|
|
3019
3019
|
const encodedReturnData = returnLogEntry.slice(returnPrefix.length);
|
|
3020
3020
|
const decodedBuffer = Buffer.from(encodedReturnData, "base64");
|
|
3021
|
-
console.log(
|
|
3022
|
-
decodedBuffer.readBigUInt64LE(0),
|
|
3023
|
-
decodedBuffer.readBigUInt64LE(1)
|
|
3024
|
-
);
|
|
3025
3021
|
return decodedBuffer.readBigUInt64LE(0);
|
|
3026
3022
|
});
|
|
3027
3023
|
}
|
|
@@ -3555,19 +3551,69 @@ var DefaultSolanaWalletAdapter = class extends import_core2.BaseWalletAdapter {
|
|
|
3555
3551
|
return BigInt(lamports);
|
|
3556
3552
|
});
|
|
3557
3553
|
}
|
|
3558
|
-
|
|
3554
|
+
getBalances(addresses) {
|
|
3559
3555
|
return __async(this, null, function* () {
|
|
3560
|
-
|
|
3561
|
-
|
|
3562
|
-
|
|
3563
|
-
|
|
3564
|
-
|
|
3565
|
-
|
|
3556
|
+
const userPublicKey = new import_web34.PublicKey(this._address);
|
|
3557
|
+
const connection = this.connection;
|
|
3558
|
+
const isNativeToken = addresses.map(
|
|
3559
|
+
(address) => (0, import_types2.isNativeTokenChecker)(address)
|
|
3560
|
+
);
|
|
3561
|
+
const hasNativeSOL = addresses.some(
|
|
3562
|
+
(address) => (0, import_types2.isNativeTokenChecker)(address)
|
|
3563
|
+
);
|
|
3564
|
+
let nativeSolBalance = null;
|
|
3565
|
+
if (hasNativeSOL) {
|
|
3566
|
+
nativeSolBalance = yield this.getBalance();
|
|
3567
|
+
}
|
|
3568
|
+
const splTokenAddresses = addresses.filter(
|
|
3569
|
+
(address) => !(0, import_types2.isNativeTokenChecker)(address)
|
|
3570
|
+
);
|
|
3571
|
+
let splTokenBalances = [];
|
|
3572
|
+
if (splTokenAddresses.length > 0) {
|
|
3573
|
+
const tokenPublicKeys = splTokenAddresses.map(
|
|
3574
|
+
(address) => new import_web34.PublicKey(address)
|
|
3575
|
+
);
|
|
3576
|
+
const userTokenAccounts = tokenPublicKeys.map(
|
|
3577
|
+
(tokenPublicKey) => getTokenAccounts(tokenPublicKey, userPublicKey)
|
|
3578
|
+
);
|
|
3579
|
+
const tokenAmount = yield (0, import_spl_token2.getMultipleAccounts)(
|
|
3566
3580
|
connection,
|
|
3567
|
-
|
|
3581
|
+
userTokenAccounts,
|
|
3568
3582
|
"confirmed"
|
|
3569
3583
|
);
|
|
3570
|
-
|
|
3584
|
+
splTokenBalances = tokenAmount.map((item) => item.amount);
|
|
3585
|
+
}
|
|
3586
|
+
const results = [];
|
|
3587
|
+
let splIndex = 0;
|
|
3588
|
+
for (let i = 0; i < addresses.length; i++) {
|
|
3589
|
+
if (isNativeToken[i]) {
|
|
3590
|
+
results.push(nativeSolBalance);
|
|
3591
|
+
} else {
|
|
3592
|
+
results.push(splTokenBalances[splIndex]);
|
|
3593
|
+
splIndex++;
|
|
3594
|
+
}
|
|
3595
|
+
}
|
|
3596
|
+
return results;
|
|
3597
|
+
});
|
|
3598
|
+
}
|
|
3599
|
+
getBalanceByAddress(address) {
|
|
3600
|
+
return __async(this, null, function* () {
|
|
3601
|
+
const tokenPublicKey = new import_web34.PublicKey(address);
|
|
3602
|
+
const userPublicKey = new import_web34.PublicKey(this._address);
|
|
3603
|
+
const userTokenAccount = getTokenAccounts(tokenPublicKey, userPublicKey);
|
|
3604
|
+
const connection = this.connection;
|
|
3605
|
+
const tokenAmount = yield (0, import_spl_token2.getAccount)(
|
|
3606
|
+
connection,
|
|
3607
|
+
userTokenAccount,
|
|
3608
|
+
"confirmed"
|
|
3609
|
+
);
|
|
3610
|
+
return tokenAmount.amount;
|
|
3611
|
+
});
|
|
3612
|
+
}
|
|
3613
|
+
call(address, method, params, options) {
|
|
3614
|
+
return __async(this, null, function* () {
|
|
3615
|
+
if (method === "balanceOf") {
|
|
3616
|
+
return this.getBalanceByAddress(address);
|
|
3571
3617
|
}
|
|
3572
3618
|
if (method === "allowance") {
|
|
3573
3619
|
return import_types2.MaxUint256;
|
|
@@ -3613,6 +3659,11 @@ var DefaultSolanaWalletAdapter = class extends import_core2.BaseWalletAdapter {
|
|
|
3613
3659
|
return 0;
|
|
3614
3660
|
});
|
|
3615
3661
|
}
|
|
3662
|
+
estimateGasFee(contractAddress, method, payload) {
|
|
3663
|
+
return __async(this, null, function* () {
|
|
3664
|
+
return BigInt(0);
|
|
3665
|
+
});
|
|
3666
|
+
}
|
|
3616
3667
|
pollTransactionReceiptWithBackoff(txHash, baseInterval, maxInterval, maxRetries) {
|
|
3617
3668
|
return __async(this, null, function* () {
|
|
3618
3669
|
return Promise.resolve({ status: 1 });
|