@polkadot/extension-dapp 0.43.2 → 0.43.3-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/bundle-polkadot-extension-dapp.js +15 -4
- package/bundle.d.ts +2 -2
- package/bundle.js +16 -4
- package/cjs/bundle.js +32 -14
- package/cjs/packageInfo.js +1 -1
- package/package.json +2 -2
- package/packageInfo.js +1 -1
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
name: '@polkadot/extension-dapp',
|
|
21
21
|
path: (({ url: (typeof document === 'undefined' && typeof location === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : typeof document === 'undefined' ? location.href : (document.currentScript && document.currentScript.src || new URL('bundle-polkadot-extension-dapp.js', document.baseURI).href)) }) && (typeof document === 'undefined' && typeof location === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : typeof document === 'undefined' ? location.href : (document.currentScript && document.currentScript.src || new URL('bundle-polkadot-extension-dapp.js', document.baseURI).href))) ? new URL((typeof document === 'undefined' && typeof location === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : typeof document === 'undefined' ? location.href : (document.currentScript && document.currentScript.src || new URL('bundle-polkadot-extension-dapp.js', document.baseURI).href))).pathname.substring(0, new URL((typeof document === 'undefined' && typeof location === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : typeof document === 'undefined' ? location.href : (document.currentScript && document.currentScript.src || new URL('bundle-polkadot-extension-dapp.js', document.baseURI).href))).pathname.lastIndexOf('/') + 1) : 'auto',
|
|
22
22
|
type: 'esm',
|
|
23
|
-
version: '0.43.2'
|
|
23
|
+
version: '0.43.3-2'
|
|
24
24
|
};
|
|
25
25
|
|
|
26
26
|
const unwrapBytes = util.u8aUnwrapBytes;
|
|
@@ -92,6 +92,7 @@
|
|
|
92
92
|
}
|
|
93
93
|
async function web3Accounts({
|
|
94
94
|
accountType,
|
|
95
|
+
extensions,
|
|
95
96
|
ss58Format
|
|
96
97
|
} = {}) {
|
|
97
98
|
if (!exports.web3EnablePromise) {
|
|
@@ -99,7 +100,9 @@
|
|
|
99
100
|
}
|
|
100
101
|
const accounts = [];
|
|
101
102
|
const injected = await exports.web3EnablePromise;
|
|
102
|
-
const retrieved = await Promise.all(injected.
|
|
103
|
+
const retrieved = await Promise.all(injected.filter(({
|
|
104
|
+
name: source
|
|
105
|
+
}) => !extensions || extensions.includes(source)).map(async ({
|
|
103
106
|
accounts,
|
|
104
107
|
name: source
|
|
105
108
|
}) => {
|
|
@@ -122,6 +125,7 @@
|
|
|
122
125
|
return accounts;
|
|
123
126
|
}
|
|
124
127
|
async function web3AccountsSubscribe(cb, {
|
|
128
|
+
extensions,
|
|
125
129
|
ss58Format
|
|
126
130
|
} = {}) {
|
|
127
131
|
if (!exports.web3EnablePromise) {
|
|
@@ -132,14 +136,21 @@
|
|
|
132
136
|
result.push(...mapAccounts(source, list, ss58Format));
|
|
133
137
|
return result;
|
|
134
138
|
}, []));
|
|
135
|
-
const unsubs = (await exports.web3EnablePromise).
|
|
139
|
+
const unsubs = (await exports.web3EnablePromise).filter(({
|
|
140
|
+
name: source
|
|
141
|
+
}) => !extensions || extensions.includes(source)).map(({
|
|
136
142
|
accounts: {
|
|
137
143
|
subscribe
|
|
138
144
|
},
|
|
139
145
|
name: source
|
|
140
146
|
}) => subscribe(result => {
|
|
141
147
|
accounts[source] = result;
|
|
142
|
-
|
|
148
|
+
try {
|
|
149
|
+
var _triggerUpdate;
|
|
150
|
+
(_triggerUpdate = triggerUpdate()) === null || _triggerUpdate === void 0 ? void 0 : _triggerUpdate.catch(console.error);
|
|
151
|
+
} catch (error) {
|
|
152
|
+
console.error(error);
|
|
153
|
+
}
|
|
143
154
|
}));
|
|
144
155
|
return () => {
|
|
145
156
|
unsubs.forEach(unsub => {
|
package/bundle.d.ts
CHANGED
|
@@ -5,8 +5,8 @@ declare let isWeb3Injected: boolean;
|
|
|
5
5
|
declare let web3EnablePromise: Promise<InjectedExtension[]> | null;
|
|
6
6
|
export { isWeb3Injected, web3EnablePromise };
|
|
7
7
|
export declare function web3Enable(originName: string, compatInits?: (() => Promise<boolean>)[]): Promise<InjectedExtension[]>;
|
|
8
|
-
export declare function web3Accounts({ accountType, ss58Format }?: Web3AccountsOptions): Promise<InjectedAccountWithMeta[]>;
|
|
9
|
-
export declare function web3AccountsSubscribe(cb: (accounts: InjectedAccountWithMeta[]) => void | Promise<void>, { ss58Format }?: Web3AccountsOptions): Promise<Unsubcall>;
|
|
8
|
+
export declare function web3Accounts({ accountType, extensions, ss58Format }?: Web3AccountsOptions): Promise<InjectedAccountWithMeta[]>;
|
|
9
|
+
export declare function web3AccountsSubscribe(cb: (accounts: InjectedAccountWithMeta[]) => void | Promise<void>, { extensions, ss58Format }?: Web3AccountsOptions): Promise<Unsubcall>;
|
|
10
10
|
export declare function web3FromSource(source: string): Promise<InjectedExtension>;
|
|
11
11
|
export declare function web3FromAddress(address: string): Promise<InjectedExtension>;
|
|
12
12
|
export declare function web3ListRpcProviders(source: string): Promise<ProviderList | null>;
|
package/bundle.js
CHANGED
|
@@ -90,6 +90,7 @@ export function web3Enable(originName, compatInits = []) {
|
|
|
90
90
|
|
|
91
91
|
export async function web3Accounts({
|
|
92
92
|
accountType,
|
|
93
|
+
extensions,
|
|
93
94
|
ss58Format
|
|
94
95
|
} = {}) {
|
|
95
96
|
if (!web3EnablePromise) {
|
|
@@ -98,7 +99,9 @@ export async function web3Accounts({
|
|
|
98
99
|
|
|
99
100
|
const accounts = [];
|
|
100
101
|
const injected = await web3EnablePromise;
|
|
101
|
-
const retrieved = await Promise.all(injected.
|
|
102
|
+
const retrieved = await Promise.all(injected.filter(({
|
|
103
|
+
name: source
|
|
104
|
+
}) => !extensions || extensions.includes(source)).map(async ({
|
|
102
105
|
accounts,
|
|
103
106
|
name: source
|
|
104
107
|
}) => {
|
|
@@ -122,6 +125,7 @@ export async function web3Accounts({
|
|
|
122
125
|
return accounts;
|
|
123
126
|
}
|
|
124
127
|
export async function web3AccountsSubscribe(cb, {
|
|
128
|
+
extensions,
|
|
125
129
|
ss58Format
|
|
126
130
|
} = {}) {
|
|
127
131
|
if (!web3EnablePromise) {
|
|
@@ -135,15 +139,23 @@ export async function web3AccountsSubscribe(cb, {
|
|
|
135
139
|
return result;
|
|
136
140
|
}, []));
|
|
137
141
|
|
|
138
|
-
const unsubs = (await web3EnablePromise).
|
|
142
|
+
const unsubs = (await web3EnablePromise).filter(({
|
|
143
|
+
name: source
|
|
144
|
+
}) => !extensions || extensions.includes(source)).map(({
|
|
139
145
|
accounts: {
|
|
140
146
|
subscribe
|
|
141
147
|
},
|
|
142
148
|
name: source
|
|
143
149
|
}) => subscribe(result => {
|
|
144
|
-
accounts[source] = result;
|
|
150
|
+
accounts[source] = result;
|
|
151
|
+
|
|
152
|
+
try {
|
|
153
|
+
var _triggerUpdate;
|
|
145
154
|
|
|
146
|
-
|
|
155
|
+
(_triggerUpdate = triggerUpdate()) === null || _triggerUpdate === void 0 ? void 0 : _triggerUpdate.catch(console.error);
|
|
156
|
+
} catch (error) {
|
|
157
|
+
console.error(error);
|
|
158
|
+
}
|
|
147
159
|
}));
|
|
148
160
|
return () => {
|
|
149
161
|
unsubs.forEach(unsub => {
|
package/cjs/bundle.js
CHANGED
|
@@ -144,6 +144,7 @@ function web3Enable(originName) {
|
|
|
144
144
|
async function web3Accounts() {
|
|
145
145
|
let {
|
|
146
146
|
accountType,
|
|
147
|
+
extensions,
|
|
147
148
|
ss58Format
|
|
148
149
|
} = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
149
150
|
|
|
@@ -153,18 +154,23 @@ async function web3Accounts() {
|
|
|
153
154
|
|
|
154
155
|
const accounts = [];
|
|
155
156
|
const injected = await web3EnablePromise;
|
|
156
|
-
const retrieved = await Promise.all(injected.
|
|
157
|
+
const retrieved = await Promise.all(injected.filter(_ref5 => {
|
|
157
158
|
let {
|
|
158
|
-
accounts,
|
|
159
159
|
name: source
|
|
160
160
|
} = _ref5;
|
|
161
|
+
return !extensions || extensions.includes(source);
|
|
162
|
+
}).map(async _ref6 => {
|
|
163
|
+
let {
|
|
164
|
+
accounts,
|
|
165
|
+
name: source
|
|
166
|
+
} = _ref6;
|
|
161
167
|
|
|
162
168
|
try {
|
|
163
169
|
const list = await accounts.get();
|
|
164
|
-
return mapAccounts(source, list.filter(
|
|
170
|
+
return mapAccounts(source, list.filter(_ref7 => {
|
|
165
171
|
let {
|
|
166
172
|
type
|
|
167
|
-
} =
|
|
173
|
+
} = _ref7;
|
|
168
174
|
return type && accountType ? accountType.includes(type) : true;
|
|
169
175
|
}), ss58Format);
|
|
170
176
|
} catch (error) {
|
|
@@ -175,10 +181,10 @@ async function web3Accounts() {
|
|
|
175
181
|
retrieved.forEach(result => {
|
|
176
182
|
accounts.push(...result);
|
|
177
183
|
});
|
|
178
|
-
const addresses = accounts.map(
|
|
184
|
+
const addresses = accounts.map(_ref8 => {
|
|
179
185
|
let {
|
|
180
186
|
address
|
|
181
|
-
} =
|
|
187
|
+
} = _ref8;
|
|
182
188
|
return address;
|
|
183
189
|
});
|
|
184
190
|
console.log(`web3Accounts: Found ${accounts.length} address${accounts.length !== 1 ? 'es' : ''}: ${addresses.join(', ')}`);
|
|
@@ -187,6 +193,7 @@ async function web3Accounts() {
|
|
|
187
193
|
|
|
188
194
|
async function web3AccountsSubscribe(cb) {
|
|
189
195
|
let {
|
|
196
|
+
extensions,
|
|
190
197
|
ss58Format
|
|
191
198
|
} = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
192
199
|
|
|
@@ -196,23 +203,34 @@ async function web3AccountsSubscribe(cb) {
|
|
|
196
203
|
|
|
197
204
|
const accounts = {};
|
|
198
205
|
|
|
199
|
-
const triggerUpdate = () => cb(Object.entries(accounts).reduce((result,
|
|
200
|
-
let [source, list] =
|
|
206
|
+
const triggerUpdate = () => cb(Object.entries(accounts).reduce((result, _ref9) => {
|
|
207
|
+
let [source, list] = _ref9;
|
|
201
208
|
result.push(...mapAccounts(source, list, ss58Format));
|
|
202
209
|
return result;
|
|
203
210
|
}, []));
|
|
204
211
|
|
|
205
|
-
const unsubs = (await web3EnablePromise).
|
|
212
|
+
const unsubs = (await web3EnablePromise).filter(_ref10 => {
|
|
213
|
+
let {
|
|
214
|
+
name: source
|
|
215
|
+
} = _ref10;
|
|
216
|
+
return !extensions || extensions.includes(source);
|
|
217
|
+
}).map(_ref11 => {
|
|
206
218
|
let {
|
|
207
219
|
accounts: {
|
|
208
220
|
subscribe
|
|
209
221
|
},
|
|
210
222
|
name: source
|
|
211
|
-
} =
|
|
223
|
+
} = _ref11;
|
|
212
224
|
return subscribe(result => {
|
|
213
|
-
accounts[source] = result;
|
|
225
|
+
accounts[source] = result;
|
|
214
226
|
|
|
215
|
-
|
|
227
|
+
try {
|
|
228
|
+
var _triggerUpdate;
|
|
229
|
+
|
|
230
|
+
(_triggerUpdate = triggerUpdate()) === null || _triggerUpdate === void 0 ? void 0 : _triggerUpdate.catch(console.error);
|
|
231
|
+
} catch (error) {
|
|
232
|
+
console.error(error);
|
|
233
|
+
}
|
|
216
234
|
});
|
|
217
235
|
});
|
|
218
236
|
return () => {
|
|
@@ -229,10 +247,10 @@ async function web3FromSource(source) {
|
|
|
229
247
|
}
|
|
230
248
|
|
|
231
249
|
const sources = await web3EnablePromise;
|
|
232
|
-
const found = source && sources.find(
|
|
250
|
+
const found = source && sources.find(_ref12 => {
|
|
233
251
|
let {
|
|
234
252
|
name
|
|
235
|
-
} =
|
|
253
|
+
} = _ref12;
|
|
236
254
|
return name === source;
|
|
237
255
|
});
|
|
238
256
|
|
package/cjs/packageInfo.js
CHANGED
package/package.json
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"./cjs/detectPackage.js"
|
|
18
18
|
],
|
|
19
19
|
"type": "module",
|
|
20
|
-
"version": "0.43.2",
|
|
20
|
+
"version": "0.43.3-2",
|
|
21
21
|
"main": "./cjs/index.js",
|
|
22
22
|
"module": "./index.js",
|
|
23
23
|
"types": "./index.d.ts",
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
},
|
|
69
69
|
"dependencies": {
|
|
70
70
|
"@babel/runtime": "^7.17.9",
|
|
71
|
-
"@polkadot/extension-inject": "^0.43.2",
|
|
71
|
+
"@polkadot/extension-inject": "^0.43.3-2",
|
|
72
72
|
"@polkadot/util": "^9.2.1",
|
|
73
73
|
"@polkadot/util-crypto": "^9.2.1"
|
|
74
74
|
},
|
package/packageInfo.js
CHANGED
|
@@ -5,5 +5,5 @@ export const packageInfo = {
|
|
|
5
5
|
name: '@polkadot/extension-dapp',
|
|
6
6
|
path: (import.meta && import.meta.url) ? new URL(import.meta.url).pathname.substring(0, new URL(import.meta.url).pathname.lastIndexOf('/') + 1) : 'auto',
|
|
7
7
|
type: 'esm',
|
|
8
|
-
version: '0.43.2'
|
|
8
|
+
version: '0.43.3-2'
|
|
9
9
|
};
|