@weblock-wallet/sdk 0.1.36 → 0.1.38
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 +11 -62
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +0 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +12 -63
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -426,7 +426,6 @@ declare class WeBlockSDK {
|
|
|
426
426
|
onWalletUpdate: (callback: (wallet: WalletInfo) => void) => (() => void);
|
|
427
427
|
onTransactionUpdate: (callback: (tx: Transaction | undefined) => void) => (() => void);
|
|
428
428
|
getBalance: (address: string, chainId: number) => Promise<TokenBalance>;
|
|
429
|
-
getTokenBalance: (tokenAddress: string, walletAddress: string, chainId: number) => Promise<TokenBalance>;
|
|
430
429
|
getTransactionCount: (address: string, chainId: number) => Promise<number>;
|
|
431
430
|
getBlockNumber: (chainId: number) => Promise<number>;
|
|
432
431
|
sendRawTransaction: (signedTx: string, chainId: number) => Promise<string>;
|
package/dist/index.d.ts
CHANGED
|
@@ -426,7 +426,6 @@ declare class WeBlockSDK {
|
|
|
426
426
|
onWalletUpdate: (callback: (wallet: WalletInfo) => void) => (() => void);
|
|
427
427
|
onTransactionUpdate: (callback: (tx: Transaction | undefined) => void) => (() => void);
|
|
428
428
|
getBalance: (address: string, chainId: number) => Promise<TokenBalance>;
|
|
429
|
-
getTokenBalance: (tokenAddress: string, walletAddress: string, chainId: number) => Promise<TokenBalance>;
|
|
430
429
|
getTransactionCount: (address: string, chainId: number) => Promise<number>;
|
|
431
430
|
getBlockNumber: (chainId: number) => Promise<number>;
|
|
432
431
|
sendRawTransaction: (signedTx: string, chainId: number) => Promise<string>;
|
package/dist/index.js
CHANGED
|
@@ -1890,7 +1890,7 @@ var AuthService = class {
|
|
|
1890
1890
|
};
|
|
1891
1891
|
|
|
1892
1892
|
// src/core/services/wallet.ts
|
|
1893
|
-
import {
|
|
1893
|
+
import { Wallet, Interface } from "ethers";
|
|
1894
1894
|
import { generateMnemonic, mnemonicToSeed } from "bip39";
|
|
1895
1895
|
|
|
1896
1896
|
// src/utils/secrets.ts
|
|
@@ -104316,7 +104316,6 @@ var WalletService = class {
|
|
|
104316
104316
|
async getTokenBalance(tokenAddress, walletAddress, chainId) {
|
|
104317
104317
|
const erc20 = new Interface(ERC20_ABI);
|
|
104318
104318
|
const data = erc20.encodeFunctionData("balanceOf", [walletAddress]);
|
|
104319
|
-
console.log("getTokenBalance data:", data);
|
|
104320
104319
|
const rawBalance = await this.rpcClient.sendRpc({
|
|
104321
104320
|
chainId,
|
|
104322
104321
|
method: "eth_call" /* ETH_CALL */,
|
|
@@ -104328,9 +104327,7 @@ var WalletService = class {
|
|
|
104328
104327
|
"latest"
|
|
104329
104328
|
]
|
|
104330
104329
|
});
|
|
104331
|
-
console.log("getTokenBalance rawBalance:", rawBalance);
|
|
104332
104330
|
const decimalsData = erc20.encodeFunctionData("decimals", []);
|
|
104333
|
-
console.log("getTokenBalance decimalsData:", decimalsData);
|
|
104334
104331
|
const decimalsRes = await this.rpcClient.sendRpc({
|
|
104335
104332
|
chainId,
|
|
104336
104333
|
method: "eth_call" /* ETH_CALL */,
|
|
@@ -104342,11 +104339,8 @@ var WalletService = class {
|
|
|
104342
104339
|
"latest"
|
|
104343
104340
|
]
|
|
104344
104341
|
});
|
|
104345
|
-
console.log("getTokenBalance decimalsRes:", decimalsRes);
|
|
104346
104342
|
const decimals = parseInt(decimalsRes.result, 16);
|
|
104347
|
-
console.log("getTokenBalance decimals:", decimals);
|
|
104348
104343
|
const symbolData = erc20.encodeFunctionData("symbol", []);
|
|
104349
|
-
console.log("getTokenBalance symbolData:", symbolData);
|
|
104350
104344
|
const symbolRes = await this.rpcClient.sendRpc({
|
|
104351
104345
|
chainId,
|
|
104352
104346
|
method: "eth_call" /* ETH_CALL */,
|
|
@@ -104358,9 +104352,7 @@ var WalletService = class {
|
|
|
104358
104352
|
"latest"
|
|
104359
104353
|
]
|
|
104360
104354
|
});
|
|
104361
|
-
console.log("getTokenBalance symbolRes:", symbolRes);
|
|
104362
104355
|
const symbol = erc20.decodeFunctionResult("symbol", symbolRes.result)[0];
|
|
104363
|
-
console.log("getTokenBalance symbol:", symbol);
|
|
104364
104356
|
return {
|
|
104365
104357
|
raw: rawBalance.result,
|
|
104366
104358
|
formatted: TokenAmount.format(rawBalance.result, decimals),
|
|
@@ -106132,31 +106124,31 @@ var WalletModule = class {
|
|
|
106132
106124
|
address,
|
|
106133
106125
|
network.chainId
|
|
106134
106126
|
);
|
|
106135
|
-
console.log("\uB124\uC774\uD2F0\uBE0C \
|
|
106136
|
-
const wftBalance = await this.core.wallet.getTokenBalance(
|
|
106137
|
-
"0x6fa62Eda03956ef4E54f3C8597E8c3f3bE40A45B",
|
|
106138
|
-
address,
|
|
106139
|
-
network.chainId
|
|
106140
|
-
);
|
|
106141
|
-
console.log(">>>> wftBalance: ", wftBalance);
|
|
106127
|
+
console.log("\uB124\uC774\uD2F0\uBE0C \uCF54\uC778 \uC794\uC561:", nativeBalance);
|
|
106142
106128
|
const rbtBalance = await this.core.wallet.getTokenBalance(
|
|
106143
106129
|
"0xB10536cC40Cb6E6415f70d3a4C1AF7Fa638AE829",
|
|
106144
106130
|
address,
|
|
106145
106131
|
network.chainId
|
|
106146
106132
|
);
|
|
106147
|
-
console.log("
|
|
106133
|
+
console.log("RBT \uC794\uC561:", rbtBalance);
|
|
106148
106134
|
const usdrBalance = await this.core.wallet.getTokenBalance(
|
|
106149
106135
|
"0x8d335fe5B30e27F2B21F057a4766cf4BB8c30785",
|
|
106150
106136
|
address,
|
|
106151
106137
|
network.chainId
|
|
106152
106138
|
);
|
|
106153
|
-
console.log("
|
|
106139
|
+
console.log("USDR \uC794\uC561:", usdrBalance);
|
|
106140
|
+
const wftBalance = await this.core.wallet.getTokenBalance(
|
|
106141
|
+
"0x6fa62Eda03956ef4E54f3C8597E8c3f3bE40A45B",
|
|
106142
|
+
address,
|
|
106143
|
+
network.chainId
|
|
106144
|
+
);
|
|
106145
|
+
console.log("WFT \uC794\uC561:", wftBalance);
|
|
106154
106146
|
const usdtBalance = await this.core.wallet.getTokenBalance(
|
|
106155
106147
|
"0xfF54B9ebe777f528E64C74bc95c68433B7546038",
|
|
106156
106148
|
address,
|
|
106157
106149
|
network.chainId
|
|
106158
106150
|
);
|
|
106159
|
-
console.log("
|
|
106151
|
+
console.log("USDT \uC794\uC561:", usdtBalance);
|
|
106160
106152
|
console.log("5. \uCD5C\uADFC \uD2B8\uB79C\uC7AD\uC158 \uC870\uD68C \uC2DC\uC791");
|
|
106161
106153
|
const latestTransaction = await this.core.wallet.getLatestTransaction(
|
|
106162
106154
|
address,
|
|
@@ -106175,40 +106167,7 @@ var WalletModule = class {
|
|
|
106175
106167
|
balance: nativeBalance,
|
|
106176
106168
|
decimals: 18
|
|
106177
106169
|
},
|
|
106178
|
-
tokens: [
|
|
106179
|
-
{
|
|
106180
|
-
symbol: wftBalance.symbol,
|
|
106181
|
-
name: "WeBlock Foundation Token",
|
|
106182
|
-
address: "0x6fa62Eda03956ef4E54f3C8597E8c3f3bE40A45B",
|
|
106183
|
-
balance: wftBalance,
|
|
106184
|
-
decimals: wftBalance.decimals,
|
|
106185
|
-
totalSupply: wftBalance
|
|
106186
|
-
},
|
|
106187
|
-
{
|
|
106188
|
-
symbol: rbtBalance.symbol,
|
|
106189
|
-
name: "Real estate Backed Token",
|
|
106190
|
-
address: "0xB10536cC40Cb6E6415f70d3a4C1AF7Fa638AE829",
|
|
106191
|
-
balance: rbtBalance,
|
|
106192
|
-
decimals: rbtBalance.decimals,
|
|
106193
|
-
totalSupply: rbtBalance
|
|
106194
|
-
},
|
|
106195
|
-
{
|
|
106196
|
-
symbol: usdrBalance.symbol,
|
|
106197
|
-
name: "USD Real estate",
|
|
106198
|
-
address: "0x8d335fe5B30e27F2B21F057a4766cf4BB8c30785",
|
|
106199
|
-
balance: usdrBalance,
|
|
106200
|
-
decimals: usdrBalance.decimals,
|
|
106201
|
-
totalSupply: usdrBalance
|
|
106202
|
-
},
|
|
106203
|
-
{
|
|
106204
|
-
symbol: usdtBalance.symbol,
|
|
106205
|
-
name: "Temp USDT",
|
|
106206
|
-
address: "0xfF54B9ebe777f528E64C74bc95c68433B7546038",
|
|
106207
|
-
balance: usdtBalance,
|
|
106208
|
-
decimals: usdtBalance.decimals,
|
|
106209
|
-
totalSupply: usdtBalance
|
|
106210
|
-
}
|
|
106211
|
-
],
|
|
106170
|
+
tokens: [],
|
|
106212
106171
|
nfts: [],
|
|
106213
106172
|
securities: []
|
|
106214
106173
|
},
|
|
@@ -106228,9 +106187,6 @@ var WalletModule = class {
|
|
|
106228
106187
|
async getBalance(address, chainId) {
|
|
106229
106188
|
return this.core.wallet.getBalance(address, chainId);
|
|
106230
106189
|
}
|
|
106231
|
-
async getTokenBalance(address, tokenAddress, chainId) {
|
|
106232
|
-
return this.core.wallet.getTokenBalance(address, tokenAddress, chainId);
|
|
106233
|
-
}
|
|
106234
106190
|
async getTransactionCount(address, chainId) {
|
|
106235
106191
|
return this.core.wallet.getTransactionCount(address, chainId);
|
|
106236
106192
|
}
|
|
@@ -106410,13 +106366,6 @@ var WeBlockSDK = class {
|
|
|
106410
106366
|
getBalance: (address, chainId) => {
|
|
106411
106367
|
return this.walletModule.getBalance(address, chainId);
|
|
106412
106368
|
},
|
|
106413
|
-
getTokenBalance: (tokenAddress, walletAddress, chainId) => {
|
|
106414
|
-
return this.walletModule.getTokenBalance(
|
|
106415
|
-
tokenAddress,
|
|
106416
|
-
walletAddress,
|
|
106417
|
-
chainId
|
|
106418
|
-
);
|
|
106419
|
-
},
|
|
106420
106369
|
getTransactionCount: (address, chainId) => {
|
|
106421
106370
|
return this.walletModule.getTransactionCount(address, chainId);
|
|
106422
106371
|
},
|