@leofcoin/peernet 0.11.28 → 0.11.31
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/browser/peernet.js +11 -3
- package/dist/commonjs/peernet.js +11 -3
- package/dist/module/peernet.js +11 -3
- package/package.json +1 -1
- package/src/peernet.js +11 -3
package/dist/browser/peernet.js
CHANGED
|
@@ -1962,13 +1962,21 @@ class Peernet {
|
|
|
1962
1962
|
try {
|
|
1963
1963
|
const pub = await accountStore.get('public');
|
|
1964
1964
|
this.id = JSON.parse(new TextDecoder().decode(pub)).walletId;
|
|
1965
|
-
|
|
1966
|
-
|
|
1965
|
+
let accounts = await walletStore.get('accounts');
|
|
1966
|
+
accounts = new TextDecoder().decode(accounts);
|
|
1967
|
+
|
|
1968
|
+
// fixing account issue (string while needs to be a JSON)
|
|
1969
|
+
// TODO: remove when on mainnet
|
|
1970
|
+
try {
|
|
1971
|
+
this.accounts = JSON.parse(account);
|
|
1972
|
+
} catch (e) {
|
|
1973
|
+
this.accounts = [accounts.split(',')];
|
|
1974
|
+
}
|
|
1967
1975
|
} catch (e) {
|
|
1968
1976
|
if (e.code === 'ERR_NOT_FOUND') {
|
|
1969
1977
|
const {identity, accounts, config} = await generateAccount(this.network);
|
|
1970
1978
|
walletStore.put('version', new TextEncoder().encode(1));
|
|
1971
|
-
walletStore.put('accounts', new TextEncoder().encode(accounts));
|
|
1979
|
+
walletStore.put('accounts', new TextEncoder().encode(JSON.stringify(accounts)));
|
|
1972
1980
|
walletStore.put('identity', new TextEncoder().encode(JSON.stringify(identity)));
|
|
1973
1981
|
await accountStore.put('config', new TextEncoder().encode(JSON.stringify(config)));
|
|
1974
1982
|
await accountStore.put('public', new TextEncoder().encode(JSON.stringify({walletId: identity.walletId})));
|
package/dist/commonjs/peernet.js
CHANGED
|
@@ -1854,13 +1854,21 @@ class Peernet {
|
|
|
1854
1854
|
try {
|
|
1855
1855
|
const pub = await accountStore.get('public');
|
|
1856
1856
|
this.id = JSON.parse(new TextDecoder().decode(pub)).walletId;
|
|
1857
|
-
|
|
1858
|
-
|
|
1857
|
+
let accounts = await walletStore.get('accounts');
|
|
1858
|
+
accounts = new TextDecoder().decode(accounts);
|
|
1859
|
+
|
|
1860
|
+
// fixing account issue (string while needs to be a JSON)
|
|
1861
|
+
// TODO: remove when on mainnet
|
|
1862
|
+
try {
|
|
1863
|
+
this.accounts = JSON.parse(account);
|
|
1864
|
+
} catch (e) {
|
|
1865
|
+
this.accounts = [accounts.split(',')];
|
|
1866
|
+
}
|
|
1859
1867
|
} catch (e) {
|
|
1860
1868
|
if (e.code === 'ERR_NOT_FOUND') {
|
|
1861
1869
|
const {identity, accounts, config} = await generateAccount(this.network);
|
|
1862
1870
|
walletStore.put('version', new TextEncoder().encode(1));
|
|
1863
|
-
walletStore.put('accounts', new TextEncoder().encode(accounts));
|
|
1871
|
+
walletStore.put('accounts', new TextEncoder().encode(JSON.stringify(accounts)));
|
|
1864
1872
|
walletStore.put('identity', new TextEncoder().encode(JSON.stringify(identity)));
|
|
1865
1873
|
await accountStore.put('config', new TextEncoder().encode(JSON.stringify(config)));
|
|
1866
1874
|
await accountStore.put('public', new TextEncoder().encode(JSON.stringify({walletId: identity.walletId})));
|
package/dist/module/peernet.js
CHANGED
|
@@ -1918,13 +1918,21 @@ class Peernet {
|
|
|
1918
1918
|
try {
|
|
1919
1919
|
const pub = await accountStore.get('public');
|
|
1920
1920
|
this.id = JSON.parse(new TextDecoder().decode(pub)).walletId;
|
|
1921
|
-
|
|
1922
|
-
|
|
1921
|
+
let accounts = await walletStore.get('accounts');
|
|
1922
|
+
accounts = new TextDecoder().decode(accounts);
|
|
1923
|
+
|
|
1924
|
+
// fixing account issue (string while needs to be a JSON)
|
|
1925
|
+
// TODO: remove when on mainnet
|
|
1926
|
+
try {
|
|
1927
|
+
this.accounts = JSON.parse(account);
|
|
1928
|
+
} catch (e) {
|
|
1929
|
+
this.accounts = [accounts.split(',')];
|
|
1930
|
+
}
|
|
1923
1931
|
} catch (e) {
|
|
1924
1932
|
if (e.code === 'ERR_NOT_FOUND') {
|
|
1925
1933
|
const {identity, accounts, config} = await generateAccount(this.network);
|
|
1926
1934
|
walletStore.put('version', new TextEncoder().encode(1));
|
|
1927
|
-
walletStore.put('accounts', new TextEncoder().encode(accounts));
|
|
1935
|
+
walletStore.put('accounts', new TextEncoder().encode(JSON.stringify(accounts)));
|
|
1928
1936
|
walletStore.put('identity', new TextEncoder().encode(JSON.stringify(identity)));
|
|
1929
1937
|
await accountStore.put('config', new TextEncoder().encode(JSON.stringify(config)));
|
|
1930
1938
|
await accountStore.put('public', new TextEncoder().encode(JSON.stringify({walletId: identity.walletId})));
|
package/package.json
CHANGED
package/src/peernet.js
CHANGED
|
@@ -190,14 +190,22 @@ export default class Peernet {
|
|
|
190
190
|
try {
|
|
191
191
|
const pub = await accountStore.get('public')
|
|
192
192
|
this.id = JSON.parse(new TextDecoder().decode(pub)).walletId
|
|
193
|
-
|
|
194
|
-
|
|
193
|
+
let accounts = await walletStore.get('accounts')
|
|
194
|
+
accounts = new TextDecoder().decode(accounts)
|
|
195
|
+
|
|
196
|
+
// fixing account issue (string while needs to be a JSON)
|
|
197
|
+
// TODO: remove when on mainnet
|
|
198
|
+
try {
|
|
199
|
+
this.accounts = JSON.parse(account)
|
|
200
|
+
} catch (e) {
|
|
201
|
+
this.accounts = [accounts.split(',')]
|
|
202
|
+
}
|
|
195
203
|
} catch (e) {
|
|
196
204
|
if (e.code === 'ERR_NOT_FOUND') {
|
|
197
205
|
const wallet = {}
|
|
198
206
|
const {identity, accounts, config} = await generateAccount(this.network)
|
|
199
207
|
walletStore.put('version', new TextEncoder().encode(1))
|
|
200
|
-
walletStore.put('accounts', new TextEncoder().encode(accounts))
|
|
208
|
+
walletStore.put('accounts', new TextEncoder().encode(JSON.stringify(accounts)))
|
|
201
209
|
walletStore.put('identity', new TextEncoder().encode(JSON.stringify(identity)))
|
|
202
210
|
await accountStore.put('config', new TextEncoder().encode(JSON.stringify(config)));
|
|
203
211
|
await accountStore.put('public', new TextEncoder().encode(JSON.stringify({walletId: identity.walletId})));
|