@polkadot/extension-dapp 0.44.8 → 0.45.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/bundle-polkadot-extension-dapp.js +183 -213
- package/bundle.d.ts +48 -0
- package/bundle.js +204 -209
- package/cjs/bundle.js +219 -272
- 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.js +1 -7
- package/package.json +9 -6
- package/packageInfo.js +1 -11
- package/util.js +8 -10
- package/wrapBytes.js +0 -3
|
@@ -1,234 +1,204 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@polkadot/util'), require('@polkadot/util-crypto')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define(['exports', '@polkadot/util', '@polkadot/util-crypto'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.polkadotExtensionDapp = {}, global.polkadotUtil, global.polkadotUtilCrypto));
|
|
5
5
|
})(this, (function (exports, util, utilCrypto) { 'use strict';
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
const global = typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : window;
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
9
|
+
function documentReadyPromise(creator) {
|
|
10
|
+
return new Promise((resolve) => {
|
|
11
|
+
if (document.readyState === 'complete') {
|
|
12
|
+
resolve(creator());
|
|
13
|
+
}
|
|
14
|
+
else {
|
|
15
|
+
window.addEventListener('load', () => resolve(creator()));
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
}
|
|
18
19
|
|
|
19
|
-
|
|
20
|
-
name: '@polkadot/extension-dapp',
|
|
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
|
-
type: 'esm',
|
|
23
|
-
version: '0.44.8'
|
|
24
|
-
};
|
|
20
|
+
const packageInfo = { name: '@polkadot/extension-dapp', path: (({ url: (typeof document === 'undefined' && typeof location === 'undefined' ? require('u' + 'rl').pathToFileURL(__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' ? require('u' + 'rl').pathToFileURL(__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' ? require('u' + 'rl').pathToFileURL(__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' ? require('u' + 'rl').pathToFileURL(__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', type: 'esm', version: '0.45.1' };
|
|
25
21
|
|
|
26
|
-
|
|
27
|
-
|
|
22
|
+
const unwrapBytes = util.u8aUnwrapBytes;
|
|
23
|
+
const wrapBytes = util.u8aWrapBytes;
|
|
28
24
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
throw new Error(`${method}: web3Enable(originName) needs to be called before ${method}`);
|
|
39
|
-
}
|
|
40
|
-
function mapAccounts(source, list, ss58Format) {
|
|
41
|
-
return list.map(({
|
|
42
|
-
address,
|
|
43
|
-
genesisHash,
|
|
44
|
-
name,
|
|
45
|
-
type
|
|
46
|
-
}) => ({
|
|
47
|
-
address: address.length === 42 ? address : utilCrypto.encodeAddress(utilCrypto.decodeAddress(address), ss58Format),
|
|
48
|
-
meta: {
|
|
49
|
-
genesisHash,
|
|
50
|
-
name,
|
|
51
|
-
source
|
|
52
|
-
},
|
|
53
|
-
type
|
|
54
|
-
}));
|
|
55
|
-
}
|
|
56
|
-
function filterAccounts(list, genesisHash, type) {
|
|
57
|
-
return list.filter(a => (!a.type || !type || type.includes(a.type)) && (!a.genesisHash || !genesisHash || a.genesisHash === genesisHash));
|
|
58
|
-
}
|
|
59
|
-
exports.isWeb3Injected = web3IsInjected();
|
|
60
|
-
exports.web3EnablePromise = null;
|
|
61
|
-
function getWindowExtensions(originName) {
|
|
62
|
-
return Promise.all(Object.entries(win.injectedWeb3).map(([nameOrHash, {
|
|
63
|
-
connect,
|
|
64
|
-
enable,
|
|
65
|
-
version
|
|
66
|
-
}]) => Promise.resolve().then(() => connect
|
|
67
|
-
? connect(originName) : enable
|
|
68
|
-
? enable(originName).then(e => util.objectSpread({
|
|
69
|
-
name: nameOrHash,
|
|
70
|
-
version: version || 'unknown'
|
|
71
|
-
}, e)) : Promise.reject(new Error('No connect(..) or enable(...) hook found'))).catch(({
|
|
72
|
-
message
|
|
73
|
-
}) => {
|
|
74
|
-
console.error(`Error initializing ${nameOrHash}: ${message}`);
|
|
75
|
-
}))).then(exts => exts.filter(e => !!e));
|
|
76
|
-
}
|
|
77
|
-
function web3Enable(originName, compatInits = []) {
|
|
78
|
-
if (!originName) {
|
|
79
|
-
throw new Error('You must pass a name for your app to the web3Enable function');
|
|
25
|
+
const win = window;
|
|
26
|
+
win.injectedWeb3 = win.injectedWeb3 || {};
|
|
27
|
+
exports.isWeb3Injected = web3IsInjected();
|
|
28
|
+
exports.web3EnablePromise = null;
|
|
29
|
+
function web3IsInjected() {
|
|
30
|
+
return Object
|
|
31
|
+
.values(win.injectedWeb3)
|
|
32
|
+
.filter(({ connect, enable }) => !!(connect || enable))
|
|
33
|
+
.length !== 0;
|
|
80
34
|
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
exports.isWeb3Injected = web3IsInjected();
|
|
97
|
-
console.info(`web3Enable: Enabled ${values.length} extension${values.length !== 1 ? 's' : ''}: ${names.join(', ')}`);
|
|
98
|
-
return values;
|
|
99
|
-
})));
|
|
100
|
-
return exports.web3EnablePromise;
|
|
101
|
-
}
|
|
102
|
-
async function web3Accounts({
|
|
103
|
-
accountType,
|
|
104
|
-
extensions,
|
|
105
|
-
genesisHash,
|
|
106
|
-
ss58Format
|
|
107
|
-
} = {}) {
|
|
108
|
-
if (!exports.web3EnablePromise) {
|
|
109
|
-
return throwError('web3Accounts');
|
|
35
|
+
function throwError(method) {
|
|
36
|
+
throw new Error(`${method}: web3Enable(originName) needs to be called before ${method}`);
|
|
37
|
+
}
|
|
38
|
+
function mapAccounts(source, list, ss58Format) {
|
|
39
|
+
return list.map(({ address, genesisHash, name, type }) => ({
|
|
40
|
+
address: address.length === 42
|
|
41
|
+
? address
|
|
42
|
+
: utilCrypto.encodeAddress(utilCrypto.decodeAddress(address), ss58Format),
|
|
43
|
+
meta: { genesisHash, name, source },
|
|
44
|
+
type
|
|
45
|
+
}));
|
|
46
|
+
}
|
|
47
|
+
function filterAccounts(list, genesisHash, type) {
|
|
48
|
+
return list.filter((a) => (!a.type || !type || type.includes(a.type)) &&
|
|
49
|
+
(!a.genesisHash || !genesisHash || a.genesisHash === genesisHash));
|
|
110
50
|
}
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
retrieved.forEach(result => {
|
|
127
|
-
accounts.push(...result);
|
|
128
|
-
});
|
|
129
|
-
console.info(`web3Accounts: Found ${accounts.length} address${accounts.length !== 1 ? 'es' : ''}`);
|
|
130
|
-
return accounts;
|
|
131
|
-
}
|
|
132
|
-
async function web3AccountsSubscribe(cb, {
|
|
133
|
-
accountType,
|
|
134
|
-
extensions,
|
|
135
|
-
genesisHash,
|
|
136
|
-
ss58Format
|
|
137
|
-
} = {}) {
|
|
138
|
-
if (!exports.web3EnablePromise) {
|
|
139
|
-
return throwError('web3AccountsSubscribe');
|
|
51
|
+
function getWindowExtensions(originName) {
|
|
52
|
+
return Promise
|
|
53
|
+
.all(Object
|
|
54
|
+
.entries(win.injectedWeb3)
|
|
55
|
+
.map(([nameOrHash, { connect, enable, version }]) => Promise
|
|
56
|
+
.resolve()
|
|
57
|
+
.then(() => connect
|
|
58
|
+
? connect(originName)
|
|
59
|
+
: enable
|
|
60
|
+
? enable(originName).then((e) => util.objectSpread({ name: nameOrHash, version: version || 'unknown' }, e))
|
|
61
|
+
: Promise.reject(new Error('No connect(..) or enable(...) hook found')))
|
|
62
|
+
.catch(({ message }) => {
|
|
63
|
+
console.error(`Error initializing ${nameOrHash}: ${message}`);
|
|
64
|
+
})))
|
|
65
|
+
.then((exts) => exts.filter((e) => !!e));
|
|
140
66
|
}
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
return result;
|
|
145
|
-
}, []));
|
|
146
|
-
const sources = await exports.web3EnablePromise;
|
|
147
|
-
const unsubs = sources.filter(({
|
|
148
|
-
name: source
|
|
149
|
-
}) => !extensions || extensions.includes(source)).map(({
|
|
150
|
-
accounts: {
|
|
151
|
-
subscribe
|
|
152
|
-
},
|
|
153
|
-
name: source
|
|
154
|
-
}) => subscribe(result => {
|
|
155
|
-
accounts[source] = result;
|
|
156
|
-
try {
|
|
157
|
-
const result = triggerUpdate();
|
|
158
|
-
if (result && util.isPromise(result)) {
|
|
159
|
-
result.catch(console.error);
|
|
67
|
+
async function filterEnable(caller, extensions) {
|
|
68
|
+
if (!exports.web3EnablePromise) {
|
|
69
|
+
return throwError(caller);
|
|
160
70
|
}
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
}));
|
|
165
|
-
return () => {
|
|
166
|
-
unsubs.forEach(unsub => {
|
|
167
|
-
unsub();
|
|
168
|
-
});
|
|
169
|
-
};
|
|
170
|
-
}
|
|
171
|
-
async function web3FromSource(source) {
|
|
172
|
-
if (!exports.web3EnablePromise) {
|
|
173
|
-
return throwError('web3FromSource');
|
|
71
|
+
const sources = await exports.web3EnablePromise;
|
|
72
|
+
return sources.filter(({ name }) => !extensions ||
|
|
73
|
+
extensions.includes(name));
|
|
174
74
|
}
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
75
|
+
function web3Enable(originName, compatInits = []) {
|
|
76
|
+
if (!originName) {
|
|
77
|
+
throw new Error('You must pass a name for your app to the web3Enable function');
|
|
78
|
+
}
|
|
79
|
+
const initCompat = compatInits.length
|
|
80
|
+
? Promise.all(compatInits.map((c) => c().catch(() => false)))
|
|
81
|
+
: Promise.resolve([true]);
|
|
82
|
+
exports.web3EnablePromise = documentReadyPromise(() => initCompat.then(() => getWindowExtensions(originName)
|
|
83
|
+
.then((values) => values.map((e) => {
|
|
84
|
+
if (!e.accounts.subscribe) {
|
|
85
|
+
e.accounts.subscribe = (cb) => {
|
|
86
|
+
e.accounts
|
|
87
|
+
.get()
|
|
88
|
+
.then(cb)
|
|
89
|
+
.catch(console.error);
|
|
90
|
+
return () => {
|
|
91
|
+
};
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
return e;
|
|
95
|
+
}))
|
|
96
|
+
.catch(() => [])
|
|
97
|
+
.then((values) => {
|
|
98
|
+
const names = values.map(({ name, version }) => `${name}/${version}`);
|
|
99
|
+
exports.isWeb3Injected = web3IsInjected();
|
|
100
|
+
console.info(`web3Enable: Enabled ${values.length} extension${values.length !== 1 ? 's' : ''}: ${names.join(', ')}`);
|
|
101
|
+
return values;
|
|
102
|
+
})));
|
|
103
|
+
return exports.web3EnablePromise;
|
|
104
|
+
}
|
|
105
|
+
async function web3Accounts({ accountType, extensions, genesisHash, ss58Format } = {}) {
|
|
106
|
+
const accounts = [];
|
|
107
|
+
const sources = await filterEnable('web3Accounts', extensions);
|
|
108
|
+
const retrieved = await Promise.all(sources.map(async ({ accounts, name: source }) => {
|
|
109
|
+
try {
|
|
110
|
+
const list = await accounts.get();
|
|
111
|
+
return mapAccounts(source, filterAccounts(list, genesisHash, accountType), ss58Format);
|
|
112
|
+
}
|
|
113
|
+
catch (error) {
|
|
114
|
+
return [];
|
|
115
|
+
}
|
|
116
|
+
}));
|
|
117
|
+
retrieved.forEach((result) => {
|
|
118
|
+
accounts.push(...result);
|
|
119
|
+
});
|
|
120
|
+
console.info(`web3Accounts: Found ${accounts.length} address${accounts.length !== 1 ? 'es' : ''}`);
|
|
121
|
+
return accounts;
|
|
181
122
|
}
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
123
|
+
async function web3AccountsSubscribe(cb, { accountType, extensions, genesisHash, ss58Format } = {}) {
|
|
124
|
+
const sources = await filterEnable('web3AccountsSubscribe', extensions);
|
|
125
|
+
const accounts = {};
|
|
126
|
+
const triggerUpdate = () => cb(Object
|
|
127
|
+
.entries(accounts)
|
|
128
|
+
.reduce((result, [source, list]) => {
|
|
129
|
+
result.push(...mapAccounts(source, filterAccounts(list, genesisHash, accountType), ss58Format));
|
|
130
|
+
return result;
|
|
131
|
+
}, []));
|
|
132
|
+
const unsubs = sources.map(({ accounts: { subscribe }, name: source }) => subscribe((result) => {
|
|
133
|
+
accounts[source] = result;
|
|
134
|
+
try {
|
|
135
|
+
const result = triggerUpdate();
|
|
136
|
+
if (result && util.isPromise(result)) {
|
|
137
|
+
result.catch(console.error);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
catch (error) {
|
|
141
|
+
console.error(error);
|
|
142
|
+
}
|
|
143
|
+
}));
|
|
144
|
+
return () => {
|
|
145
|
+
unsubs.forEach((unsub) => {
|
|
146
|
+
unsub();
|
|
147
|
+
});
|
|
148
|
+
};
|
|
187
149
|
}
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
150
|
+
async function web3FromSource(source) {
|
|
151
|
+
if (!exports.web3EnablePromise) {
|
|
152
|
+
return throwError('web3FromSource');
|
|
153
|
+
}
|
|
154
|
+
const sources = await exports.web3EnablePromise;
|
|
155
|
+
const found = source && sources.find(({ name }) => name === source);
|
|
156
|
+
if (!found) {
|
|
157
|
+
throw new Error(`web3FromSource: Unable to find an injected ${source}`);
|
|
158
|
+
}
|
|
159
|
+
return found;
|
|
193
160
|
}
|
|
194
|
-
|
|
195
|
-
|
|
161
|
+
async function web3FromAddress(address) {
|
|
162
|
+
if (!exports.web3EnablePromise) {
|
|
163
|
+
return throwError('web3FromAddress');
|
|
164
|
+
}
|
|
165
|
+
const accounts = await web3Accounts();
|
|
166
|
+
let found;
|
|
167
|
+
if (address) {
|
|
168
|
+
const accountU8a = utilCrypto.decodeAddress(address);
|
|
169
|
+
found = accounts.find((account) => util.u8aEq(utilCrypto.decodeAddress(account.address), accountU8a));
|
|
170
|
+
}
|
|
171
|
+
if (!found) {
|
|
172
|
+
throw new Error(`web3FromAddress: Unable to find injected ${address}`);
|
|
173
|
+
}
|
|
174
|
+
return web3FromSource(found.meta.source);
|
|
196
175
|
}
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
console.warn(`Extension ${source} does not expose any provider`);
|
|
205
|
-
return null;
|
|
176
|
+
async function web3ListRpcProviders(source) {
|
|
177
|
+
const { provider } = await web3FromSource(source);
|
|
178
|
+
if (!provider) {
|
|
179
|
+
console.warn(`Extension ${source} does not expose any provider`);
|
|
180
|
+
return null;
|
|
181
|
+
}
|
|
182
|
+
return provider.listProviders();
|
|
206
183
|
}
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
throw new Error(`Extension ${source} does not expose any provider`);
|
|
184
|
+
async function web3UseRpcProvider(source, key) {
|
|
185
|
+
const { provider } = await web3FromSource(source);
|
|
186
|
+
if (!provider) {
|
|
187
|
+
throw new Error(`Extension ${source} does not expose any provider`);
|
|
188
|
+
}
|
|
189
|
+
const meta = await provider.startProvider(key);
|
|
190
|
+
return { meta, provider };
|
|
215
191
|
}
|
|
216
|
-
const meta = await provider.startProvider(key);
|
|
217
|
-
return {
|
|
218
|
-
meta,
|
|
219
|
-
provider
|
|
220
|
-
};
|
|
221
|
-
}
|
|
222
192
|
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
193
|
+
exports.packageInfo = packageInfo;
|
|
194
|
+
exports.unwrapBytes = unwrapBytes;
|
|
195
|
+
exports.web3Accounts = web3Accounts;
|
|
196
|
+
exports.web3AccountsSubscribe = web3AccountsSubscribe;
|
|
197
|
+
exports.web3Enable = web3Enable;
|
|
198
|
+
exports.web3FromAddress = web3FromAddress;
|
|
199
|
+
exports.web3FromSource = web3FromSource;
|
|
200
|
+
exports.web3ListRpcProviders = web3ListRpcProviders;
|
|
201
|
+
exports.web3UseRpcProvider = web3UseRpcProvider;
|
|
202
|
+
exports.wrapBytes = wrapBytes;
|
|
233
203
|
|
|
234
204
|
}));
|
package/bundle.d.ts
CHANGED
|
@@ -4,10 +4,58 @@ export { unwrapBytes, wrapBytes } from './wrapBytes';
|
|
|
4
4
|
declare let isWeb3Injected: boolean;
|
|
5
5
|
declare let web3EnablePromise: Promise<InjectedExtension[]> | null;
|
|
6
6
|
export { isWeb3Injected, web3EnablePromise };
|
|
7
|
+
/**
|
|
8
|
+
* @summary Enables all the providers found on the injected window interface
|
|
9
|
+
* @description
|
|
10
|
+
* Enables all injected extensions that has been found on the page. This
|
|
11
|
+
* should be called before making use of any other web3* functions.
|
|
12
|
+
*/
|
|
7
13
|
export declare function web3Enable(originName: string, compatInits?: (() => Promise<boolean>)[]): Promise<InjectedExtension[]>;
|
|
14
|
+
/**
|
|
15
|
+
* @summary Retrieves all the accounts across all providers
|
|
16
|
+
* @description
|
|
17
|
+
* This returns the full list of account available (accross all extensions) to
|
|
18
|
+
* the page. Filtereing options are available of a per-extension, per type and
|
|
19
|
+
* per-genesisHash basis. Optionally the accounts can be encoded with the provided
|
|
20
|
+
* ss58Format
|
|
21
|
+
*/
|
|
8
22
|
export declare function web3Accounts({ accountType, extensions, genesisHash, ss58Format }?: Web3AccountsOptions): Promise<InjectedAccountWithMeta[]>;
|
|
23
|
+
/**
|
|
24
|
+
* @summary Subscribes to all the accounts across all providers
|
|
25
|
+
* @description
|
|
26
|
+
* This is the subscription version of the web3Accounts interface with
|
|
27
|
+
* updates as to when new accounts do become available. The list of filtering
|
|
28
|
+
* options are the same as for the web3Accounts interface.
|
|
29
|
+
*/
|
|
9
30
|
export declare function web3AccountsSubscribe(cb: (accounts: InjectedAccountWithMeta[]) => void | Promise<void>, { accountType, extensions, genesisHash, ss58Format }?: Web3AccountsOptions): Promise<Unsubcall>;
|
|
31
|
+
/**
|
|
32
|
+
* @summary Finds a specific provider based on the name
|
|
33
|
+
* @description
|
|
34
|
+
* This retrieves a specific source (extension) based on the name. In most
|
|
35
|
+
* cases it should not be needed to call it directly (e.g. it is used internally
|
|
36
|
+
* by calls such as web3FromAddress) but would allow operation on a specific
|
|
37
|
+
* known extension.
|
|
38
|
+
*/
|
|
10
39
|
export declare function web3FromSource(source: string): Promise<InjectedExtension>;
|
|
40
|
+
/**
|
|
41
|
+
* @summary Find a specific provider that provides a specific address
|
|
42
|
+
* @description
|
|
43
|
+
* Based on an address, return the provider that has makes this address
|
|
44
|
+
* available to the page.
|
|
45
|
+
*/
|
|
11
46
|
export declare function web3FromAddress(address: string): Promise<InjectedExtension>;
|
|
47
|
+
/**
|
|
48
|
+
* @summary List all providers exposed by one source
|
|
49
|
+
* @description
|
|
50
|
+
* For extensions that supply RPC providers, this call would return the list
|
|
51
|
+
* of RPC providers that any extension may supply.
|
|
52
|
+
*/
|
|
12
53
|
export declare function web3ListRpcProviders(source: string): Promise<ProviderList | null>;
|
|
54
|
+
/**
|
|
55
|
+
* @summary Start an RPC provider provider by a specific source
|
|
56
|
+
* @description
|
|
57
|
+
* For extensions that supply RPC providers, this call would return an
|
|
58
|
+
* enabled provider (initialized with the specific key) from the
|
|
59
|
+
* specified extension source.
|
|
60
|
+
*/
|
|
13
61
|
export declare function web3UseRpcProvider(source: string, key: string): Promise<InjectedProviderWithMeta>;
|