@onekeyfe/onekey-aptos-provider 2.0.0-alpha.10 → 2.0.0-alpha.12
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/OnekeyAptosProvider.d.ts +5 -5
- package/dist/OnekeyAptosProvider.js +4 -4
- package/dist/OnekeyMartianAptosProvider.d.ts +3 -3
- package/dist/OnekeyMartianAptosProvider.js +4 -4
- package/dist/cjs/OnekeyAptosProvider.js +4 -4
- package/dist/cjs/OnekeyMartianAptosProvider.js +4 -4
- package/dist/cjs/index.js +5 -1
- package/dist/type-utils.d.ts +2 -2
- package/dist/types.d.ts +3 -3
- package/package.json +6 -6
|
@@ -3,7 +3,7 @@ import { ProviderAptosBase } from './ProviderAptosBase';
|
|
|
3
3
|
import { AptosAccountInfo, SignMessagePayload, SignMessageResponse } from './types';
|
|
4
4
|
import { IJsonRpcRequest } from '@onekeyfe/cross-inpage-provider-types';
|
|
5
5
|
import { Types } from 'aptos';
|
|
6
|
-
export
|
|
6
|
+
export type AptosProviderType = 'petra' | 'martian';
|
|
7
7
|
declare const PROVIDER_EVENTS: {
|
|
8
8
|
readonly connect: "connect";
|
|
9
9
|
readonly disconnect: "disconnect";
|
|
@@ -11,14 +11,14 @@ declare const PROVIDER_EVENTS: {
|
|
|
11
11
|
readonly networkChange: "networkChange";
|
|
12
12
|
readonly message_low_level: "message_low_level";
|
|
13
13
|
};
|
|
14
|
-
|
|
14
|
+
type AptosProviderEventsMap = {
|
|
15
15
|
[PROVIDER_EVENTS.connect]: (account: string) => void;
|
|
16
16
|
[PROVIDER_EVENTS.disconnect]: () => void;
|
|
17
17
|
[PROVIDER_EVENTS.accountChanged]: (account: string | null) => void;
|
|
18
18
|
[PROVIDER_EVENTS.networkChange]: (name: string | null) => void;
|
|
19
19
|
[PROVIDER_EVENTS.message_low_level]: (payload: IJsonRpcRequest) => void;
|
|
20
20
|
};
|
|
21
|
-
export
|
|
21
|
+
export type AptosRequest = {
|
|
22
22
|
'connect': () => Promise<AptosAccountInfo>;
|
|
23
23
|
'disconnect': () => Promise<void>;
|
|
24
24
|
'account': () => Promise<AptosAccountInfo>;
|
|
@@ -28,7 +28,7 @@ export declare type AptosRequest = {
|
|
|
28
28
|
'signAndSubmitTransaction': (transactions: Types.TransactionPayload) => Promise<string>;
|
|
29
29
|
'signTransaction': (transactions: Types.TransactionPayload) => Promise<string>;
|
|
30
30
|
};
|
|
31
|
-
export
|
|
31
|
+
export type PROVIDER_EVENTS_STRINGS = keyof typeof PROVIDER_EVENTS;
|
|
32
32
|
export interface IProviderAptos extends ProviderAptosBase {
|
|
33
33
|
publicKey: string | null;
|
|
34
34
|
/**
|
|
@@ -59,7 +59,7 @@ export interface IProviderAptos extends ProviderAptosBase {
|
|
|
59
59
|
network(): Promise<string>;
|
|
60
60
|
getNetworkURL(): Promise<string>;
|
|
61
61
|
}
|
|
62
|
-
|
|
62
|
+
type OneKeyAptosProviderProps = IInpageProviderConfig & {
|
|
63
63
|
timeout?: number;
|
|
64
64
|
};
|
|
65
65
|
declare class ProviderAptos extends ProviderAptosBase implements IProviderAptos {
|
|
@@ -21,16 +21,16 @@ function isWalletEventMethodMatch({ method, name }) {
|
|
|
21
21
|
return method === `wallet_events_${name}`;
|
|
22
22
|
}
|
|
23
23
|
class ProviderAptos extends ProviderAptosBase {
|
|
24
|
+
get publicKey() {
|
|
25
|
+
var _a, _b;
|
|
26
|
+
return (_b = (_a = this._account) === null || _a === void 0 ? void 0 : _a.publicKey) !== null && _b !== void 0 ? _b : null;
|
|
27
|
+
}
|
|
24
28
|
constructor(props) {
|
|
25
29
|
super(Object.assign(Object.assign({}, props), { bridge: props.bridge || getOrCreateExtInjectedJsBridge({ timeout: props.timeout }) }));
|
|
26
30
|
this._account = null;
|
|
27
31
|
this.aptosProviderType = 'petra';
|
|
28
32
|
this._registerEvents();
|
|
29
33
|
}
|
|
30
|
-
get publicKey() {
|
|
31
|
-
var _a, _b;
|
|
32
|
-
return (_b = (_a = this._account) === null || _a === void 0 ? void 0 : _a.publicKey) !== null && _b !== void 0 ? _b : null;
|
|
33
|
-
}
|
|
34
34
|
_registerEvents() {
|
|
35
35
|
window.addEventListener('onekey_bridge_disconnect', () => {
|
|
36
36
|
this._handleDisconnected();
|
|
@@ -2,8 +2,8 @@ import { IInpageProviderConfig } from '@onekeyfe/cross-inpage-provider-core';
|
|
|
2
2
|
import { Types, MaybeHexString } from 'aptos';
|
|
3
3
|
import { TxnPayload, TxnOptions } from './types';
|
|
4
4
|
import { ProviderAptos } from './OnekeyAptosProvider';
|
|
5
|
-
|
|
6
|
-
export
|
|
5
|
+
type AnyNumber = bigint | number;
|
|
6
|
+
export type AptosRequestMartian = {
|
|
7
7
|
'martianSignAndSubmitTransaction': (transactions: string) => Promise<string>;
|
|
8
8
|
'martianSignTransaction': (transactions: string) => Promise<string>;
|
|
9
9
|
'signAndSubmitTransaction': (transactions: Types.TransactionPayload) => Promise<string>;
|
|
@@ -35,7 +35,7 @@ export declare type AptosRequestMartian = {
|
|
|
35
35
|
}>;
|
|
36
36
|
'getLedgerInfo': () => Promise<Types.IndexResponse>;
|
|
37
37
|
};
|
|
38
|
-
|
|
38
|
+
type OneKeyAptosProviderProps = IInpageProviderConfig & {
|
|
39
39
|
timeout?: number;
|
|
40
40
|
};
|
|
41
41
|
declare class ProviderAptosMartian extends ProviderAptos {
|
|
@@ -11,15 +11,15 @@ import { getOrCreateExtInjectedJsBridge } from '@onekeyfe/extension-bridge-injec
|
|
|
11
11
|
import { ProviderAptos } from './OnekeyAptosProvider';
|
|
12
12
|
import { web3Errors } from '@onekeyfe/cross-inpage-provider-errors';
|
|
13
13
|
class ProviderAptosMartian extends ProviderAptos {
|
|
14
|
+
get publicKey() {
|
|
15
|
+
var _a, _b;
|
|
16
|
+
return (_b = (_a = this._account) === null || _a === void 0 ? void 0 : _a.publicKey) !== null && _b !== void 0 ? _b : null;
|
|
17
|
+
}
|
|
14
18
|
constructor(props) {
|
|
15
19
|
super(Object.assign(Object.assign({}, props), { bridge: props.bridge || getOrCreateExtInjectedJsBridge({ timeout: props.timeout }) }));
|
|
16
20
|
this.isMartian = true;
|
|
17
21
|
window.dispatchEvent(new Event('martian#initialized'));
|
|
18
22
|
}
|
|
19
|
-
get publicKey() {
|
|
20
|
-
var _a, _b;
|
|
21
|
-
return (_b = (_a = this._account) === null || _a === void 0 ? void 0 : _a.publicKey) !== null && _b !== void 0 ? _b : null;
|
|
22
|
-
}
|
|
23
23
|
_callMartianBridge(params) {
|
|
24
24
|
params.aptosProviderType = this.aptosProviderType;
|
|
25
25
|
return this.bridgeRequest(params);
|
|
@@ -24,16 +24,16 @@ function isWalletEventMethodMatch({ method, name }) {
|
|
|
24
24
|
return method === `wallet_events_${name}`;
|
|
25
25
|
}
|
|
26
26
|
class ProviderAptos extends ProviderAptosBase_1.ProviderAptosBase {
|
|
27
|
+
get publicKey() {
|
|
28
|
+
var _a, _b;
|
|
29
|
+
return (_b = (_a = this._account) === null || _a === void 0 ? void 0 : _a.publicKey) !== null && _b !== void 0 ? _b : null;
|
|
30
|
+
}
|
|
27
31
|
constructor(props) {
|
|
28
32
|
super(Object.assign(Object.assign({}, props), { bridge: props.bridge || (0, extension_bridge_injected_1.getOrCreateExtInjectedJsBridge)({ timeout: props.timeout }) }));
|
|
29
33
|
this._account = null;
|
|
30
34
|
this.aptosProviderType = 'petra';
|
|
31
35
|
this._registerEvents();
|
|
32
36
|
}
|
|
33
|
-
get publicKey() {
|
|
34
|
-
var _a, _b;
|
|
35
|
-
return (_b = (_a = this._account) === null || _a === void 0 ? void 0 : _a.publicKey) !== null && _b !== void 0 ? _b : null;
|
|
36
|
-
}
|
|
37
37
|
_registerEvents() {
|
|
38
38
|
window.addEventListener('onekey_bridge_disconnect', () => {
|
|
39
39
|
this._handleDisconnected();
|
|
@@ -14,15 +14,15 @@ const extension_bridge_injected_1 = require("@onekeyfe/extension-bridge-injected
|
|
|
14
14
|
const OnekeyAptosProvider_1 = require("./OnekeyAptosProvider");
|
|
15
15
|
const cross_inpage_provider_errors_1 = require("@onekeyfe/cross-inpage-provider-errors");
|
|
16
16
|
class ProviderAptosMartian extends OnekeyAptosProvider_1.ProviderAptos {
|
|
17
|
+
get publicKey() {
|
|
18
|
+
var _a, _b;
|
|
19
|
+
return (_b = (_a = this._account) === null || _a === void 0 ? void 0 : _a.publicKey) !== null && _b !== void 0 ? _b : null;
|
|
20
|
+
}
|
|
17
21
|
constructor(props) {
|
|
18
22
|
super(Object.assign(Object.assign({}, props), { bridge: props.bridge || (0, extension_bridge_injected_1.getOrCreateExtInjectedJsBridge)({ timeout: props.timeout }) }));
|
|
19
23
|
this.isMartian = true;
|
|
20
24
|
window.dispatchEvent(new Event('martian#initialized'));
|
|
21
25
|
}
|
|
22
|
-
get publicKey() {
|
|
23
|
-
var _a, _b;
|
|
24
|
-
return (_b = (_a = this._account) === null || _a === void 0 ? void 0 : _a.publicKey) !== null && _b !== void 0 ? _b : null;
|
|
25
|
-
}
|
|
26
26
|
_callMartianBridge(params) {
|
|
27
27
|
params.aptosProviderType = this.aptosProviderType;
|
|
28
28
|
return this.bridgeRequest(params);
|
package/dist/cjs/index.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
package/dist/type-utils.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export
|
|
1
|
+
export type WireStringified<T> = T extends Array<infer P> ? Array<WireStringified<P>> : T extends object ? {
|
|
2
2
|
[K in keyof T]: WireStringified<T[K]>;
|
|
3
3
|
} : T;
|
|
4
|
-
export
|
|
4
|
+
export type ResolvePromise<T> = T extends Promise<infer P> ? P : T;
|
package/dist/types.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export
|
|
1
|
+
export type AptosAccountInfo = {
|
|
2
2
|
publicKey: string;
|
|
3
3
|
address: string;
|
|
4
4
|
};
|
|
5
|
-
export
|
|
5
|
+
export type TxnOptions = {
|
|
6
6
|
sender?: string;
|
|
7
7
|
sequence_number?: string;
|
|
8
8
|
max_gas_amount?: string;
|
|
@@ -10,7 +10,7 @@ export declare type TxnOptions = {
|
|
|
10
10
|
gas_currency_code?: string;
|
|
11
11
|
expiration_timestamp_secs?: string;
|
|
12
12
|
};
|
|
13
|
-
export
|
|
13
|
+
export type TxnPayload = {
|
|
14
14
|
function: string;
|
|
15
15
|
type_arguments: any[];
|
|
16
16
|
arguments: any[];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onekeyfe/onekey-aptos-provider",
|
|
3
|
-
"version": "2.0.0-alpha.
|
|
3
|
+
"version": "2.0.0-alpha.12",
|
|
4
4
|
"keywords": [
|
|
5
5
|
"cross-inpage-provider"
|
|
6
6
|
],
|
|
@@ -28,12 +28,12 @@
|
|
|
28
28
|
"start": "tsc --watch"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@onekeyfe/cross-inpage-provider-core": "2.0.0-alpha.
|
|
32
|
-
"@onekeyfe/cross-inpage-provider-errors": "2.0.0-alpha.
|
|
33
|
-
"@onekeyfe/cross-inpage-provider-types": "2.0.0-alpha.
|
|
34
|
-
"@onekeyfe/extension-bridge-injected": "2.0.0-alpha.
|
|
31
|
+
"@onekeyfe/cross-inpage-provider-core": "2.0.0-alpha.12",
|
|
32
|
+
"@onekeyfe/cross-inpage-provider-errors": "2.0.0-alpha.12",
|
|
33
|
+
"@onekeyfe/cross-inpage-provider-types": "2.0.0-alpha.12",
|
|
34
|
+
"@onekeyfe/extension-bridge-injected": "2.0.0-alpha.12",
|
|
35
35
|
"aptos": "^1.3.17",
|
|
36
36
|
"eth-rpc-errors": "^4.0.3"
|
|
37
37
|
},
|
|
38
|
-
"gitHead": "
|
|
38
|
+
"gitHead": "cac152562e94842da458c2c9a8bafc3652aa1fcd"
|
|
39
39
|
}
|