@depay/web3-wallets-evm 15.15.4 → 15.16.1
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 +1 -1
- package/dist/esm/index.evm.js +94 -32
- package/dist/esm/index.js +94 -32
- package/dist/esm/index.solana.js +94 -32
- package/dist/umd/index.evm.js +94 -32
- package/dist/umd/index.js +94 -32
- package/dist/umd/index.solana.js +94 -32
- package/package.json +1 -1
package/README.md
CHANGED
package/dist/esm/index.evm.js
CHANGED
|
@@ -42192,7 +42192,10 @@ class Transaction {
|
|
|
42192
42192
|
|
|
42193
42193
|
getContractArguments() {
|
|
42194
42194
|
let fragment = this.getContract().interface.fragments.find((fragment) => {
|
|
42195
|
-
return
|
|
42195
|
+
return(
|
|
42196
|
+
fragment.name == this.method &&
|
|
42197
|
+
fragment.inputs.length == this.params.length
|
|
42198
|
+
)
|
|
42196
42199
|
});
|
|
42197
42200
|
|
|
42198
42201
|
if(this.params instanceof Array) {
|
|
@@ -43563,11 +43566,25 @@ class WindowEthereum {
|
|
|
43563
43566
|
}
|
|
43564
43567
|
|
|
43565
43568
|
async sign(message) {
|
|
43566
|
-
|
|
43567
|
-
|
|
43568
|
-
|
|
43569
|
-
|
|
43570
|
-
|
|
43569
|
+
if(typeof message === 'object') {
|
|
43570
|
+
let provider = this.getProvider();
|
|
43571
|
+
let account = await this.account();
|
|
43572
|
+
if((await this.connectedTo(Blockchains.findByNetworkId(message.domain.chainId).name)) === false) {
|
|
43573
|
+
throw({ code: 'WRONG_NETWORK' })
|
|
43574
|
+
}
|
|
43575
|
+
let signature = await provider.request({
|
|
43576
|
+
method: 'eth_signTypedData_v4',
|
|
43577
|
+
params: [account, message],
|
|
43578
|
+
from: account,
|
|
43579
|
+
});
|
|
43580
|
+
return signature
|
|
43581
|
+
} else if (typeof message === 'string') {
|
|
43582
|
+
await this.account();
|
|
43583
|
+
let provider = new ethers.providers.Web3Provider(this.getProvider(), 'any');
|
|
43584
|
+
let signer = provider.getSigner(0);
|
|
43585
|
+
let signature = await signer.signMessage(message);
|
|
43586
|
+
return signature
|
|
43587
|
+
}
|
|
43571
43588
|
}
|
|
43572
43589
|
} WindowEthereum.__initStatic(); WindowEthereum.__initStatic2();
|
|
43573
43590
|
|
|
@@ -44381,13 +44398,26 @@ class WalletConnectV1 {
|
|
|
44381
44398
|
}
|
|
44382
44399
|
|
|
44383
44400
|
async sign(message) {
|
|
44384
|
-
|
|
44385
|
-
|
|
44386
|
-
|
|
44387
|
-
|
|
44388
|
-
|
|
44389
|
-
|
|
44390
|
-
|
|
44401
|
+
if(typeof message === 'object') {
|
|
44402
|
+
let account = await this.account();
|
|
44403
|
+
if((await this.connectedTo(Blockchains.findByNetworkId(message.domain.chainId).name)) === false) {
|
|
44404
|
+
throw({ code: 'WRONG_NETWORK' })
|
|
44405
|
+
}
|
|
44406
|
+
let signature = await this.connector.sendCustomRequest({
|
|
44407
|
+
jsonrpc: '2.0',
|
|
44408
|
+
method: 'eth_signTypedData_v4',
|
|
44409
|
+
params: [account, JSON.stringify(message)],
|
|
44410
|
+
});
|
|
44411
|
+
return signature
|
|
44412
|
+
} else if (typeof message === 'string') {
|
|
44413
|
+
let blockchain = await this.connectedTo();
|
|
44414
|
+
let address = await this.account();
|
|
44415
|
+
const smartContractWallet = await getSmartContractWallet(blockchain, address);
|
|
44416
|
+
if(smartContractWallet){ throw({ message: 'Smart contract wallets are not supported for signing!', code: "SMART_CONTRACT_WALLET_NOT_SUPPORTED" }) }
|
|
44417
|
+
var params = [ethers.utils.toUtf8Bytes(message), address];
|
|
44418
|
+
let signature = await this.connector.signPersonalMessage(params);
|
|
44419
|
+
return signature
|
|
44420
|
+
}
|
|
44391
44421
|
}
|
|
44392
44422
|
} WalletConnectV1.__initStatic(); WalletConnectV1.__initStatic2();
|
|
44393
44423
|
|
|
@@ -44559,6 +44589,7 @@ const getWalletConnectV2Config = ()=>{
|
|
|
44559
44589
|
const methods = [
|
|
44560
44590
|
"eth_sendTransaction",
|
|
44561
44591
|
"personal_sign",
|
|
44592
|
+
"eth_signTypedData_v4",
|
|
44562
44593
|
"eth_chainId",
|
|
44563
44594
|
"eth_accounts",
|
|
44564
44595
|
"wallet_switchEthereumChain",
|
|
@@ -44782,22 +44813,39 @@ class WalletConnectV2 {
|
|
|
44782
44813
|
}
|
|
44783
44814
|
|
|
44784
44815
|
async sign(message) {
|
|
44785
|
-
|
|
44786
|
-
|
|
44787
|
-
|
|
44788
|
-
|
|
44789
|
-
|
|
44790
|
-
|
|
44791
|
-
|
|
44792
|
-
|
|
44793
|
-
|
|
44794
|
-
|
|
44816
|
+
if(typeof message === 'object') {
|
|
44817
|
+
let account = await this.account();
|
|
44818
|
+
const blockchain = Blockchains.findByNetworkId(message.domain.chainId);
|
|
44819
|
+
if((await this.connectedTo(blockchain.name)) === false) {
|
|
44820
|
+
throw({ code: 'WRONG_NETWORK' })
|
|
44821
|
+
}
|
|
44822
|
+
let signature = await this.signClient.request({
|
|
44823
|
+
topic: this.session.topic,
|
|
44824
|
+
chainId: `${blockchain.namespace}:${blockchain.networkId}`,
|
|
44825
|
+
request:{
|
|
44826
|
+
method: 'eth_signTypedData_v4',
|
|
44827
|
+
params: [account, JSON.stringify(message)],
|
|
44828
|
+
}
|
|
44829
|
+
});
|
|
44830
|
+
return signature
|
|
44831
|
+
} else if (typeof message === 'string') {
|
|
44832
|
+
const address = await this.account();
|
|
44833
|
+
const params = [ethers.utils.hexlify(ethers.utils.toUtf8Bytes(message)), address];
|
|
44834
|
+
const connectedChainId = await getConnectedChainId(this.signClient, this.session);
|
|
44835
|
+
const blockchain = Blockchains.findById(connectedChainId);
|
|
44836
|
+
let signature = await this.signClient.request({
|
|
44837
|
+
topic: this.session.topic,
|
|
44838
|
+
chainId: `${blockchain.namespace}:${blockchain.networkId}`,
|
|
44839
|
+
request:{
|
|
44840
|
+
method: 'personal_sign',
|
|
44841
|
+
params
|
|
44842
|
+
}
|
|
44843
|
+
});
|
|
44844
|
+
if(typeof signature == 'object') {
|
|
44845
|
+
signature = ethers.utils.hexlify(signature);
|
|
44795
44846
|
}
|
|
44796
|
-
|
|
44797
|
-
if(typeof signature == 'object') {
|
|
44798
|
-
signature = ethers.utils.hexlify(signature);
|
|
44847
|
+
return signature
|
|
44799
44848
|
}
|
|
44800
|
-
return signature
|
|
44801
44849
|
}
|
|
44802
44850
|
} WalletConnectV2.__initStatic(); WalletConnectV2.__initStatic2();
|
|
44803
44851
|
|
|
@@ -45015,11 +45063,25 @@ class WalletLink {
|
|
|
45015
45063
|
}
|
|
45016
45064
|
|
|
45017
45065
|
async sign(message) {
|
|
45018
|
-
|
|
45019
|
-
|
|
45020
|
-
|
|
45021
|
-
|
|
45022
|
-
|
|
45066
|
+
if(typeof message === 'object') {
|
|
45067
|
+
let provider = this.connector;
|
|
45068
|
+
let account = await this.account();
|
|
45069
|
+
if((await this.connectedTo(Blockchains.findByNetworkId(message.domain.chainId).name)) === false) {
|
|
45070
|
+
throw({ code: 'WRONG_NETWORK' })
|
|
45071
|
+
}
|
|
45072
|
+
let signature = await provider.request({
|
|
45073
|
+
method: 'eth_signTypedData_v4',
|
|
45074
|
+
params: [account, message],
|
|
45075
|
+
from: account,
|
|
45076
|
+
});
|
|
45077
|
+
return signature
|
|
45078
|
+
} else if (typeof message === 'string') {
|
|
45079
|
+
await this.account();
|
|
45080
|
+
let provider = new ethers.providers.Web3Provider(this.connector, 'any');
|
|
45081
|
+
let signer = provider.getSigner(0);
|
|
45082
|
+
let signature = await signer.signMessage(message);
|
|
45083
|
+
return signature
|
|
45084
|
+
}
|
|
45023
45085
|
}
|
|
45024
45086
|
} WalletLink.__initStatic(); WalletLink.__initStatic2();
|
|
45025
45087
|
|
package/dist/esm/index.js
CHANGED
|
@@ -63,7 +63,10 @@ class Transaction {
|
|
|
63
63
|
|
|
64
64
|
getContractArguments() {
|
|
65
65
|
let fragment = this.getContract().interface.fragments.find((fragment) => {
|
|
66
|
-
return
|
|
66
|
+
return(
|
|
67
|
+
fragment.name == this.method &&
|
|
68
|
+
fragment.inputs.length == this.params.length
|
|
69
|
+
)
|
|
67
70
|
});
|
|
68
71
|
|
|
69
72
|
if(this.params instanceof Array) {
|
|
@@ -598,11 +601,25 @@ class WindowEthereum {
|
|
|
598
601
|
}
|
|
599
602
|
|
|
600
603
|
async sign(message) {
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
604
|
+
if(typeof message === 'object') {
|
|
605
|
+
let provider = this.getProvider();
|
|
606
|
+
let account = await this.account();
|
|
607
|
+
if((await this.connectedTo(Blockchains.findByNetworkId(message.domain.chainId).name)) === false) {
|
|
608
|
+
throw({ code: 'WRONG_NETWORK' })
|
|
609
|
+
}
|
|
610
|
+
let signature = await provider.request({
|
|
611
|
+
method: 'eth_signTypedData_v4',
|
|
612
|
+
params: [account, message],
|
|
613
|
+
from: account,
|
|
614
|
+
});
|
|
615
|
+
return signature
|
|
616
|
+
} else if (typeof message === 'string') {
|
|
617
|
+
await this.account();
|
|
618
|
+
let provider = new ethers.providers.Web3Provider(this.getProvider(), 'any');
|
|
619
|
+
let signer = provider.getSigner(0);
|
|
620
|
+
let signature = await signer.signMessage(message);
|
|
621
|
+
return signature
|
|
622
|
+
}
|
|
606
623
|
}
|
|
607
624
|
} WindowEthereum.__initStatic(); WindowEthereum.__initStatic2();
|
|
608
625
|
|
|
@@ -1418,13 +1435,26 @@ class WalletConnectV1 {
|
|
|
1418
1435
|
}
|
|
1419
1436
|
|
|
1420
1437
|
async sign(message) {
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1438
|
+
if(typeof message === 'object') {
|
|
1439
|
+
let account = await this.account();
|
|
1440
|
+
if((await this.connectedTo(Blockchains.findByNetworkId(message.domain.chainId).name)) === false) {
|
|
1441
|
+
throw({ code: 'WRONG_NETWORK' })
|
|
1442
|
+
}
|
|
1443
|
+
let signature = await this.connector.sendCustomRequest({
|
|
1444
|
+
jsonrpc: '2.0',
|
|
1445
|
+
method: 'eth_signTypedData_v4',
|
|
1446
|
+
params: [account, JSON.stringify(message)],
|
|
1447
|
+
});
|
|
1448
|
+
return signature
|
|
1449
|
+
} else if (typeof message === 'string') {
|
|
1450
|
+
let blockchain = await this.connectedTo();
|
|
1451
|
+
let address = await this.account();
|
|
1452
|
+
const smartContractWallet = await getSmartContractWallet(blockchain, address);
|
|
1453
|
+
if(smartContractWallet){ throw({ message: 'Smart contract wallets are not supported for signing!', code: "SMART_CONTRACT_WALLET_NOT_SUPPORTED" }) }
|
|
1454
|
+
var params = [ethers.utils.toUtf8Bytes(message), address];
|
|
1455
|
+
let signature = await this.connector.signPersonalMessage(params);
|
|
1456
|
+
return signature
|
|
1457
|
+
}
|
|
1428
1458
|
}
|
|
1429
1459
|
} WalletConnectV1.__initStatic(); WalletConnectV1.__initStatic2();
|
|
1430
1460
|
|
|
@@ -1596,6 +1626,7 @@ const getWalletConnectV2Config = ()=>{
|
|
|
1596
1626
|
const methods = [
|
|
1597
1627
|
"eth_sendTransaction",
|
|
1598
1628
|
"personal_sign",
|
|
1629
|
+
"eth_signTypedData_v4",
|
|
1599
1630
|
"eth_chainId",
|
|
1600
1631
|
"eth_accounts",
|
|
1601
1632
|
"wallet_switchEthereumChain",
|
|
@@ -1819,22 +1850,39 @@ class WalletConnectV2 {
|
|
|
1819
1850
|
}
|
|
1820
1851
|
|
|
1821
1852
|
async sign(message) {
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
topic: this.session.topic,
|
|
1828
|
-
chainId: `${blockchain.namespace}:${blockchain.networkId}`,
|
|
1829
|
-
request:{
|
|
1830
|
-
method: 'personal_sign',
|
|
1831
|
-
params
|
|
1853
|
+
if(typeof message === 'object') {
|
|
1854
|
+
let account = await this.account();
|
|
1855
|
+
const blockchain = Blockchains.findByNetworkId(message.domain.chainId);
|
|
1856
|
+
if((await this.connectedTo(blockchain.name)) === false) {
|
|
1857
|
+
throw({ code: 'WRONG_NETWORK' })
|
|
1832
1858
|
}
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1859
|
+
let signature = await this.signClient.request({
|
|
1860
|
+
topic: this.session.topic,
|
|
1861
|
+
chainId: `${blockchain.namespace}:${blockchain.networkId}`,
|
|
1862
|
+
request:{
|
|
1863
|
+
method: 'eth_signTypedData_v4',
|
|
1864
|
+
params: [account, JSON.stringify(message)],
|
|
1865
|
+
}
|
|
1866
|
+
});
|
|
1867
|
+
return signature
|
|
1868
|
+
} else if (typeof message === 'string') {
|
|
1869
|
+
const address = await this.account();
|
|
1870
|
+
const params = [ethers.utils.hexlify(ethers.utils.toUtf8Bytes(message)), address];
|
|
1871
|
+
const connectedChainId = await getConnectedChainId(this.signClient, this.session);
|
|
1872
|
+
const blockchain = Blockchains.findById(connectedChainId);
|
|
1873
|
+
let signature = await this.signClient.request({
|
|
1874
|
+
topic: this.session.topic,
|
|
1875
|
+
chainId: `${blockchain.namespace}:${blockchain.networkId}`,
|
|
1876
|
+
request:{
|
|
1877
|
+
method: 'personal_sign',
|
|
1878
|
+
params
|
|
1879
|
+
}
|
|
1880
|
+
});
|
|
1881
|
+
if(typeof signature == 'object') {
|
|
1882
|
+
signature = ethers.utils.hexlify(signature);
|
|
1883
|
+
}
|
|
1884
|
+
return signature
|
|
1836
1885
|
}
|
|
1837
|
-
return signature
|
|
1838
1886
|
}
|
|
1839
1887
|
} WalletConnectV2.__initStatic(); WalletConnectV2.__initStatic2();
|
|
1840
1888
|
|
|
@@ -2052,11 +2100,25 @@ class WalletLink {
|
|
|
2052
2100
|
}
|
|
2053
2101
|
|
|
2054
2102
|
async sign(message) {
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2103
|
+
if(typeof message === 'object') {
|
|
2104
|
+
let provider = this.connector;
|
|
2105
|
+
let account = await this.account();
|
|
2106
|
+
if((await this.connectedTo(Blockchains.findByNetworkId(message.domain.chainId).name)) === false) {
|
|
2107
|
+
throw({ code: 'WRONG_NETWORK' })
|
|
2108
|
+
}
|
|
2109
|
+
let signature = await provider.request({
|
|
2110
|
+
method: 'eth_signTypedData_v4',
|
|
2111
|
+
params: [account, message],
|
|
2112
|
+
from: account,
|
|
2113
|
+
});
|
|
2114
|
+
return signature
|
|
2115
|
+
} else if (typeof message === 'string') {
|
|
2116
|
+
await this.account();
|
|
2117
|
+
let provider = new ethers.providers.Web3Provider(this.connector, 'any');
|
|
2118
|
+
let signer = provider.getSigner(0);
|
|
2119
|
+
let signature = await signer.signMessage(message);
|
|
2120
|
+
return signature
|
|
2121
|
+
}
|
|
2060
2122
|
}
|
|
2061
2123
|
} WalletLink.__initStatic(); WalletLink.__initStatic2();
|
|
2062
2124
|
|
package/dist/esm/index.solana.js
CHANGED
|
@@ -63,7 +63,10 @@ class Transaction {
|
|
|
63
63
|
|
|
64
64
|
getContractArguments() {
|
|
65
65
|
let fragment = this.getContract().interface.fragments.find((fragment) => {
|
|
66
|
-
return
|
|
66
|
+
return(
|
|
67
|
+
fragment.name == this.method &&
|
|
68
|
+
fragment.inputs.length == this.params.length
|
|
69
|
+
)
|
|
67
70
|
});
|
|
68
71
|
|
|
69
72
|
if(this.params instanceof Array) {
|
|
@@ -1434,11 +1437,25 @@ class WindowEthereum {
|
|
|
1434
1437
|
}
|
|
1435
1438
|
|
|
1436
1439
|
async sign(message) {
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1440
|
+
if(typeof message === 'object') {
|
|
1441
|
+
let provider = this.getProvider();
|
|
1442
|
+
let account = await this.account();
|
|
1443
|
+
if((await this.connectedTo(Blockchains.findByNetworkId(message.domain.chainId).name)) === false) {
|
|
1444
|
+
throw({ code: 'WRONG_NETWORK' })
|
|
1445
|
+
}
|
|
1446
|
+
let signature = await provider.request({
|
|
1447
|
+
method: 'eth_signTypedData_v4',
|
|
1448
|
+
params: [account, message],
|
|
1449
|
+
from: account,
|
|
1450
|
+
});
|
|
1451
|
+
return signature
|
|
1452
|
+
} else if (typeof message === 'string') {
|
|
1453
|
+
await this.account();
|
|
1454
|
+
let provider = new ethers.providers.Web3Provider(this.getProvider(), 'any');
|
|
1455
|
+
let signer = provider.getSigner(0);
|
|
1456
|
+
let signature = await signer.signMessage(message);
|
|
1457
|
+
return signature
|
|
1458
|
+
}
|
|
1442
1459
|
}
|
|
1443
1460
|
} WindowEthereum.__initStatic(); WindowEthereum.__initStatic2();
|
|
1444
1461
|
|
|
@@ -2254,13 +2271,26 @@ class WalletConnectV1 {
|
|
|
2254
2271
|
}
|
|
2255
2272
|
|
|
2256
2273
|
async sign(message) {
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
2274
|
+
if(typeof message === 'object') {
|
|
2275
|
+
let account = await this.account();
|
|
2276
|
+
if((await this.connectedTo(Blockchains.findByNetworkId(message.domain.chainId).name)) === false) {
|
|
2277
|
+
throw({ code: 'WRONG_NETWORK' })
|
|
2278
|
+
}
|
|
2279
|
+
let signature = await this.connector.sendCustomRequest({
|
|
2280
|
+
jsonrpc: '2.0',
|
|
2281
|
+
method: 'eth_signTypedData_v4',
|
|
2282
|
+
params: [account, JSON.stringify(message)],
|
|
2283
|
+
});
|
|
2284
|
+
return signature
|
|
2285
|
+
} else if (typeof message === 'string') {
|
|
2286
|
+
let blockchain = await this.connectedTo();
|
|
2287
|
+
let address = await this.account();
|
|
2288
|
+
const smartContractWallet = await getSmartContractWallet(blockchain, address);
|
|
2289
|
+
if(smartContractWallet){ throw({ message: 'Smart contract wallets are not supported for signing!', code: "SMART_CONTRACT_WALLET_NOT_SUPPORTED" }) }
|
|
2290
|
+
var params = [ethers.utils.toUtf8Bytes(message), address];
|
|
2291
|
+
let signature = await this.connector.signPersonalMessage(params);
|
|
2292
|
+
return signature
|
|
2293
|
+
}
|
|
2264
2294
|
}
|
|
2265
2295
|
} WalletConnectV1.__initStatic(); WalletConnectV1.__initStatic2();
|
|
2266
2296
|
|
|
@@ -2432,6 +2462,7 @@ const getWalletConnectV2Config = ()=>{
|
|
|
2432
2462
|
const methods = [
|
|
2433
2463
|
"eth_sendTransaction",
|
|
2434
2464
|
"personal_sign",
|
|
2465
|
+
"eth_signTypedData_v4",
|
|
2435
2466
|
"eth_chainId",
|
|
2436
2467
|
"eth_accounts",
|
|
2437
2468
|
"wallet_switchEthereumChain",
|
|
@@ -2655,22 +2686,39 @@ class WalletConnectV2 {
|
|
|
2655
2686
|
}
|
|
2656
2687
|
|
|
2657
2688
|
async sign(message) {
|
|
2658
|
-
|
|
2659
|
-
|
|
2660
|
-
|
|
2661
|
-
|
|
2662
|
-
|
|
2663
|
-
topic: this.session.topic,
|
|
2664
|
-
chainId: `${blockchain.namespace}:${blockchain.networkId}`,
|
|
2665
|
-
request:{
|
|
2666
|
-
method: 'personal_sign',
|
|
2667
|
-
params
|
|
2689
|
+
if(typeof message === 'object') {
|
|
2690
|
+
let account = await this.account();
|
|
2691
|
+
const blockchain = Blockchains.findByNetworkId(message.domain.chainId);
|
|
2692
|
+
if((await this.connectedTo(blockchain.name)) === false) {
|
|
2693
|
+
throw({ code: 'WRONG_NETWORK' })
|
|
2668
2694
|
}
|
|
2669
|
-
|
|
2670
|
-
|
|
2671
|
-
|
|
2695
|
+
let signature = await this.signClient.request({
|
|
2696
|
+
topic: this.session.topic,
|
|
2697
|
+
chainId: `${blockchain.namespace}:${blockchain.networkId}`,
|
|
2698
|
+
request:{
|
|
2699
|
+
method: 'eth_signTypedData_v4',
|
|
2700
|
+
params: [account, JSON.stringify(message)],
|
|
2701
|
+
}
|
|
2702
|
+
});
|
|
2703
|
+
return signature
|
|
2704
|
+
} else if (typeof message === 'string') {
|
|
2705
|
+
const address = await this.account();
|
|
2706
|
+
const params = [ethers.utils.hexlify(ethers.utils.toUtf8Bytes(message)), address];
|
|
2707
|
+
const connectedChainId = await getConnectedChainId(this.signClient, this.session);
|
|
2708
|
+
const blockchain = Blockchains.findById(connectedChainId);
|
|
2709
|
+
let signature = await this.signClient.request({
|
|
2710
|
+
topic: this.session.topic,
|
|
2711
|
+
chainId: `${blockchain.namespace}:${blockchain.networkId}`,
|
|
2712
|
+
request:{
|
|
2713
|
+
method: 'personal_sign',
|
|
2714
|
+
params
|
|
2715
|
+
}
|
|
2716
|
+
});
|
|
2717
|
+
if(typeof signature == 'object') {
|
|
2718
|
+
signature = ethers.utils.hexlify(signature);
|
|
2719
|
+
}
|
|
2720
|
+
return signature
|
|
2672
2721
|
}
|
|
2673
|
-
return signature
|
|
2674
2722
|
}
|
|
2675
2723
|
} WalletConnectV2.__initStatic(); WalletConnectV2.__initStatic2();
|
|
2676
2724
|
|
|
@@ -2888,11 +2936,25 @@ class WalletLink {
|
|
|
2888
2936
|
}
|
|
2889
2937
|
|
|
2890
2938
|
async sign(message) {
|
|
2891
|
-
|
|
2892
|
-
|
|
2893
|
-
|
|
2894
|
-
|
|
2895
|
-
|
|
2939
|
+
if(typeof message === 'object') {
|
|
2940
|
+
let provider = this.connector;
|
|
2941
|
+
let account = await this.account();
|
|
2942
|
+
if((await this.connectedTo(Blockchains.findByNetworkId(message.domain.chainId).name)) === false) {
|
|
2943
|
+
throw({ code: 'WRONG_NETWORK' })
|
|
2944
|
+
}
|
|
2945
|
+
let signature = await provider.request({
|
|
2946
|
+
method: 'eth_signTypedData_v4',
|
|
2947
|
+
params: [account, message],
|
|
2948
|
+
from: account,
|
|
2949
|
+
});
|
|
2950
|
+
return signature
|
|
2951
|
+
} else if (typeof message === 'string') {
|
|
2952
|
+
await this.account();
|
|
2953
|
+
let provider = new ethers.providers.Web3Provider(this.connector, 'any');
|
|
2954
|
+
let signer = provider.getSigner(0);
|
|
2955
|
+
let signature = await signer.signMessage(message);
|
|
2956
|
+
return signature
|
|
2957
|
+
}
|
|
2896
2958
|
}
|
|
2897
2959
|
} WalletLink.__initStatic(); WalletLink.__initStatic2();
|
|
2898
2960
|
|
package/dist/umd/index.evm.js
CHANGED
|
@@ -42195,7 +42195,10 @@
|
|
|
42195
42195
|
|
|
42196
42196
|
getContractArguments() {
|
|
42197
42197
|
let fragment = this.getContract().interface.fragments.find((fragment) => {
|
|
42198
|
-
return
|
|
42198
|
+
return(
|
|
42199
|
+
fragment.name == this.method &&
|
|
42200
|
+
fragment.inputs.length == this.params.length
|
|
42201
|
+
)
|
|
42199
42202
|
});
|
|
42200
42203
|
|
|
42201
42204
|
if(this.params instanceof Array) {
|
|
@@ -43566,11 +43569,25 @@
|
|
|
43566
43569
|
}
|
|
43567
43570
|
|
|
43568
43571
|
async sign(message) {
|
|
43569
|
-
|
|
43570
|
-
|
|
43571
|
-
|
|
43572
|
-
|
|
43573
|
-
|
|
43572
|
+
if(typeof message === 'object') {
|
|
43573
|
+
let provider = this.getProvider();
|
|
43574
|
+
let account = await this.account();
|
|
43575
|
+
if((await this.connectedTo(Blockchains__default['default'].findByNetworkId(message.domain.chainId).name)) === false) {
|
|
43576
|
+
throw({ code: 'WRONG_NETWORK' })
|
|
43577
|
+
}
|
|
43578
|
+
let signature = await provider.request({
|
|
43579
|
+
method: 'eth_signTypedData_v4',
|
|
43580
|
+
params: [account, message],
|
|
43581
|
+
from: account,
|
|
43582
|
+
});
|
|
43583
|
+
return signature
|
|
43584
|
+
} else if (typeof message === 'string') {
|
|
43585
|
+
await this.account();
|
|
43586
|
+
let provider = new ethers.ethers.providers.Web3Provider(this.getProvider(), 'any');
|
|
43587
|
+
let signer = provider.getSigner(0);
|
|
43588
|
+
let signature = await signer.signMessage(message);
|
|
43589
|
+
return signature
|
|
43590
|
+
}
|
|
43574
43591
|
}
|
|
43575
43592
|
} WindowEthereum.__initStatic(); WindowEthereum.__initStatic2();
|
|
43576
43593
|
|
|
@@ -44384,13 +44401,26 @@
|
|
|
44384
44401
|
}
|
|
44385
44402
|
|
|
44386
44403
|
async sign(message) {
|
|
44387
|
-
|
|
44388
|
-
|
|
44389
|
-
|
|
44390
|
-
|
|
44391
|
-
|
|
44392
|
-
|
|
44393
|
-
|
|
44404
|
+
if(typeof message === 'object') {
|
|
44405
|
+
let account = await this.account();
|
|
44406
|
+
if((await this.connectedTo(Blockchains__default['default'].findByNetworkId(message.domain.chainId).name)) === false) {
|
|
44407
|
+
throw({ code: 'WRONG_NETWORK' })
|
|
44408
|
+
}
|
|
44409
|
+
let signature = await this.connector.sendCustomRequest({
|
|
44410
|
+
jsonrpc: '2.0',
|
|
44411
|
+
method: 'eth_signTypedData_v4',
|
|
44412
|
+
params: [account, JSON.stringify(message)],
|
|
44413
|
+
});
|
|
44414
|
+
return signature
|
|
44415
|
+
} else if (typeof message === 'string') {
|
|
44416
|
+
let blockchain = await this.connectedTo();
|
|
44417
|
+
let address = await this.account();
|
|
44418
|
+
const smartContractWallet = await getSmartContractWallet(blockchain, address);
|
|
44419
|
+
if(smartContractWallet){ throw({ message: 'Smart contract wallets are not supported for signing!', code: "SMART_CONTRACT_WALLET_NOT_SUPPORTED" }) }
|
|
44420
|
+
var params = [ethers.ethers.utils.toUtf8Bytes(message), address];
|
|
44421
|
+
let signature = await this.connector.signPersonalMessage(params);
|
|
44422
|
+
return signature
|
|
44423
|
+
}
|
|
44394
44424
|
}
|
|
44395
44425
|
} WalletConnectV1.__initStatic(); WalletConnectV1.__initStatic2();
|
|
44396
44426
|
|
|
@@ -44562,6 +44592,7 @@
|
|
|
44562
44592
|
const methods = [
|
|
44563
44593
|
"eth_sendTransaction",
|
|
44564
44594
|
"personal_sign",
|
|
44595
|
+
"eth_signTypedData_v4",
|
|
44565
44596
|
"eth_chainId",
|
|
44566
44597
|
"eth_accounts",
|
|
44567
44598
|
"wallet_switchEthereumChain",
|
|
@@ -44785,22 +44816,39 @@
|
|
|
44785
44816
|
}
|
|
44786
44817
|
|
|
44787
44818
|
async sign(message) {
|
|
44788
|
-
|
|
44789
|
-
|
|
44790
|
-
|
|
44791
|
-
|
|
44792
|
-
|
|
44793
|
-
|
|
44794
|
-
|
|
44795
|
-
|
|
44796
|
-
|
|
44797
|
-
|
|
44819
|
+
if(typeof message === 'object') {
|
|
44820
|
+
let account = await this.account();
|
|
44821
|
+
const blockchain = Blockchains__default['default'].findByNetworkId(message.domain.chainId);
|
|
44822
|
+
if((await this.connectedTo(blockchain.name)) === false) {
|
|
44823
|
+
throw({ code: 'WRONG_NETWORK' })
|
|
44824
|
+
}
|
|
44825
|
+
let signature = await this.signClient.request({
|
|
44826
|
+
topic: this.session.topic,
|
|
44827
|
+
chainId: `${blockchain.namespace}:${blockchain.networkId}`,
|
|
44828
|
+
request:{
|
|
44829
|
+
method: 'eth_signTypedData_v4',
|
|
44830
|
+
params: [account, JSON.stringify(message)],
|
|
44831
|
+
}
|
|
44832
|
+
});
|
|
44833
|
+
return signature
|
|
44834
|
+
} else if (typeof message === 'string') {
|
|
44835
|
+
const address = await this.account();
|
|
44836
|
+
const params = [ethers.ethers.utils.hexlify(ethers.ethers.utils.toUtf8Bytes(message)), address];
|
|
44837
|
+
const connectedChainId = await getConnectedChainId(this.signClient, this.session);
|
|
44838
|
+
const blockchain = Blockchains__default['default'].findById(connectedChainId);
|
|
44839
|
+
let signature = await this.signClient.request({
|
|
44840
|
+
topic: this.session.topic,
|
|
44841
|
+
chainId: `${blockchain.namespace}:${blockchain.networkId}`,
|
|
44842
|
+
request:{
|
|
44843
|
+
method: 'personal_sign',
|
|
44844
|
+
params
|
|
44845
|
+
}
|
|
44846
|
+
});
|
|
44847
|
+
if(typeof signature == 'object') {
|
|
44848
|
+
signature = ethers.ethers.utils.hexlify(signature);
|
|
44798
44849
|
}
|
|
44799
|
-
|
|
44800
|
-
if(typeof signature == 'object') {
|
|
44801
|
-
signature = ethers.ethers.utils.hexlify(signature);
|
|
44850
|
+
return signature
|
|
44802
44851
|
}
|
|
44803
|
-
return signature
|
|
44804
44852
|
}
|
|
44805
44853
|
} WalletConnectV2.__initStatic(); WalletConnectV2.__initStatic2();
|
|
44806
44854
|
|
|
@@ -45018,11 +45066,25 @@
|
|
|
45018
45066
|
}
|
|
45019
45067
|
|
|
45020
45068
|
async sign(message) {
|
|
45021
|
-
|
|
45022
|
-
|
|
45023
|
-
|
|
45024
|
-
|
|
45025
|
-
|
|
45069
|
+
if(typeof message === 'object') {
|
|
45070
|
+
let provider = this.connector;
|
|
45071
|
+
let account = await this.account();
|
|
45072
|
+
if((await this.connectedTo(Blockchains__default['default'].findByNetworkId(message.domain.chainId).name)) === false) {
|
|
45073
|
+
throw({ code: 'WRONG_NETWORK' })
|
|
45074
|
+
}
|
|
45075
|
+
let signature = await provider.request({
|
|
45076
|
+
method: 'eth_signTypedData_v4',
|
|
45077
|
+
params: [account, message],
|
|
45078
|
+
from: account,
|
|
45079
|
+
});
|
|
45080
|
+
return signature
|
|
45081
|
+
} else if (typeof message === 'string') {
|
|
45082
|
+
await this.account();
|
|
45083
|
+
let provider = new ethers.ethers.providers.Web3Provider(this.connector, 'any');
|
|
45084
|
+
let signer = provider.getSigner(0);
|
|
45085
|
+
let signature = await signer.signMessage(message);
|
|
45086
|
+
return signature
|
|
45087
|
+
}
|
|
45026
45088
|
}
|
|
45027
45089
|
} WalletLink.__initStatic(); WalletLink.__initStatic2();
|
|
45028
45090
|
|
package/dist/umd/index.js
CHANGED
|
@@ -65,7 +65,10 @@
|
|
|
65
65
|
|
|
66
66
|
getContractArguments() {
|
|
67
67
|
let fragment = this.getContract().interface.fragments.find((fragment) => {
|
|
68
|
-
return
|
|
68
|
+
return(
|
|
69
|
+
fragment.name == this.method &&
|
|
70
|
+
fragment.inputs.length == this.params.length
|
|
71
|
+
)
|
|
69
72
|
});
|
|
70
73
|
|
|
71
74
|
if(this.params instanceof Array) {
|
|
@@ -600,11 +603,25 @@
|
|
|
600
603
|
}
|
|
601
604
|
|
|
602
605
|
async sign(message) {
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
606
|
+
if(typeof message === 'object') {
|
|
607
|
+
let provider = this.getProvider();
|
|
608
|
+
let account = await this.account();
|
|
609
|
+
if((await this.connectedTo(Blockchains__default['default'].findByNetworkId(message.domain.chainId).name)) === false) {
|
|
610
|
+
throw({ code: 'WRONG_NETWORK' })
|
|
611
|
+
}
|
|
612
|
+
let signature = await provider.request({
|
|
613
|
+
method: 'eth_signTypedData_v4',
|
|
614
|
+
params: [account, message],
|
|
615
|
+
from: account,
|
|
616
|
+
});
|
|
617
|
+
return signature
|
|
618
|
+
} else if (typeof message === 'string') {
|
|
619
|
+
await this.account();
|
|
620
|
+
let provider = new ethers.ethers.providers.Web3Provider(this.getProvider(), 'any');
|
|
621
|
+
let signer = provider.getSigner(0);
|
|
622
|
+
let signature = await signer.signMessage(message);
|
|
623
|
+
return signature
|
|
624
|
+
}
|
|
608
625
|
}
|
|
609
626
|
} WindowEthereum.__initStatic(); WindowEthereum.__initStatic2();
|
|
610
627
|
|
|
@@ -1420,13 +1437,26 @@
|
|
|
1420
1437
|
}
|
|
1421
1438
|
|
|
1422
1439
|
async sign(message) {
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1440
|
+
if(typeof message === 'object') {
|
|
1441
|
+
let account = await this.account();
|
|
1442
|
+
if((await this.connectedTo(Blockchains__default['default'].findByNetworkId(message.domain.chainId).name)) === false) {
|
|
1443
|
+
throw({ code: 'WRONG_NETWORK' })
|
|
1444
|
+
}
|
|
1445
|
+
let signature = await this.connector.sendCustomRequest({
|
|
1446
|
+
jsonrpc: '2.0',
|
|
1447
|
+
method: 'eth_signTypedData_v4',
|
|
1448
|
+
params: [account, JSON.stringify(message)],
|
|
1449
|
+
});
|
|
1450
|
+
return signature
|
|
1451
|
+
} else if (typeof message === 'string') {
|
|
1452
|
+
let blockchain = await this.connectedTo();
|
|
1453
|
+
let address = await this.account();
|
|
1454
|
+
const smartContractWallet = await getSmartContractWallet(blockchain, address);
|
|
1455
|
+
if(smartContractWallet){ throw({ message: 'Smart contract wallets are not supported for signing!', code: "SMART_CONTRACT_WALLET_NOT_SUPPORTED" }) }
|
|
1456
|
+
var params = [ethers.ethers.utils.toUtf8Bytes(message), address];
|
|
1457
|
+
let signature = await this.connector.signPersonalMessage(params);
|
|
1458
|
+
return signature
|
|
1459
|
+
}
|
|
1430
1460
|
}
|
|
1431
1461
|
} WalletConnectV1.__initStatic(); WalletConnectV1.__initStatic2();
|
|
1432
1462
|
|
|
@@ -1598,6 +1628,7 @@
|
|
|
1598
1628
|
const methods = [
|
|
1599
1629
|
"eth_sendTransaction",
|
|
1600
1630
|
"personal_sign",
|
|
1631
|
+
"eth_signTypedData_v4",
|
|
1601
1632
|
"eth_chainId",
|
|
1602
1633
|
"eth_accounts",
|
|
1603
1634
|
"wallet_switchEthereumChain",
|
|
@@ -1821,22 +1852,39 @@
|
|
|
1821
1852
|
}
|
|
1822
1853
|
|
|
1823
1854
|
async sign(message) {
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
topic: this.session.topic,
|
|
1830
|
-
chainId: `${blockchain.namespace}:${blockchain.networkId}`,
|
|
1831
|
-
request:{
|
|
1832
|
-
method: 'personal_sign',
|
|
1833
|
-
params
|
|
1855
|
+
if(typeof message === 'object') {
|
|
1856
|
+
let account = await this.account();
|
|
1857
|
+
const blockchain = Blockchains__default['default'].findByNetworkId(message.domain.chainId);
|
|
1858
|
+
if((await this.connectedTo(blockchain.name)) === false) {
|
|
1859
|
+
throw({ code: 'WRONG_NETWORK' })
|
|
1834
1860
|
}
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1861
|
+
let signature = await this.signClient.request({
|
|
1862
|
+
topic: this.session.topic,
|
|
1863
|
+
chainId: `${blockchain.namespace}:${blockchain.networkId}`,
|
|
1864
|
+
request:{
|
|
1865
|
+
method: 'eth_signTypedData_v4',
|
|
1866
|
+
params: [account, JSON.stringify(message)],
|
|
1867
|
+
}
|
|
1868
|
+
});
|
|
1869
|
+
return signature
|
|
1870
|
+
} else if (typeof message === 'string') {
|
|
1871
|
+
const address = await this.account();
|
|
1872
|
+
const params = [ethers.ethers.utils.hexlify(ethers.ethers.utils.toUtf8Bytes(message)), address];
|
|
1873
|
+
const connectedChainId = await getConnectedChainId(this.signClient, this.session);
|
|
1874
|
+
const blockchain = Blockchains__default['default'].findById(connectedChainId);
|
|
1875
|
+
let signature = await this.signClient.request({
|
|
1876
|
+
topic: this.session.topic,
|
|
1877
|
+
chainId: `${blockchain.namespace}:${blockchain.networkId}`,
|
|
1878
|
+
request:{
|
|
1879
|
+
method: 'personal_sign',
|
|
1880
|
+
params
|
|
1881
|
+
}
|
|
1882
|
+
});
|
|
1883
|
+
if(typeof signature == 'object') {
|
|
1884
|
+
signature = ethers.ethers.utils.hexlify(signature);
|
|
1885
|
+
}
|
|
1886
|
+
return signature
|
|
1838
1887
|
}
|
|
1839
|
-
return signature
|
|
1840
1888
|
}
|
|
1841
1889
|
} WalletConnectV2.__initStatic(); WalletConnectV2.__initStatic2();
|
|
1842
1890
|
|
|
@@ -2054,11 +2102,25 @@
|
|
|
2054
2102
|
}
|
|
2055
2103
|
|
|
2056
2104
|
async sign(message) {
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2105
|
+
if(typeof message === 'object') {
|
|
2106
|
+
let provider = this.connector;
|
|
2107
|
+
let account = await this.account();
|
|
2108
|
+
if((await this.connectedTo(Blockchains__default['default'].findByNetworkId(message.domain.chainId).name)) === false) {
|
|
2109
|
+
throw({ code: 'WRONG_NETWORK' })
|
|
2110
|
+
}
|
|
2111
|
+
let signature = await provider.request({
|
|
2112
|
+
method: 'eth_signTypedData_v4',
|
|
2113
|
+
params: [account, message],
|
|
2114
|
+
from: account,
|
|
2115
|
+
});
|
|
2116
|
+
return signature
|
|
2117
|
+
} else if (typeof message === 'string') {
|
|
2118
|
+
await this.account();
|
|
2119
|
+
let provider = new ethers.ethers.providers.Web3Provider(this.connector, 'any');
|
|
2120
|
+
let signer = provider.getSigner(0);
|
|
2121
|
+
let signature = await signer.signMessage(message);
|
|
2122
|
+
return signature
|
|
2123
|
+
}
|
|
2062
2124
|
}
|
|
2063
2125
|
} WalletLink.__initStatic(); WalletLink.__initStatic2();
|
|
2064
2126
|
|
package/dist/umd/index.solana.js
CHANGED
|
@@ -65,7 +65,10 @@
|
|
|
65
65
|
|
|
66
66
|
getContractArguments() {
|
|
67
67
|
let fragment = this.getContract().interface.fragments.find((fragment) => {
|
|
68
|
-
return
|
|
68
|
+
return(
|
|
69
|
+
fragment.name == this.method &&
|
|
70
|
+
fragment.inputs.length == this.params.length
|
|
71
|
+
)
|
|
69
72
|
});
|
|
70
73
|
|
|
71
74
|
if(this.params instanceof Array) {
|
|
@@ -1436,11 +1439,25 @@
|
|
|
1436
1439
|
}
|
|
1437
1440
|
|
|
1438
1441
|
async sign(message) {
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1442
|
+
if(typeof message === 'object') {
|
|
1443
|
+
let provider = this.getProvider();
|
|
1444
|
+
let account = await this.account();
|
|
1445
|
+
if((await this.connectedTo(Blockchains__default['default'].findByNetworkId(message.domain.chainId).name)) === false) {
|
|
1446
|
+
throw({ code: 'WRONG_NETWORK' })
|
|
1447
|
+
}
|
|
1448
|
+
let signature = await provider.request({
|
|
1449
|
+
method: 'eth_signTypedData_v4',
|
|
1450
|
+
params: [account, message],
|
|
1451
|
+
from: account,
|
|
1452
|
+
});
|
|
1453
|
+
return signature
|
|
1454
|
+
} else if (typeof message === 'string') {
|
|
1455
|
+
await this.account();
|
|
1456
|
+
let provider = new ethers.ethers.providers.Web3Provider(this.getProvider(), 'any');
|
|
1457
|
+
let signer = provider.getSigner(0);
|
|
1458
|
+
let signature = await signer.signMessage(message);
|
|
1459
|
+
return signature
|
|
1460
|
+
}
|
|
1444
1461
|
}
|
|
1445
1462
|
} WindowEthereum.__initStatic(); WindowEthereum.__initStatic2();
|
|
1446
1463
|
|
|
@@ -2256,13 +2273,26 @@
|
|
|
2256
2273
|
}
|
|
2257
2274
|
|
|
2258
2275
|
async sign(message) {
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
|
|
2276
|
+
if(typeof message === 'object') {
|
|
2277
|
+
let account = await this.account();
|
|
2278
|
+
if((await this.connectedTo(Blockchains__default['default'].findByNetworkId(message.domain.chainId).name)) === false) {
|
|
2279
|
+
throw({ code: 'WRONG_NETWORK' })
|
|
2280
|
+
}
|
|
2281
|
+
let signature = await this.connector.sendCustomRequest({
|
|
2282
|
+
jsonrpc: '2.0',
|
|
2283
|
+
method: 'eth_signTypedData_v4',
|
|
2284
|
+
params: [account, JSON.stringify(message)],
|
|
2285
|
+
});
|
|
2286
|
+
return signature
|
|
2287
|
+
} else if (typeof message === 'string') {
|
|
2288
|
+
let blockchain = await this.connectedTo();
|
|
2289
|
+
let address = await this.account();
|
|
2290
|
+
const smartContractWallet = await getSmartContractWallet(blockchain, address);
|
|
2291
|
+
if(smartContractWallet){ throw({ message: 'Smart contract wallets are not supported for signing!', code: "SMART_CONTRACT_WALLET_NOT_SUPPORTED" }) }
|
|
2292
|
+
var params = [ethers.ethers.utils.toUtf8Bytes(message), address];
|
|
2293
|
+
let signature = await this.connector.signPersonalMessage(params);
|
|
2294
|
+
return signature
|
|
2295
|
+
}
|
|
2266
2296
|
}
|
|
2267
2297
|
} WalletConnectV1.__initStatic(); WalletConnectV1.__initStatic2();
|
|
2268
2298
|
|
|
@@ -2434,6 +2464,7 @@
|
|
|
2434
2464
|
const methods = [
|
|
2435
2465
|
"eth_sendTransaction",
|
|
2436
2466
|
"personal_sign",
|
|
2467
|
+
"eth_signTypedData_v4",
|
|
2437
2468
|
"eth_chainId",
|
|
2438
2469
|
"eth_accounts",
|
|
2439
2470
|
"wallet_switchEthereumChain",
|
|
@@ -2657,22 +2688,39 @@
|
|
|
2657
2688
|
}
|
|
2658
2689
|
|
|
2659
2690
|
async sign(message) {
|
|
2660
|
-
|
|
2661
|
-
|
|
2662
|
-
|
|
2663
|
-
|
|
2664
|
-
|
|
2665
|
-
topic: this.session.topic,
|
|
2666
|
-
chainId: `${blockchain.namespace}:${blockchain.networkId}`,
|
|
2667
|
-
request:{
|
|
2668
|
-
method: 'personal_sign',
|
|
2669
|
-
params
|
|
2691
|
+
if(typeof message === 'object') {
|
|
2692
|
+
let account = await this.account();
|
|
2693
|
+
const blockchain = Blockchains__default['default'].findByNetworkId(message.domain.chainId);
|
|
2694
|
+
if((await this.connectedTo(blockchain.name)) === false) {
|
|
2695
|
+
throw({ code: 'WRONG_NETWORK' })
|
|
2670
2696
|
}
|
|
2671
|
-
|
|
2672
|
-
|
|
2673
|
-
|
|
2697
|
+
let signature = await this.signClient.request({
|
|
2698
|
+
topic: this.session.topic,
|
|
2699
|
+
chainId: `${blockchain.namespace}:${blockchain.networkId}`,
|
|
2700
|
+
request:{
|
|
2701
|
+
method: 'eth_signTypedData_v4',
|
|
2702
|
+
params: [account, JSON.stringify(message)],
|
|
2703
|
+
}
|
|
2704
|
+
});
|
|
2705
|
+
return signature
|
|
2706
|
+
} else if (typeof message === 'string') {
|
|
2707
|
+
const address = await this.account();
|
|
2708
|
+
const params = [ethers.ethers.utils.hexlify(ethers.ethers.utils.toUtf8Bytes(message)), address];
|
|
2709
|
+
const connectedChainId = await getConnectedChainId(this.signClient, this.session);
|
|
2710
|
+
const blockchain = Blockchains__default['default'].findById(connectedChainId);
|
|
2711
|
+
let signature = await this.signClient.request({
|
|
2712
|
+
topic: this.session.topic,
|
|
2713
|
+
chainId: `${blockchain.namespace}:${blockchain.networkId}`,
|
|
2714
|
+
request:{
|
|
2715
|
+
method: 'personal_sign',
|
|
2716
|
+
params
|
|
2717
|
+
}
|
|
2718
|
+
});
|
|
2719
|
+
if(typeof signature == 'object') {
|
|
2720
|
+
signature = ethers.ethers.utils.hexlify(signature);
|
|
2721
|
+
}
|
|
2722
|
+
return signature
|
|
2674
2723
|
}
|
|
2675
|
-
return signature
|
|
2676
2724
|
}
|
|
2677
2725
|
} WalletConnectV2.__initStatic(); WalletConnectV2.__initStatic2();
|
|
2678
2726
|
|
|
@@ -2890,11 +2938,25 @@
|
|
|
2890
2938
|
}
|
|
2891
2939
|
|
|
2892
2940
|
async sign(message) {
|
|
2893
|
-
|
|
2894
|
-
|
|
2895
|
-
|
|
2896
|
-
|
|
2897
|
-
|
|
2941
|
+
if(typeof message === 'object') {
|
|
2942
|
+
let provider = this.connector;
|
|
2943
|
+
let account = await this.account();
|
|
2944
|
+
if((await this.connectedTo(Blockchains__default['default'].findByNetworkId(message.domain.chainId).name)) === false) {
|
|
2945
|
+
throw({ code: 'WRONG_NETWORK' })
|
|
2946
|
+
}
|
|
2947
|
+
let signature = await provider.request({
|
|
2948
|
+
method: 'eth_signTypedData_v4',
|
|
2949
|
+
params: [account, message],
|
|
2950
|
+
from: account,
|
|
2951
|
+
});
|
|
2952
|
+
return signature
|
|
2953
|
+
} else if (typeof message === 'string') {
|
|
2954
|
+
await this.account();
|
|
2955
|
+
let provider = new ethers.ethers.providers.Web3Provider(this.connector, 'any');
|
|
2956
|
+
let signer = provider.getSigner(0);
|
|
2957
|
+
let signature = await signer.signMessage(message);
|
|
2958
|
+
return signature
|
|
2959
|
+
}
|
|
2898
2960
|
}
|
|
2899
2961
|
} WalletLink.__initStatic(); WalletLink.__initStatic2();
|
|
2900
2962
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@depay/web3-wallets-evm",
|
|
3
3
|
"moduleName": "Web3Wallets",
|
|
4
|
-
"version": "15.
|
|
4
|
+
"version": "15.16.1",
|
|
5
5
|
"description": "One-Stop-Shop JavaScript library to integrate various web3 crypto wallets and multiple blockchains at once with a single interface.",
|
|
6
6
|
"main": "dist/umd/index.evm.js",
|
|
7
7
|
"module": "dist/esm/index.evm.js",
|