@polkadot/extension-dapp 0.44.9 → 0.45.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 +184 -213
- package/bundle.d.ts +2 -2
- package/bundle.js +146 -197
- package/cjs/bundle.js +161 -256
- package/cjs/detectOther.js +3 -10
- package/cjs/detectPackage.js +6 -11
- package/cjs/index.js +3 -15
- package/cjs/packageInfo.js +2 -16
- package/cjs/util.js +12 -16
- package/cjs/wrapBytes.js +8 -20
- package/detectOther.js +0 -3
- package/detectPackage.js +2 -7
- package/index.d.ts +1 -1
- package/index.js +1 -7
- package/package.json +9 -6
- package/packageInfo.js +1 -11
- package/util.js +8 -10
- package/wrapBytes.js +0 -3
package/cjs/bundle.js
CHANGED
|
@@ -1,176 +1,113 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
});
|
|
13
|
-
Object.defineProperty(exports, "unwrapBytes", {
|
|
14
|
-
enumerable: true,
|
|
15
|
-
get: function () {
|
|
16
|
-
return _wrapBytes.unwrapBytes;
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
exports.web3Accounts = web3Accounts;
|
|
20
|
-
exports.web3AccountsSubscribe = web3AccountsSubscribe;
|
|
21
|
-
exports.web3Enable = web3Enable;
|
|
22
|
-
exports.web3EnablePromise = void 0;
|
|
23
|
-
exports.web3FromAddress = web3FromAddress;
|
|
24
|
-
exports.web3FromSource = web3FromSource;
|
|
25
|
-
exports.web3ListRpcProviders = web3ListRpcProviders;
|
|
26
|
-
exports.web3UseRpcProvider = web3UseRpcProvider;
|
|
27
|
-
Object.defineProperty(exports, "wrapBytes", {
|
|
28
|
-
enumerable: true,
|
|
29
|
-
get: function () {
|
|
30
|
-
return _wrapBytes.wrapBytes;
|
|
31
|
-
}
|
|
32
|
-
});
|
|
33
|
-
var _util = require("@polkadot/util");
|
|
34
|
-
var _utilCrypto = require("@polkadot/util-crypto");
|
|
35
|
-
var _util2 = require("./util");
|
|
36
|
-
var _packageInfo = require("./packageInfo");
|
|
37
|
-
var _wrapBytes = require("./wrapBytes");
|
|
38
|
-
// Copyright 2019-2023 @polkadot/extension-dapp authors & contributors
|
|
39
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
40
|
-
|
|
41
|
-
// expose utility functions
|
|
42
|
-
|
|
43
|
-
// just a helper (otherwise we cast all-over, so shorter and more readable)
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.web3UseRpcProvider = exports.web3ListRpcProviders = exports.web3FromAddress = exports.web3FromSource = exports.web3AccountsSubscribe = exports.web3Accounts = exports.web3Enable = exports.web3EnablePromise = exports.isWeb3Injected = exports.wrapBytes = exports.unwrapBytes = exports.packageInfo = void 0;
|
|
4
|
+
const util_1 = require("@polkadot/util");
|
|
5
|
+
const util_crypto_1 = require("@polkadot/util-crypto");
|
|
6
|
+
const util_js_1 = require("./util.js");
|
|
7
|
+
var packageInfo_js_1 = require("./packageInfo.js");
|
|
8
|
+
Object.defineProperty(exports, "packageInfo", { enumerable: true, get: function () { return packageInfo_js_1.packageInfo; } });
|
|
9
|
+
var wrapBytes_js_1 = require("./wrapBytes.js");
|
|
10
|
+
Object.defineProperty(exports, "unwrapBytes", { enumerable: true, get: function () { return wrapBytes_js_1.unwrapBytes; } });
|
|
11
|
+
Object.defineProperty(exports, "wrapBytes", { enumerable: true, get: function () { return wrapBytes_js_1.wrapBytes; } });
|
|
44
12
|
const win = window;
|
|
45
|
-
|
|
46
|
-
// don't clobber the existing object, but ensure non-undefined
|
|
47
13
|
win.injectedWeb3 = win.injectedWeb3 || {};
|
|
48
|
-
|
|
49
|
-
// have we found a properly constructed window.injectedWeb3
|
|
50
14
|
let isWeb3Injected = web3IsInjected();
|
|
51
|
-
|
|
52
|
-
// we keep the last promise created around (for queries)
|
|
53
15
|
exports.isWeb3Injected = isWeb3Injected;
|
|
54
16
|
let web3EnablePromise = null;
|
|
55
17
|
exports.web3EnablePromise = web3EnablePromise;
|
|
56
18
|
/** @internal true when anything has been injected and is available */
|
|
57
19
|
function web3IsInjected() {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
} = _ref;
|
|
63
|
-
return !!(connect || enable);
|
|
64
|
-
}).length !== 0;
|
|
20
|
+
return Object
|
|
21
|
+
.values(win.injectedWeb3)
|
|
22
|
+
.filter(({ connect, enable }) => !!(connect || enable))
|
|
23
|
+
.length !== 0;
|
|
65
24
|
}
|
|
66
|
-
|
|
67
25
|
/** @internal throw a consistent error when not extensions have not been enabled */
|
|
68
26
|
function throwError(method) {
|
|
69
|
-
|
|
27
|
+
throw new Error(`${method}: web3Enable(originName) needs to be called before ${method}`);
|
|
70
28
|
}
|
|
71
|
-
|
|
72
29
|
/** @internal map from Array<InjectedAccount> to Array<InjectedAccountWithMeta> */
|
|
73
30
|
function mapAccounts(source, list, ss58Format) {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
}
|
|
81
|
-
return {
|
|
82
|
-
address: address.length === 42 ? address : (0, _utilCrypto.encodeAddress)((0, _utilCrypto.decodeAddress)(address), ss58Format),
|
|
83
|
-
meta: {
|
|
84
|
-
genesisHash,
|
|
85
|
-
name,
|
|
86
|
-
source
|
|
87
|
-
},
|
|
88
|
-
type
|
|
89
|
-
};
|
|
90
|
-
});
|
|
31
|
+
return list.map(({ address, genesisHash, name, type }) => ({
|
|
32
|
+
address: address.length === 42
|
|
33
|
+
? address
|
|
34
|
+
: (0, util_crypto_1.encodeAddress)((0, util_crypto_1.decodeAddress)(address), ss58Format),
|
|
35
|
+
meta: { genesisHash, name, source },
|
|
36
|
+
type
|
|
37
|
+
}));
|
|
91
38
|
}
|
|
92
|
-
|
|
93
39
|
/** @internal filter accounts based on genesisHash and type of account */
|
|
94
40
|
function filterAccounts(list, genesisHash, type) {
|
|
95
|
-
|
|
41
|
+
return list.filter((a) => (!a.type || !type || type.includes(a.type)) &&
|
|
42
|
+
(!a.genesisHash || !genesisHash || a.genesisHash === genesisHash));
|
|
96
43
|
}
|
|
97
|
-
|
|
98
44
|
/** @internal retrieves all the extensions available on the window */
|
|
99
45
|
function getWindowExtensions(originName) {
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
} = _ref4;
|
|
117
|
-
console.error(`Error initializing ${nameOrHash}: ${message}`);
|
|
118
|
-
});
|
|
119
|
-
})).then(exts => exts.filter(e => !!e));
|
|
46
|
+
return Promise
|
|
47
|
+
.all(Object
|
|
48
|
+
.entries(win.injectedWeb3)
|
|
49
|
+
.map(([nameOrHash, { connect, enable, version }]) => Promise
|
|
50
|
+
.resolve()
|
|
51
|
+
.then(() => connect
|
|
52
|
+
// new style, returning all info
|
|
53
|
+
? connect(originName)
|
|
54
|
+
: enable
|
|
55
|
+
// previous interface, leakages on name/version
|
|
56
|
+
? enable(originName).then((e) => (0, util_1.objectSpread)({ name: nameOrHash, version: version || 'unknown' }, e))
|
|
57
|
+
: Promise.reject(new Error('No connect(..) or enable(...) hook found')))
|
|
58
|
+
.catch(({ message }) => {
|
|
59
|
+
console.error(`Error initializing ${nameOrHash}: ${message}`);
|
|
60
|
+
})))
|
|
61
|
+
.then((exts) => exts.filter((e) => !!e));
|
|
120
62
|
}
|
|
121
|
-
|
|
122
63
|
/** @internal Ensure the enable promise is resolved and filter by extensions */
|
|
123
64
|
async function filterEnable(caller, extensions) {
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
name
|
|
131
|
-
} = _ref5;
|
|
132
|
-
return !extensions || extensions.includes(name);
|
|
133
|
-
});
|
|
65
|
+
if (!web3EnablePromise) {
|
|
66
|
+
return throwError(caller);
|
|
67
|
+
}
|
|
68
|
+
const sources = await web3EnablePromise;
|
|
69
|
+
return sources.filter(({ name }) => !extensions ||
|
|
70
|
+
extensions.includes(name));
|
|
134
71
|
}
|
|
135
|
-
|
|
136
72
|
/**
|
|
137
73
|
* @summary Enables all the providers found on the injected window interface
|
|
138
74
|
* @description
|
|
139
75
|
* Enables all injected extensions that has been found on the page. This
|
|
140
76
|
* should be called before making use of any other web3* functions.
|
|
141
77
|
*/
|
|
142
|
-
function web3Enable(originName) {
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
throw new Error('You must pass a name for your app to the web3Enable function');
|
|
146
|
-
}
|
|
147
|
-
const initCompat = compatInits.length ? Promise.all(compatInits.map(c => c().catch(() => false))) : Promise.resolve([true]);
|
|
148
|
-
exports.web3EnablePromise = web3EnablePromise = (0, _util2.documentReadyPromise)(() => initCompat.then(() => getWindowExtensions(originName).then(values => values.map(e => {
|
|
149
|
-
// if we don't have an accounts subscriber, add a single-shot version
|
|
150
|
-
if (!e.accounts.subscribe) {
|
|
151
|
-
e.accounts.subscribe = cb => {
|
|
152
|
-
e.accounts.get().then(cb).catch(console.error);
|
|
153
|
-
return () => {
|
|
154
|
-
// no ubsubscribe needed, this is a single-shot
|
|
155
|
-
};
|
|
156
|
-
};
|
|
78
|
+
function web3Enable(originName, compatInits = []) {
|
|
79
|
+
if (!originName) {
|
|
80
|
+
throw new Error('You must pass a name for your app to the web3Enable function');
|
|
157
81
|
}
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
version
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
82
|
+
const initCompat = compatInits.length
|
|
83
|
+
? Promise.all(compatInits.map((c) => c().catch(() => false)))
|
|
84
|
+
: Promise.resolve([true]);
|
|
85
|
+
exports.web3EnablePromise = web3EnablePromise = (0, util_js_1.documentReadyPromise)(() => initCompat.then(() => getWindowExtensions(originName)
|
|
86
|
+
.then((values) => values.map((e) => {
|
|
87
|
+
// if we don't have an accounts subscriber, add a single-shot version
|
|
88
|
+
if (!e.accounts.subscribe) {
|
|
89
|
+
e.accounts.subscribe = (cb) => {
|
|
90
|
+
e.accounts
|
|
91
|
+
.get()
|
|
92
|
+
.then(cb)
|
|
93
|
+
.catch(console.error);
|
|
94
|
+
return () => {
|
|
95
|
+
// no ubsubscribe needed, this is a single-shot
|
|
96
|
+
};
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
return e;
|
|
100
|
+
}))
|
|
101
|
+
.catch(() => [])
|
|
102
|
+
.then((values) => {
|
|
103
|
+
const names = values.map(({ name, version }) => `${name}/${version}`);
|
|
104
|
+
exports.isWeb3Injected = isWeb3Injected = web3IsInjected();
|
|
105
|
+
console.info(`web3Enable: Enabled ${values.length} extension${values.length !== 1 ? 's' : ''}: ${names.join(', ')}`);
|
|
106
|
+
return values;
|
|
107
|
+
})));
|
|
108
|
+
return web3EnablePromise;
|
|
172
109
|
}
|
|
173
|
-
|
|
110
|
+
exports.web3Enable = web3Enable;
|
|
174
111
|
/**
|
|
175
112
|
* @summary Retrieves all the accounts across all providers
|
|
176
113
|
* @description
|
|
@@ -179,35 +116,26 @@ function web3Enable(originName) {
|
|
|
179
116
|
* per-genesisHash basis. Optionally the accounts can be encoded with the provided
|
|
180
117
|
* ss58Format
|
|
181
118
|
*/
|
|
182
|
-
async function web3Accounts() {
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
// cannot handle this one
|
|
201
|
-
return [];
|
|
202
|
-
}
|
|
203
|
-
}));
|
|
204
|
-
retrieved.forEach(result => {
|
|
205
|
-
accounts.push(...result);
|
|
206
|
-
});
|
|
207
|
-
console.info(`web3Accounts: Found ${accounts.length} address${accounts.length !== 1 ? 'es' : ''}`);
|
|
208
|
-
return accounts;
|
|
119
|
+
async function web3Accounts({ accountType, extensions, genesisHash, ss58Format } = {}) {
|
|
120
|
+
const accounts = [];
|
|
121
|
+
const sources = await filterEnable('web3Accounts', extensions);
|
|
122
|
+
const retrieved = await Promise.all(sources.map(async ({ accounts, name: source }) => {
|
|
123
|
+
try {
|
|
124
|
+
const list = await accounts.get();
|
|
125
|
+
return mapAccounts(source, filterAccounts(list, genesisHash, accountType), ss58Format);
|
|
126
|
+
}
|
|
127
|
+
catch (error) {
|
|
128
|
+
// cannot handle this one
|
|
129
|
+
return [];
|
|
130
|
+
}
|
|
131
|
+
}));
|
|
132
|
+
retrieved.forEach((result) => {
|
|
133
|
+
accounts.push(...result);
|
|
134
|
+
});
|
|
135
|
+
console.info(`web3Accounts: Found ${accounts.length} address${accounts.length !== 1 ? 'es' : ''}`);
|
|
136
|
+
return accounts;
|
|
209
137
|
}
|
|
210
|
-
|
|
138
|
+
exports.web3Accounts = web3Accounts;
|
|
211
139
|
/**
|
|
212
140
|
* @summary Subscribes to all the accounts across all providers
|
|
213
141
|
* @description
|
|
@@ -215,46 +143,34 @@ async function web3Accounts() {
|
|
|
215
143
|
* updates as to when new accounts do become available. The list of filtering
|
|
216
144
|
* options are the same as for the web3Accounts interface.
|
|
217
145
|
*/
|
|
218
|
-
async function web3AccountsSubscribe(cb) {
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
accounts: {
|
|
235
|
-
subscribe
|
|
236
|
-
},
|
|
237
|
-
name: source
|
|
238
|
-
} = _ref9;
|
|
239
|
-
return subscribe(result => {
|
|
240
|
-
accounts[source] = result;
|
|
241
|
-
try {
|
|
242
|
-
const result = triggerUpdate();
|
|
243
|
-
if (result && (0, _util.isPromise)(result)) {
|
|
244
|
-
result.catch(console.error);
|
|
146
|
+
async function web3AccountsSubscribe(cb, { accountType, extensions, genesisHash, ss58Format } = {}) {
|
|
147
|
+
const sources = await filterEnable('web3AccountsSubscribe', extensions);
|
|
148
|
+
const accounts = {};
|
|
149
|
+
const triggerUpdate = () => cb(Object
|
|
150
|
+
.entries(accounts)
|
|
151
|
+
.reduce((result, [source, list]) => {
|
|
152
|
+
result.push(...mapAccounts(source, filterAccounts(list, genesisHash, accountType), ss58Format));
|
|
153
|
+
return result;
|
|
154
|
+
}, []));
|
|
155
|
+
const unsubs = sources.map(({ accounts: { subscribe }, name: source }) => subscribe((result) => {
|
|
156
|
+
accounts[source] = result;
|
|
157
|
+
try {
|
|
158
|
+
const result = triggerUpdate();
|
|
159
|
+
if (result && (0, util_1.isPromise)(result)) {
|
|
160
|
+
result.catch(console.error);
|
|
161
|
+
}
|
|
245
162
|
}
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
});
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
}
|
|
255
|
-
};
|
|
163
|
+
catch (error) {
|
|
164
|
+
console.error(error);
|
|
165
|
+
}
|
|
166
|
+
}));
|
|
167
|
+
return () => {
|
|
168
|
+
unsubs.forEach((unsub) => {
|
|
169
|
+
unsub();
|
|
170
|
+
});
|
|
171
|
+
};
|
|
256
172
|
}
|
|
257
|
-
|
|
173
|
+
exports.web3AccountsSubscribe = web3AccountsSubscribe;
|
|
258
174
|
/**
|
|
259
175
|
* @summary Finds a specific provider based on the name
|
|
260
176
|
* @description
|
|
@@ -264,22 +180,17 @@ async function web3AccountsSubscribe(cb) {
|
|
|
264
180
|
* known extension.
|
|
265
181
|
*/
|
|
266
182
|
async function web3FromSource(source) {
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
}
|
|
275
|
-
return
|
|
276
|
-
});
|
|
277
|
-
if (!found) {
|
|
278
|
-
throw new Error(`web3FromSource: Unable to find an injected ${source}`);
|
|
279
|
-
}
|
|
280
|
-
return found;
|
|
183
|
+
if (!web3EnablePromise) {
|
|
184
|
+
return throwError('web3FromSource');
|
|
185
|
+
}
|
|
186
|
+
const sources = await web3EnablePromise;
|
|
187
|
+
const found = source && sources.find(({ name }) => name === source);
|
|
188
|
+
if (!found) {
|
|
189
|
+
throw new Error(`web3FromSource: Unable to find an injected ${source}`);
|
|
190
|
+
}
|
|
191
|
+
return found;
|
|
281
192
|
}
|
|
282
|
-
|
|
193
|
+
exports.web3FromSource = web3FromSource;
|
|
283
194
|
/**
|
|
284
195
|
* @summary Find a specific provider that provides a specific address
|
|
285
196
|
* @description
|
|
@@ -287,21 +198,21 @@ async function web3FromSource(source) {
|
|
|
287
198
|
* available to the page.
|
|
288
199
|
*/
|
|
289
200
|
async function web3FromAddress(address) {
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
201
|
+
if (!web3EnablePromise) {
|
|
202
|
+
return throwError('web3FromAddress');
|
|
203
|
+
}
|
|
204
|
+
const accounts = await web3Accounts();
|
|
205
|
+
let found;
|
|
206
|
+
if (address) {
|
|
207
|
+
const accountU8a = (0, util_crypto_1.decodeAddress)(address);
|
|
208
|
+
found = accounts.find((account) => (0, util_1.u8aEq)((0, util_crypto_1.decodeAddress)(account.address), accountU8a));
|
|
209
|
+
}
|
|
210
|
+
if (!found) {
|
|
211
|
+
throw new Error(`web3FromAddress: Unable to find injected ${address}`);
|
|
212
|
+
}
|
|
213
|
+
return web3FromSource(found.meta.source);
|
|
303
214
|
}
|
|
304
|
-
|
|
215
|
+
exports.web3FromAddress = web3FromAddress;
|
|
305
216
|
/**
|
|
306
217
|
* @summary List all providers exposed by one source
|
|
307
218
|
* @description
|
|
@@ -309,16 +220,14 @@ async function web3FromAddress(address) {
|
|
|
309
220
|
* of RPC providers that any extension may supply.
|
|
310
221
|
*/
|
|
311
222
|
async function web3ListRpcProviders(source) {
|
|
312
|
-
|
|
313
|
-
provider
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
return
|
|
318
|
-
}
|
|
319
|
-
return provider.listProviders();
|
|
223
|
+
const { provider } = await web3FromSource(source);
|
|
224
|
+
if (!provider) {
|
|
225
|
+
console.warn(`Extension ${source} does not expose any provider`);
|
|
226
|
+
return null;
|
|
227
|
+
}
|
|
228
|
+
return provider.listProviders();
|
|
320
229
|
}
|
|
321
|
-
|
|
230
|
+
exports.web3ListRpcProviders = web3ListRpcProviders;
|
|
322
231
|
/**
|
|
323
232
|
* @summary Start an RPC provider provider by a specific source
|
|
324
233
|
* @description
|
|
@@ -327,15 +236,11 @@ async function web3ListRpcProviders(source) {
|
|
|
327
236
|
* specified extension source.
|
|
328
237
|
*/
|
|
329
238
|
async function web3UseRpcProvider(source, key) {
|
|
330
|
-
|
|
331
|
-
provider
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
meta,
|
|
339
|
-
provider
|
|
340
|
-
};
|
|
341
|
-
}
|
|
239
|
+
const { provider } = await web3FromSource(source);
|
|
240
|
+
if (!provider) {
|
|
241
|
+
throw new Error(`Extension ${source} does not expose any provider`);
|
|
242
|
+
}
|
|
243
|
+
const meta = await provider.startProvider(key);
|
|
244
|
+
return { meta, provider };
|
|
245
|
+
}
|
|
246
|
+
exports.web3UseRpcProvider = web3UseRpcProvider;
|
package/cjs/detectOther.js
CHANGED
|
@@ -1,11 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _packageInfo = require("@polkadot/extension-inject/cjs/packageInfo");
|
|
8
|
-
// Copyright 2017-2023 @polkadot/extension-dapp authors & contributors
|
|
9
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
10
|
-
var _default = [_packageInfo.packageInfo];
|
|
11
|
-
exports.default = _default;
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const packageInfo_1 = require("@polkadot/extension-inject/cjs/packageInfo");
|
|
4
|
+
exports.default = [packageInfo_1.packageInfo];
|
package/cjs/detectPackage.js
CHANGED
|
@@ -1,12 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
9
|
-
|
|
10
|
-
// Do not edit, auto-generated by @polkadot/dev
|
|
11
|
-
|
|
12
|
-
(0, _util.detectPackage)(_packageInfo.packageInfo, null, _detectOther.default);
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const util_1 = require("@polkadot/util");
|
|
5
|
+
const detectOther_js_1 = tslib_1.__importDefault(require("./detectOther.js"));
|
|
6
|
+
const packageInfo_js_1 = require("./packageInfo.js");
|
|
7
|
+
(0, util_1.detectPackage)(packageInfo_js_1.packageInfo, null, detectOther_js_1.default);
|
package/cjs/index.js
CHANGED
|
@@ -1,16 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
});
|
|
6
|
-
var _bundle = require("./bundle");
|
|
7
|
-
Object.keys(_bundle).forEach(function (key) {
|
|
8
|
-
if (key === "default" || key === "__esModule") return;
|
|
9
|
-
if (key in exports && exports[key] === _bundle[key]) return;
|
|
10
|
-
Object.defineProperty(exports, key, {
|
|
11
|
-
enumerable: true,
|
|
12
|
-
get: function () {
|
|
13
|
-
return _bundle[key];
|
|
14
|
-
}
|
|
15
|
-
});
|
|
16
|
-
});
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
tslib_1.__exportStar(require("./bundle.js"), exports);
|
package/cjs/packageInfo.js
CHANGED
|
@@ -1,18 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.packageInfo = void 0;
|
|
7
|
-
|
|
8
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
9
|
-
|
|
10
|
-
// Do not edit, auto-generated by @polkadot/dev
|
|
11
|
-
|
|
12
|
-
const packageInfo = {
|
|
13
|
-
name: '@polkadot/extension-dapp',
|
|
14
|
-
path: typeof __dirname === 'string' ? __dirname : 'auto',
|
|
15
|
-
type: 'cjs',
|
|
16
|
-
version: '0.44.9'
|
|
17
|
-
};
|
|
18
|
-
exports.packageInfo = packageInfo;
|
|
4
|
+
exports.packageInfo = { name: '@polkadot/extension-dapp', path: typeof __dirname === 'string' ? __dirname : 'auto', type: 'cjs', version: '0.45.2' };
|
package/cjs/util.js
CHANGED
|
@@ -1,18 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.documentReadyPromise = documentReadyPromise;
|
|
7
|
-
// Copyright 2019-2023 @polkadot/extension-dapp authors & contributors
|
|
8
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
9
|
-
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.documentReadyPromise = void 0;
|
|
10
4
|
function documentReadyPromise(creator) {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
5
|
+
return new Promise((resolve) => {
|
|
6
|
+
if (document.readyState === 'complete') {
|
|
7
|
+
resolve(creator());
|
|
8
|
+
}
|
|
9
|
+
else {
|
|
10
|
+
window.addEventListener('load', () => resolve(creator()));
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
exports.documentReadyPromise = documentReadyPromise;
|
package/cjs/wrapBytes.js
CHANGED
|
@@ -1,22 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.wrapBytes = exports.unwrapBytes = exports.isWrapped = exports.PREFIX = exports.POSTFIX = exports.ETHEREUM = void 0;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
exports.
|
|
13
|
-
|
|
14
|
-
exports.POSTFIX = POSTFIX;
|
|
15
|
-
const PREFIX = _util.U8A_WRAP_PREFIX;
|
|
16
|
-
exports.PREFIX = PREFIX;
|
|
17
|
-
const isWrapped = _util.u8aIsWrapped;
|
|
18
|
-
exports.isWrapped = isWrapped;
|
|
19
|
-
const unwrapBytes = _util.u8aUnwrapBytes;
|
|
20
|
-
exports.unwrapBytes = unwrapBytes;
|
|
21
|
-
const wrapBytes = _util.u8aWrapBytes;
|
|
22
|
-
exports.wrapBytes = wrapBytes;
|
|
4
|
+
const util_1 = require("@polkadot/util");
|
|
5
|
+
exports.ETHEREUM = util_1.U8A_WRAP_ETHEREUM;
|
|
6
|
+
exports.POSTFIX = util_1.U8A_WRAP_POSTFIX;
|
|
7
|
+
exports.PREFIX = util_1.U8A_WRAP_PREFIX;
|
|
8
|
+
exports.isWrapped = util_1.u8aIsWrapped;
|
|
9
|
+
exports.unwrapBytes = util_1.u8aUnwrapBytes;
|
|
10
|
+
exports.wrapBytes = util_1.u8aWrapBytes;
|
package/detectOther.js
CHANGED
package/detectPackage.js
CHANGED
|
@@ -1,9 +1,4 @@
|
|
|
1
|
-
// Copyright 2017-2023 @polkadot/extension-dapp authors & contributors
|
|
2
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
|
|
4
|
-
// Do not edit, auto-generated by @polkadot/dev
|
|
5
|
-
|
|
6
1
|
import { detectPackage } from '@polkadot/util';
|
|
7
|
-
import others from
|
|
8
|
-
import { packageInfo } from
|
|
2
|
+
import others from './detectOther.js';
|
|
3
|
+
import { packageInfo } from './packageInfo.js';
|
|
9
4
|
detectPackage(packageInfo, null, others);
|