@getpara/graz-connector 0.1.0-alpha.5 → 2.0.0-dev.10
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/__tests__/connector.test.tsx +491 -0
- package/__tests__/connectorModal.test.tsx +148 -0
- package/dist/chunk-M66XENHI.js +25 -0
- package/dist/connector.d.ts +49 -0
- package/dist/connector.js +274 -0
- package/dist/index.d.ts +2 -3
- package/dist/index.js +4 -9
- package/package.json +31 -13
- package/src/connector.ts +269 -0
- package/src/index.ts +2 -3
- package/tsconfig.json +3 -3
- package/vitest.config.js +22 -0
- package/dist/ParaGrazProvider.d.ts +0 -33
- package/dist/ParaGrazProvider.js +0 -136
- package/dist/chunk-IV3L3JVM.js +0 -46
- package/dist/connectorModal.d.ts +0 -2
- package/dist/connectorModal.js +0 -36
- package/src/ParaGrazProvider.ts +0 -165
- package/src/connectorModal.tsx +0 -32
package/tsconfig.json
CHANGED
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
"jsx": "react-jsx",
|
|
7
7
|
"module": "ESNext",
|
|
8
8
|
"declaration": true,
|
|
9
|
-
"declarationDir": "dist"
|
|
9
|
+
"declarationDir": "./dist"
|
|
10
10
|
},
|
|
11
|
-
"include": ["
|
|
12
|
-
"exclude": ["node_modules", "dist"]
|
|
11
|
+
"include": ["src/**/*.ts", "src/**/*.tsx"],
|
|
12
|
+
"exclude": ["node_modules", "dist", "**/*.test.ts", "**/*.test.tsx", "__tests__"]
|
|
13
13
|
}
|
package/vitest.config.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { mergeConfig } from 'vite';
|
|
2
|
+
import baseConfig from '../../vitest.config.js';
|
|
3
|
+
|
|
4
|
+
export default mergeConfig(baseConfig, {
|
|
5
|
+
test: {
|
|
6
|
+
environment: 'jsdom',
|
|
7
|
+
coverage: {
|
|
8
|
+
provider: 'v8',
|
|
9
|
+
reporter: ['html', 'text'],
|
|
10
|
+
all: true,
|
|
11
|
+
include: ['src/**/*.{ts,tsx,js,jsx}'],
|
|
12
|
+
thresholds: {
|
|
13
|
+
lines: 98,
|
|
14
|
+
functions: 90,
|
|
15
|
+
branches: 98,
|
|
16
|
+
statements: 98,
|
|
17
|
+
},
|
|
18
|
+
reportOnFailure: true,
|
|
19
|
+
exclude: ['src/index.ts'],
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
});
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import ParaWeb from '@getpara/react-sdk';
|
|
2
|
-
import type { Environment, ParaModalProps } from '@getpara/react-sdk';
|
|
3
|
-
import type { Wallet, Key as GrazKey } from 'graz';
|
|
4
|
-
import type { OfflineAminoSigner, OfflineDirectSigner, AminoSignResponse, StdSignDoc, StdSignature } from '@keplr-wallet/types';
|
|
5
|
-
export type ParaGrazModalProps = Omit<ParaModalProps, 'para'>;
|
|
6
|
-
export interface ParaGrazConfig {
|
|
7
|
-
apiKey: string;
|
|
8
|
-
env: Environment;
|
|
9
|
-
modalProps?: ParaGrazModalProps;
|
|
10
|
-
}
|
|
11
|
-
export declare class ParaGrazInternalProvider implements Omit<Wallet, 'experimentalSuggestChain'> {
|
|
12
|
-
private paraWebClient;
|
|
13
|
-
private config;
|
|
14
|
-
private isModalClosed;
|
|
15
|
-
constructor(config: ParaGrazConfig);
|
|
16
|
-
closeModal: () => void;
|
|
17
|
-
private waitForLogin;
|
|
18
|
-
private waitForAccounts;
|
|
19
|
-
enable(chainIds: string | string[]): Promise<void>;
|
|
20
|
-
getParaWebClient(): ParaWeb;
|
|
21
|
-
getConfig(): ParaGrazConfig;
|
|
22
|
-
getKey(chainId: string): Promise<GrazKey>;
|
|
23
|
-
getOfflineSigner(chainId: string): OfflineAminoSigner & OfflineDirectSigner;
|
|
24
|
-
getOfflineSignerOnlyAmino(chainId: string): OfflineAminoSigner;
|
|
25
|
-
getOfflineSignerAuto(chainId: string): Promise<OfflineAminoSigner | OfflineDirectSigner>;
|
|
26
|
-
signAmino(chainId: string, signer: string, signDoc: StdSignDoc, signOptions?: any): Promise<AminoSignResponse>;
|
|
27
|
-
signDirect(chainId: string, signer: string, signDoc: any, signOptions?: any): Promise<{
|
|
28
|
-
signed: any;
|
|
29
|
-
signature: StdSignature;
|
|
30
|
-
}>;
|
|
31
|
-
signArbitrary(chainId: string, signer: string, data: string | Uint8Array): Promise<StdSignature>;
|
|
32
|
-
disconnect(): Promise<void>;
|
|
33
|
-
}
|
package/dist/ParaGrazProvider.js
DELETED
|
@@ -1,136 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import {
|
|
3
|
-
__async
|
|
4
|
-
} from "./chunk-IV3L3JVM.js";
|
|
5
|
-
import ParaWeb from "@getpara/react-sdk";
|
|
6
|
-
import { ParaProtoSigner } from "@getpara/cosmjs-v0-integration";
|
|
7
|
-
import { fromBech32 } from "@cosmjs/encoding";
|
|
8
|
-
import { renderModal } from "./connectorModal.js";
|
|
9
|
-
const TEN_MINUTES_MS = 6e5;
|
|
10
|
-
class ParaGrazInternalProvider {
|
|
11
|
-
constructor(config) {
|
|
12
|
-
this.closeModal = () => {
|
|
13
|
-
this.isModalClosed = true;
|
|
14
|
-
};
|
|
15
|
-
if (!config || !config.apiKey || !config.env) {
|
|
16
|
-
throw new Error("Para Connector: Missing API Key or Environment in config.");
|
|
17
|
-
}
|
|
18
|
-
this.config = config;
|
|
19
|
-
this.paraWebClient = new ParaWeb(config.env, config.apiKey);
|
|
20
|
-
this.isModalClosed = true;
|
|
21
|
-
}
|
|
22
|
-
waitForLogin() {
|
|
23
|
-
return __async(this, arguments, function* (timeoutMs = TEN_MINUTES_MS) {
|
|
24
|
-
const startTime = Date.now();
|
|
25
|
-
while (Date.now() - startTime < timeoutMs) {
|
|
26
|
-
if (yield this.paraWebClient.isFullyLoggedIn()) {
|
|
27
|
-
return true;
|
|
28
|
-
}
|
|
29
|
-
if (this.isModalClosed) {
|
|
30
|
-
throw new Error("user closed modal");
|
|
31
|
-
}
|
|
32
|
-
yield new Promise((resolve) => setTimeout(resolve, 2e3));
|
|
33
|
-
}
|
|
34
|
-
throw new Error("timed out waiting for user to log in");
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
waitForAccounts(chainIds, timeoutMs = 5e3) {
|
|
38
|
-
return __async(this, null, function* () {
|
|
39
|
-
const startTime = Date.now();
|
|
40
|
-
while (Date.now() - startTime < timeoutMs) {
|
|
41
|
-
const wallets = Object.values(this.paraWebClient.getWalletsByType("COSMOS"));
|
|
42
|
-
if (wallets && wallets.length > 0) {
|
|
43
|
-
return true;
|
|
44
|
-
}
|
|
45
|
-
yield new Promise((resolve) => setTimeout(resolve, 500));
|
|
46
|
-
}
|
|
47
|
-
throw new Error("timed out waiting for accounts to load");
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
enable(chainIds) {
|
|
51
|
-
return __async(this, null, function* () {
|
|
52
|
-
if (yield this.paraWebClient.isFullyLoggedIn()) {
|
|
53
|
-
const wallets = Object.values(this.paraWebClient.getWalletsByType("COSMOS"));
|
|
54
|
-
if (wallets && wallets.length > 0) {
|
|
55
|
-
return;
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
this.isModalClosed = false;
|
|
59
|
-
renderModal(this.paraWebClient, this.config.modalProps, () => {
|
|
60
|
-
this.isModalClosed = true;
|
|
61
|
-
});
|
|
62
|
-
yield this.waitForLogin();
|
|
63
|
-
try {
|
|
64
|
-
yield this.waitForAccounts(chainIds);
|
|
65
|
-
} catch (error) {
|
|
66
|
-
throw new Error("accounts not available after login");
|
|
67
|
-
}
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
getParaWebClient() {
|
|
71
|
-
return this.paraWebClient;
|
|
72
|
-
}
|
|
73
|
-
getConfig() {
|
|
74
|
-
return this.config;
|
|
75
|
-
}
|
|
76
|
-
getKey(chainId) {
|
|
77
|
-
return __async(this, null, function* () {
|
|
78
|
-
const wallets = Object.values(this.paraWebClient.getWalletsByType("COSMOS"));
|
|
79
|
-
if (wallets.length === 0) {
|
|
80
|
-
throw new Error(`Para Connector: No wallets found for chainId ${chainId}`);
|
|
81
|
-
}
|
|
82
|
-
const walletSigner = new ParaProtoSigner(this.paraWebClient, wallets[0].id);
|
|
83
|
-
const accountData = yield walletSigner.getAccounts();
|
|
84
|
-
if (accountData.length === 0) {
|
|
85
|
-
throw new Error(`Para Connector: No accounts found for wallet ${wallets[0].id}`);
|
|
86
|
-
}
|
|
87
|
-
return {
|
|
88
|
-
address: fromBech32(accountData[0].address).data,
|
|
89
|
-
bech32Address: accountData[0].address,
|
|
90
|
-
algo: accountData[0].algo,
|
|
91
|
-
name: accountData[0].address,
|
|
92
|
-
pubKey: accountData[0].pubkey,
|
|
93
|
-
isKeystone: false,
|
|
94
|
-
isNanoLedger: false
|
|
95
|
-
};
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
|
-
getOfflineSigner(chainId) {
|
|
99
|
-
console.warn(`Para Connector: getOfflineSigner called for ${chainId} - Needs Implementation`);
|
|
100
|
-
throw new Error("getOfflineSigner not implemented");
|
|
101
|
-
}
|
|
102
|
-
getOfflineSignerOnlyAmino(chainId) {
|
|
103
|
-
console.warn(`Para Connector: getOfflineSignerOnlyAmino called for ${chainId} - Needs Implementation`);
|
|
104
|
-
throw new Error("getOfflineSignerOnlyAmino not implemented");
|
|
105
|
-
}
|
|
106
|
-
getOfflineSignerAuto(chainId) {
|
|
107
|
-
console.warn(`Para Connector: getOfflineSignerAuto called for ${chainId} - Needs Implementation`);
|
|
108
|
-
throw new Error("getOfflineSignerAuto not implemented");
|
|
109
|
-
}
|
|
110
|
-
signAmino(chainId, signer, signDoc, signOptions) {
|
|
111
|
-
return __async(this, null, function* () {
|
|
112
|
-
console.warn(`Para Connector: signAmino called for ${chainId} - Needs Implementation`);
|
|
113
|
-
throw new Error("signAmino not implemented");
|
|
114
|
-
});
|
|
115
|
-
}
|
|
116
|
-
signDirect(chainId, signer, signDoc, signOptions) {
|
|
117
|
-
return __async(this, null, function* () {
|
|
118
|
-
console.warn(`Para Connector: signDirect called for ${chainId} - Needs Implementation`);
|
|
119
|
-
throw new Error("signDirect not implemented");
|
|
120
|
-
});
|
|
121
|
-
}
|
|
122
|
-
signArbitrary(chainId, signer, data) {
|
|
123
|
-
return __async(this, null, function* () {
|
|
124
|
-
console.warn(`Para Connector: signArbitrary called for ${chainId} - Needs Implementation`);
|
|
125
|
-
throw new Error("signArbitrary not implemented");
|
|
126
|
-
});
|
|
127
|
-
}
|
|
128
|
-
disconnect() {
|
|
129
|
-
return __async(this, null, function* () {
|
|
130
|
-
yield this.paraWebClient.logout();
|
|
131
|
-
});
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
export {
|
|
135
|
-
ParaGrazInternalProvider
|
|
136
|
-
};
|
package/dist/chunk-IV3L3JVM.js
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __defProps = Object.defineProperties;
|
|
4
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
5
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
8
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
9
|
-
var __spreadValues = (a, b) => {
|
|
10
|
-
for (var prop in b || (b = {}))
|
|
11
|
-
if (__hasOwnProp.call(b, prop))
|
|
12
|
-
__defNormalProp(a, prop, b[prop]);
|
|
13
|
-
if (__getOwnPropSymbols)
|
|
14
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
15
|
-
if (__propIsEnum.call(b, prop))
|
|
16
|
-
__defNormalProp(a, prop, b[prop]);
|
|
17
|
-
}
|
|
18
|
-
return a;
|
|
19
|
-
};
|
|
20
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
21
|
-
var __async = (__this, __arguments, generator) => {
|
|
22
|
-
return new Promise((resolve, reject) => {
|
|
23
|
-
var fulfilled = (value) => {
|
|
24
|
-
try {
|
|
25
|
-
step(generator.next(value));
|
|
26
|
-
} catch (e) {
|
|
27
|
-
reject(e);
|
|
28
|
-
}
|
|
29
|
-
};
|
|
30
|
-
var rejected = (value) => {
|
|
31
|
-
try {
|
|
32
|
-
step(generator.throw(value));
|
|
33
|
-
} catch (e) {
|
|
34
|
-
reject(e);
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
38
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
39
|
-
});
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
export {
|
|
43
|
-
__spreadValues,
|
|
44
|
-
__spreadProps,
|
|
45
|
-
__async
|
|
46
|
-
};
|
package/dist/connectorModal.d.ts
DELETED
package/dist/connectorModal.js
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import {
|
|
3
|
-
__async,
|
|
4
|
-
__spreadProps,
|
|
5
|
-
__spreadValues
|
|
6
|
-
} from "./chunk-IV3L3JVM.js";
|
|
7
|
-
import { jsx } from "react/jsx-runtime";
|
|
8
|
-
import { ParaModal } from "@getpara/react-sdk";
|
|
9
|
-
function renderModal(para, modalProps, onCloseArg) {
|
|
10
|
-
const existingContainer = document.getElementById("para-modal");
|
|
11
|
-
const container = existingContainer != null ? existingContainer : document.createElement("div");
|
|
12
|
-
container.id = "para-modal";
|
|
13
|
-
if (!existingContainer) {
|
|
14
|
-
document.body.appendChild(container);
|
|
15
|
-
}
|
|
16
|
-
const onClose = () => {
|
|
17
|
-
onCloseArg();
|
|
18
|
-
modalProps.onClose && modalProps.onClose();
|
|
19
|
-
render(false);
|
|
20
|
-
};
|
|
21
|
-
const render = (isOpen) => __async(this, null, function* () {
|
|
22
|
-
const Modal = /* @__PURE__ */ jsx(ParaModal, __spreadProps(__spreadValues({}, modalProps), { onClose, para, isOpen }));
|
|
23
|
-
try {
|
|
24
|
-
const client = yield import("react-dom/client");
|
|
25
|
-
const root = client.createRoot(container);
|
|
26
|
-
root.render(Modal);
|
|
27
|
-
} catch (e) {
|
|
28
|
-
const ReactDOM = yield import("react-dom");
|
|
29
|
-
ReactDOM.render(Modal, container);
|
|
30
|
-
}
|
|
31
|
-
});
|
|
32
|
-
render(true);
|
|
33
|
-
}
|
|
34
|
-
export {
|
|
35
|
-
renderModal
|
|
36
|
-
};
|
package/src/ParaGrazProvider.ts
DELETED
|
@@ -1,165 +0,0 @@
|
|
|
1
|
-
import ParaWeb from '@getpara/react-sdk';
|
|
2
|
-
import type { Environment, ParaModalProps } from '@getpara/react-sdk';
|
|
3
|
-
import type { Wallet, Key as GrazKey } from 'graz';
|
|
4
|
-
import type {
|
|
5
|
-
OfflineAminoSigner,
|
|
6
|
-
OfflineDirectSigner,
|
|
7
|
-
AminoSignResponse,
|
|
8
|
-
StdSignDoc,
|
|
9
|
-
StdSignature,
|
|
10
|
-
} from '@keplr-wallet/types';
|
|
11
|
-
import { ParaAminoSigner, ParaProtoSigner } from '@getpara/cosmjs-v0-integration';
|
|
12
|
-
import { fromBech32 } from '@cosmjs/encoding';
|
|
13
|
-
import { renderModal } from './connectorModal.js';
|
|
14
|
-
|
|
15
|
-
const TEN_MINUTES_MS = 600000;
|
|
16
|
-
|
|
17
|
-
export type ParaGrazModalProps = Omit<ParaModalProps, 'para'>;
|
|
18
|
-
|
|
19
|
-
export interface ParaGrazConfig {
|
|
20
|
-
apiKey: string;
|
|
21
|
-
env: Environment;
|
|
22
|
-
modalProps?: ParaGrazModalProps;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export class ParaGrazInternalProvider implements Omit<Wallet, 'experimentalSuggestChain'> {
|
|
26
|
-
private paraWebClient: ParaWeb;
|
|
27
|
-
private config: ParaGrazConfig;
|
|
28
|
-
private isModalClosed: boolean;
|
|
29
|
-
|
|
30
|
-
constructor(config: ParaGrazConfig) {
|
|
31
|
-
if (!config || !config.apiKey || !config.env) {
|
|
32
|
-
throw new Error('Para Connector: Missing API Key or Environment in config.');
|
|
33
|
-
}
|
|
34
|
-
this.config = config;
|
|
35
|
-
this.paraWebClient = new ParaWeb(config.env, config.apiKey);
|
|
36
|
-
this.isModalClosed = true;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
closeModal = () => {
|
|
40
|
-
this.isModalClosed = true;
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
private async waitForLogin(timeoutMs = TEN_MINUTES_MS): Promise<boolean> {
|
|
44
|
-
const startTime = Date.now();
|
|
45
|
-
while (Date.now() - startTime < timeoutMs) {
|
|
46
|
-
if (await this.paraWebClient.isFullyLoggedIn()) {
|
|
47
|
-
return true;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
if (this.isModalClosed) {
|
|
51
|
-
throw new Error('user closed modal');
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
await new Promise(resolve => setTimeout(resolve, 2000));
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
throw new Error('timed out waiting for user to log in');
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
private async waitForAccounts(chainIds: string | string[], timeoutMs = 5000): Promise<boolean> {
|
|
61
|
-
const startTime = Date.now();
|
|
62
|
-
while (Date.now() - startTime < timeoutMs) {
|
|
63
|
-
const wallets = Object.values(this.paraWebClient.getWalletsByType('COSMOS'));
|
|
64
|
-
if (wallets && wallets.length > 0) {
|
|
65
|
-
return true;
|
|
66
|
-
}
|
|
67
|
-
await new Promise(resolve => setTimeout(resolve, 500));
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
throw new Error('timed out waiting for accounts to load');
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
async enable(chainIds: string | string[]): Promise<void> {
|
|
74
|
-
if (await this.paraWebClient.isFullyLoggedIn()) {
|
|
75
|
-
const wallets = Object.values(this.paraWebClient.getWalletsByType('COSMOS'));
|
|
76
|
-
if (wallets && wallets.length > 0) {
|
|
77
|
-
return;
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
this.isModalClosed = false;
|
|
82
|
-
renderModal(this.paraWebClient, this.config.modalProps, () => {
|
|
83
|
-
this.isModalClosed = true;
|
|
84
|
-
});
|
|
85
|
-
|
|
86
|
-
await this.waitForLogin();
|
|
87
|
-
|
|
88
|
-
try {
|
|
89
|
-
await this.waitForAccounts(chainIds);
|
|
90
|
-
} catch (error) {
|
|
91
|
-
throw new Error('accounts not available after login');
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
getParaWebClient(): ParaWeb {
|
|
96
|
-
return this.paraWebClient;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
getConfig(): ParaGrazConfig {
|
|
100
|
-
return this.config;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
async getKey(chainId: string): Promise<GrazKey> {
|
|
104
|
-
const wallets = Object.values(this.paraWebClient.getWalletsByType('COSMOS'));
|
|
105
|
-
|
|
106
|
-
if (wallets.length === 0) {
|
|
107
|
-
throw new Error(`Para Connector: No wallets found for chainId ${chainId}`);
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
const walletSigner = new ParaProtoSigner(this.paraWebClient, wallets[0].id);
|
|
111
|
-
const accountData = await walletSigner.getAccounts();
|
|
112
|
-
if (accountData.length === 0) {
|
|
113
|
-
throw new Error(`Para Connector: No accounts found for wallet ${wallets[0].id}`);
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
return {
|
|
117
|
-
address: fromBech32(accountData[0].address).data,
|
|
118
|
-
bech32Address: accountData[0].address,
|
|
119
|
-
algo: accountData[0].algo,
|
|
120
|
-
name: accountData[0].address,
|
|
121
|
-
pubKey: accountData[0].pubkey,
|
|
122
|
-
isKeystone: false,
|
|
123
|
-
isNanoLedger: false,
|
|
124
|
-
};
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
getOfflineSigner(chainId: string): OfflineAminoSigner & OfflineDirectSigner {
|
|
128
|
-
console.warn(`Para Connector: getOfflineSigner called for ${chainId} - Needs Implementation`);
|
|
129
|
-
throw new Error('getOfflineSigner not implemented');
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
getOfflineSignerOnlyAmino(chainId: string): OfflineAminoSigner {
|
|
133
|
-
console.warn(`Para Connector: getOfflineSignerOnlyAmino called for ${chainId} - Needs Implementation`);
|
|
134
|
-
throw new Error('getOfflineSignerOnlyAmino not implemented');
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
getOfflineSignerAuto(chainId: string): Promise<OfflineAminoSigner | OfflineDirectSigner> {
|
|
138
|
-
console.warn(`Para Connector: getOfflineSignerAuto called for ${chainId} - Needs Implementation`);
|
|
139
|
-
throw new Error('getOfflineSignerAuto not implemented');
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
async signAmino(chainId: string, signer: string, signDoc: StdSignDoc, signOptions?: any): Promise<AminoSignResponse> {
|
|
143
|
-
console.warn(`Para Connector: signAmino called for ${chainId} - Needs Implementation`);
|
|
144
|
-
throw new Error('signAmino not implemented');
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
async signDirect(
|
|
148
|
-
chainId: string,
|
|
149
|
-
signer: string,
|
|
150
|
-
signDoc: any,
|
|
151
|
-
signOptions?: any,
|
|
152
|
-
): Promise<{ signed: any; signature: StdSignature }> {
|
|
153
|
-
console.warn(`Para Connector: signDirect called for ${chainId} - Needs Implementation`);
|
|
154
|
-
throw new Error('signDirect not implemented');
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
async signArbitrary(chainId: string, signer: string, data: string | Uint8Array): Promise<StdSignature> {
|
|
158
|
-
console.warn(`Para Connector: signArbitrary called for ${chainId} - Needs Implementation`);
|
|
159
|
-
throw new Error('signArbitrary not implemented');
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
async disconnect(): Promise<void> {
|
|
163
|
-
await this.paraWebClient.logout();
|
|
164
|
-
}
|
|
165
|
-
}
|
package/src/connectorModal.tsx
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import ParaWeb, { ParaModal, ParaModalProps } from '@getpara/react-sdk';
|
|
2
|
-
|
|
3
|
-
export function renderModal(para: ParaWeb, modalProps: Partial<ParaModalProps>, onCloseArg: () => void): void {
|
|
4
|
-
const existingContainer = document.getElementById('para-modal');
|
|
5
|
-
const container = existingContainer ?? document.createElement('div');
|
|
6
|
-
container.id = 'para-modal';
|
|
7
|
-
|
|
8
|
-
if (!existingContainer) {
|
|
9
|
-
document.body.appendChild(container);
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
const onClose = () => {
|
|
13
|
-
onCloseArg();
|
|
14
|
-
modalProps.onClose && modalProps.onClose();
|
|
15
|
-
render(false);
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
const render = async (isOpen: boolean) => {
|
|
19
|
-
const Modal = <ParaModal {...modalProps} onClose={onClose} para={para} isOpen={isOpen} />;
|
|
20
|
-
|
|
21
|
-
try {
|
|
22
|
-
const client = await import('react-dom/client');
|
|
23
|
-
const root = client.createRoot(container);
|
|
24
|
-
root.render(Modal);
|
|
25
|
-
} catch (e) {
|
|
26
|
-
const ReactDOM = await import('react-dom');
|
|
27
|
-
ReactDOM.render(Modal, container);
|
|
28
|
-
}
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
render(true);
|
|
32
|
-
}
|