@injectivelabs/wallet-magic 1.15.0 → 1.15.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/dist/cjs/index.d.ts +1 -0
- package/dist/cjs/index.js +6 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/package.json +3 -0
- package/dist/cjs/strategy/strategy.d.ts +46 -0
- package/dist/cjs/strategy/strategy.js +197 -0
- package/dist/cjs/strategy/strategy.js.map +1 -0
- package/dist/esm/index.d.ts +1 -0
- package/dist/esm/index.js +2 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/package.json +3 -0
- package/dist/esm/strategy/strategy.d.ts +46 -0
- package/dist/esm/strategy/strategy.js +193 -0
- package/dist/esm/strategy/strategy.js.map +1 -0
- package/package.json +7 -7
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Magic as MagicStrategy } from './strategy/strategy.js';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MagicStrategy = void 0;
|
|
4
|
+
var strategy_js_1 = require("./strategy/strategy.js");
|
|
5
|
+
Object.defineProperty(exports, "MagicStrategy", { enumerable: true, get: function () { return strategy_js_1.Magic; } });
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AAAA,sDAA+D;AAAtD,4GAAA,KAAK,OAAiB"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { TxRaw, DirectSignResponse, AminoSignResponse } from '@injectivelabs/sdk-ts';
|
|
2
|
+
import { AccountAddress, EthereumChainId } from '@injectivelabs/ts-types';
|
|
3
|
+
import { StdSignDoc, MagicMetadata, MagicProvider, WalletDeviceType, BaseConcreteStrategy, BrowserEip1993Provider, ConcreteWalletStrategy, SendTransactionOptions, WalletStrategyArguments } from '@injectivelabs/wallet-base';
|
|
4
|
+
interface MagicConnectArgs extends WalletStrategyArguments {
|
|
5
|
+
metadata?: MagicMetadata;
|
|
6
|
+
}
|
|
7
|
+
export declare class Magic extends BaseConcreteStrategy implements ConcreteWalletStrategy {
|
|
8
|
+
provider: BrowserEip1993Provider | undefined;
|
|
9
|
+
metadata?: MagicMetadata;
|
|
10
|
+
private magicWallet;
|
|
11
|
+
constructor(args: MagicConnectArgs);
|
|
12
|
+
getWalletDeviceType(): Promise<WalletDeviceType>;
|
|
13
|
+
enable({ email, provider, }: {
|
|
14
|
+
email?: string;
|
|
15
|
+
provider?: MagicProvider;
|
|
16
|
+
}): Promise<boolean>;
|
|
17
|
+
connectViaEmail(email?: string): Promise<string | null>;
|
|
18
|
+
connectViaOauth(provider: MagicProvider): Promise<any>;
|
|
19
|
+
disconnect(): Promise<void>;
|
|
20
|
+
getAddresses({ provider, }: {
|
|
21
|
+
provider: MagicProvider;
|
|
22
|
+
}): Promise<string[]>;
|
|
23
|
+
getSessionOrConfirm(address: AccountAddress): Promise<string>;
|
|
24
|
+
sendEthereumTransaction(_transaction: unknown, _options: {
|
|
25
|
+
address: AccountAddress;
|
|
26
|
+
ethereumChainId: EthereumChainId;
|
|
27
|
+
}): Promise<string>;
|
|
28
|
+
sendTransaction(transaction: TxRaw, options: SendTransactionOptions): Promise<any>;
|
|
29
|
+
signEip712TypedData(eip712json: string, _address: AccountAddress): Promise<string>;
|
|
30
|
+
signCosmosTransaction(_transaction: {
|
|
31
|
+
txRaw: TxRaw;
|
|
32
|
+
accountNumber: number;
|
|
33
|
+
chainId: string;
|
|
34
|
+
address: string;
|
|
35
|
+
}): Promise<DirectSignResponse>;
|
|
36
|
+
signAminoCosmosTransaction(_transaction: {
|
|
37
|
+
address: string;
|
|
38
|
+
signDoc: StdSignDoc;
|
|
39
|
+
}): Promise<AminoSignResponse>;
|
|
40
|
+
signArbitrary(_signer: AccountAddress, _data: string | Uint8Array): Promise<string>;
|
|
41
|
+
getEthereumChainId(): Promise<string>;
|
|
42
|
+
getEthereumTransactionReceipt(_txHash: string): Promise<string>;
|
|
43
|
+
getPubKey(): Promise<string>;
|
|
44
|
+
private pollUserLoggedInState;
|
|
45
|
+
}
|
|
46
|
+
export {};
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Magic = void 0;
|
|
4
|
+
/* eslint-disable class-methods-use-this */
|
|
5
|
+
const exceptions_1 = require("@injectivelabs/exceptions");
|
|
6
|
+
const magic_sdk_1 = require("magic-sdk");
|
|
7
|
+
const sdk_ts_1 = require("@injectivelabs/sdk-ts");
|
|
8
|
+
const oauth2_1 = require("@magic-ext/oauth2");
|
|
9
|
+
const cosmos_1 = require("@magic-ext/cosmos");
|
|
10
|
+
const wallet_base_1 = require("@injectivelabs/wallet-base");
|
|
11
|
+
class Magic extends wallet_base_1.BaseConcreteStrategy {
|
|
12
|
+
provider;
|
|
13
|
+
metadata;
|
|
14
|
+
magicWallet;
|
|
15
|
+
constructor(args) {
|
|
16
|
+
if (!args.metadata?.apiKey) {
|
|
17
|
+
throw new exceptions_1.WalletException(new Error('You have to pass the apiKey within metadata to use Magic wallet'));
|
|
18
|
+
}
|
|
19
|
+
if (!args.metadata.rpcEndpoint) {
|
|
20
|
+
throw new exceptions_1.WalletException(new Error('You have to pass the rpc url endpoint within metadata to use Magic wallet'));
|
|
21
|
+
}
|
|
22
|
+
super(args);
|
|
23
|
+
this.metadata = args.metadata;
|
|
24
|
+
this.magicWallet = new magic_sdk_1.Magic(args.metadata.apiKey, {
|
|
25
|
+
extensions: [
|
|
26
|
+
new oauth2_1.OAuthExtension(),
|
|
27
|
+
new cosmos_1.CosmosExtension({
|
|
28
|
+
rpcUrl: args.metadata.rpcEndpoint,
|
|
29
|
+
chain: 'inj',
|
|
30
|
+
}),
|
|
31
|
+
],
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
async getWalletDeviceType() {
|
|
35
|
+
return Promise.resolve(wallet_base_1.WalletDeviceType.Browser);
|
|
36
|
+
}
|
|
37
|
+
async enable({ email, provider, }) {
|
|
38
|
+
if (!provider) {
|
|
39
|
+
return Promise.resolve(true);
|
|
40
|
+
}
|
|
41
|
+
try {
|
|
42
|
+
if (provider === wallet_base_1.MagicProvider.Email) {
|
|
43
|
+
await this.connectViaEmail(email);
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
await this.connectViaOauth(provider);
|
|
47
|
+
}
|
|
48
|
+
await this.pollUserLoggedInState();
|
|
49
|
+
return Promise.resolve(true);
|
|
50
|
+
}
|
|
51
|
+
catch (e) {
|
|
52
|
+
throw new exceptions_1.WalletException(new Error(e.message), {
|
|
53
|
+
code: exceptions_1.UnspecifiedErrorCode,
|
|
54
|
+
type: exceptions_1.ErrorType.WalletError,
|
|
55
|
+
contextModule: wallet_base_1.WalletAction.GetAccounts,
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
async connectViaEmail(email) {
|
|
60
|
+
if (!email) {
|
|
61
|
+
throw new exceptions_1.WalletException(new Error('You have to pass the email for using Magic wallet'));
|
|
62
|
+
}
|
|
63
|
+
return this.magicWallet.auth.loginWithMagicLink({ email });
|
|
64
|
+
}
|
|
65
|
+
async connectViaOauth(provider) {
|
|
66
|
+
return this.magicWallet.oauth2.loginWithRedirect({
|
|
67
|
+
provider: provider,
|
|
68
|
+
redirectURI: window.location.origin,
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
async disconnect() {
|
|
72
|
+
const isUserLoggedIn = await this.magicWallet.user.isLoggedIn();
|
|
73
|
+
if (!isUserLoggedIn) {
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
await this.magicWallet.user.logout();
|
|
77
|
+
}
|
|
78
|
+
async getAddresses({ provider, }) {
|
|
79
|
+
if (!provider) {
|
|
80
|
+
try {
|
|
81
|
+
await this.magicWallet.oauth2.getRedirectResult();
|
|
82
|
+
}
|
|
83
|
+
catch {
|
|
84
|
+
// fail silently
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
try {
|
|
88
|
+
const { publicAddress } = await this.magicWallet.user.getInfo();
|
|
89
|
+
if (!publicAddress?.startsWith('inj')) {
|
|
90
|
+
const address = await this.magicWallet.cosmos.changeAddress('inj');
|
|
91
|
+
return [address || ''];
|
|
92
|
+
}
|
|
93
|
+
return [publicAddress || ''];
|
|
94
|
+
}
|
|
95
|
+
catch (e) {
|
|
96
|
+
throw new exceptions_1.WalletException(new Error(e.message), {
|
|
97
|
+
code: exceptions_1.UnspecifiedErrorCode,
|
|
98
|
+
type: exceptions_1.ErrorType.WalletError,
|
|
99
|
+
contextModule: wallet_base_1.WalletAction.GetAccounts,
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
// eslint-disable-next-line class-methods-use-this
|
|
104
|
+
async getSessionOrConfirm(address) {
|
|
105
|
+
return Promise.resolve(`0x${Buffer.from(`Confirmation for ${address} at time: ${Date.now()}`).toString('hex')}`);
|
|
106
|
+
}
|
|
107
|
+
async sendEthereumTransaction(_transaction, _options) {
|
|
108
|
+
throw new exceptions_1.CosmosWalletException(new Error('sendEthereumTransaction is not supported. Leap only supports sending cosmos transactions'), {
|
|
109
|
+
code: exceptions_1.UnspecifiedErrorCode,
|
|
110
|
+
context: wallet_base_1.WalletAction.SendEthereumTransaction,
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
async sendTransaction(transaction, options) {
|
|
114
|
+
const { endpoints, txTimeout } = options;
|
|
115
|
+
if (!endpoints) {
|
|
116
|
+
throw new exceptions_1.WalletException(new Error('You have to pass endpoints.grpc within the options for using Magic wallet'));
|
|
117
|
+
}
|
|
118
|
+
const txApi = new sdk_ts_1.TxGrpcApi(endpoints.grpc);
|
|
119
|
+
const response = await txApi.broadcast(transaction, { txTimeout });
|
|
120
|
+
if (response.code !== 0) {
|
|
121
|
+
throw new exceptions_1.TransactionException(new Error(response.rawLog), {
|
|
122
|
+
code: exceptions_1.UnspecifiedErrorCode,
|
|
123
|
+
contextCode: response.code,
|
|
124
|
+
contextModule: response.codespace,
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
return response;
|
|
128
|
+
}
|
|
129
|
+
async signEip712TypedData(eip712json, _address) {
|
|
130
|
+
const signature = await this.magicWallet.cosmos.signTypedData(eip712json);
|
|
131
|
+
return `0x${signature}`;
|
|
132
|
+
}
|
|
133
|
+
// eslint-disable-next-line class-methods-use-this
|
|
134
|
+
async signCosmosTransaction(_transaction) {
|
|
135
|
+
throw new exceptions_1.WalletException(new Error('This wallet does not support signing Cosmos transactions'), {
|
|
136
|
+
code: exceptions_1.UnspecifiedErrorCode,
|
|
137
|
+
type: exceptions_1.ErrorType.WalletError,
|
|
138
|
+
contextModule: wallet_base_1.WalletAction.SignTransaction,
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
async signAminoCosmosTransaction(_transaction) {
|
|
142
|
+
throw new exceptions_1.WalletException(new Error('This wallet does not support signAminoCosmosTransaction'), {
|
|
143
|
+
code: exceptions_1.UnspecifiedErrorCode,
|
|
144
|
+
type: exceptions_1.ErrorType.WalletError,
|
|
145
|
+
contextModule: wallet_base_1.WalletAction.SignTransaction,
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
async signArbitrary(_signer, _data) {
|
|
149
|
+
throw new exceptions_1.WalletException(new Error('This wallet does not support signArbitrary'), {
|
|
150
|
+
code: exceptions_1.UnspecifiedErrorCode,
|
|
151
|
+
type: exceptions_1.ErrorType.WalletError,
|
|
152
|
+
contextModule: wallet_base_1.WalletAction.SignTransaction,
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
async getEthereumChainId() {
|
|
156
|
+
throw new exceptions_1.CosmosWalletException(new Error('getEthereumChainId is not supported on Magic wallet'), {
|
|
157
|
+
code: exceptions_1.UnspecifiedErrorCode,
|
|
158
|
+
context: wallet_base_1.WalletAction.GetChainId,
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
async getEthereumTransactionReceipt(_txHash) {
|
|
162
|
+
throw new exceptions_1.CosmosWalletException(new Error('getEthereumTransactionReceipt is not supported on Cosmostation'), {
|
|
163
|
+
code: exceptions_1.UnspecifiedErrorCode,
|
|
164
|
+
type: exceptions_1.ErrorType.WalletError,
|
|
165
|
+
context: wallet_base_1.WalletAction.GetEthereumTransactionReceipt,
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
// eslint-disable-next-line class-methods-use-this
|
|
169
|
+
async getPubKey() {
|
|
170
|
+
throw new exceptions_1.WalletException(new Error('You can only fetch PubKey from Cosmos native wallets'));
|
|
171
|
+
}
|
|
172
|
+
async pollUserLoggedInState(timeout = 60 * 1000) {
|
|
173
|
+
const POLL_INTERVAL = 3 * 1000;
|
|
174
|
+
for (let i = 0; i <= timeout / POLL_INTERVAL; i += 1) {
|
|
175
|
+
try {
|
|
176
|
+
const result = await this.magicWallet.user.isLoggedIn();
|
|
177
|
+
if (result) {
|
|
178
|
+
return result;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
catch (e) {
|
|
182
|
+
// We throw only if the transaction failed on chain
|
|
183
|
+
if (e instanceof exceptions_1.TransactionException) {
|
|
184
|
+
throw e;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
await new Promise((resolve) => setTimeout(resolve, POLL_INTERVAL));
|
|
188
|
+
}
|
|
189
|
+
// Transaction was not included in the block in the desired timeout
|
|
190
|
+
throw new exceptions_1.WalletException(new Error(`User did not verify sign in - timeout of ${timeout}ms`), {
|
|
191
|
+
context: 'Wallet',
|
|
192
|
+
contextModule: 'Magic-Wallet-pollUserLoggedInState',
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
exports.Magic = Magic;
|
|
197
|
+
//# sourceMappingURL=strategy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":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GAAG,IAAI,CAAA;QAE9B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,OAAO,GAAG,aAAa,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC;YACrD,IAAI,CAAC;gBACH,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,UAAU,EAAE,CAAA;gBAEvD,IAAI,MAAM,EAAE,CAAC;oBACX,OAAO,MAAM,CAAA;gBACf,CAAC;YACH,CAAC;YAAC,OAAO,CAAU,EAAE,CAAC;gBACpB,mDAAmD;gBACnD,IAAI,CAAC,YAAY,iCAAoB,EAAE,CAAC;oBACtC,MAAM,CAAC,CAAA;gBACT,CAAC;YACH,CAAC;YAED,MAAM,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,aAAa,CAAC,CAAC,CAAA;QACpE,CAAC;QAED,mEAAmE;QACnE,MAAM,IAAI,4BAAe,CACvB,IAAI,KAAK,CAAC,4CAA4C,OAAO,IAAI,CAAC,EAClE;YACE,OAAO,EAAE,QAAQ;YACjB,aAAa,EAAE,oCAAoC;SACpD,CACF,CAAA;IACH,CAAC;CACF;AA1SD,sBA0SC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Magic as MagicStrategy } from './strategy/strategy.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,IAAI,aAAa,EAAE,MAAM,wBAAwB,CAAA"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { TxRaw, DirectSignResponse, AminoSignResponse } from '@injectivelabs/sdk-ts';
|
|
2
|
+
import { AccountAddress, EthereumChainId } from '@injectivelabs/ts-types';
|
|
3
|
+
import { StdSignDoc, MagicMetadata, MagicProvider, WalletDeviceType, BaseConcreteStrategy, BrowserEip1993Provider, ConcreteWalletStrategy, SendTransactionOptions, WalletStrategyArguments } from '@injectivelabs/wallet-base';
|
|
4
|
+
interface MagicConnectArgs extends WalletStrategyArguments {
|
|
5
|
+
metadata?: MagicMetadata;
|
|
6
|
+
}
|
|
7
|
+
export declare class Magic extends BaseConcreteStrategy implements ConcreteWalletStrategy {
|
|
8
|
+
provider: BrowserEip1993Provider | undefined;
|
|
9
|
+
metadata?: MagicMetadata;
|
|
10
|
+
private magicWallet;
|
|
11
|
+
constructor(args: MagicConnectArgs);
|
|
12
|
+
getWalletDeviceType(): Promise<WalletDeviceType>;
|
|
13
|
+
enable({ email, provider, }: {
|
|
14
|
+
email?: string;
|
|
15
|
+
provider?: MagicProvider;
|
|
16
|
+
}): Promise<boolean>;
|
|
17
|
+
connectViaEmail(email?: string): Promise<string | null>;
|
|
18
|
+
connectViaOauth(provider: MagicProvider): Promise<any>;
|
|
19
|
+
disconnect(): Promise<void>;
|
|
20
|
+
getAddresses({ provider, }: {
|
|
21
|
+
provider: MagicProvider;
|
|
22
|
+
}): Promise<string[]>;
|
|
23
|
+
getSessionOrConfirm(address: AccountAddress): Promise<string>;
|
|
24
|
+
sendEthereumTransaction(_transaction: unknown, _options: {
|
|
25
|
+
address: AccountAddress;
|
|
26
|
+
ethereumChainId: EthereumChainId;
|
|
27
|
+
}): Promise<string>;
|
|
28
|
+
sendTransaction(transaction: TxRaw, options: SendTransactionOptions): Promise<any>;
|
|
29
|
+
signEip712TypedData(eip712json: string, _address: AccountAddress): Promise<string>;
|
|
30
|
+
signCosmosTransaction(_transaction: {
|
|
31
|
+
txRaw: TxRaw;
|
|
32
|
+
accountNumber: number;
|
|
33
|
+
chainId: string;
|
|
34
|
+
address: string;
|
|
35
|
+
}): Promise<DirectSignResponse>;
|
|
36
|
+
signAminoCosmosTransaction(_transaction: {
|
|
37
|
+
address: string;
|
|
38
|
+
signDoc: StdSignDoc;
|
|
39
|
+
}): Promise<AminoSignResponse>;
|
|
40
|
+
signArbitrary(_signer: AccountAddress, _data: string | Uint8Array): Promise<string>;
|
|
41
|
+
getEthereumChainId(): Promise<string>;
|
|
42
|
+
getEthereumTransactionReceipt(_txHash: string): Promise<string>;
|
|
43
|
+
getPubKey(): Promise<string>;
|
|
44
|
+
private pollUserLoggedInState;
|
|
45
|
+
}
|
|
46
|
+
export {};
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
/* eslint-disable class-methods-use-this */
|
|
2
|
+
import { ErrorType, WalletException, UnspecifiedErrorCode, TransactionException, CosmosWalletException, } from '@injectivelabs/exceptions';
|
|
3
|
+
import { Magic as MagicWallet } from 'magic-sdk';
|
|
4
|
+
import { TxGrpcApi, } from '@injectivelabs/sdk-ts';
|
|
5
|
+
import { OAuthExtension } from '@magic-ext/oauth2';
|
|
6
|
+
import { CosmosExtension } from '@magic-ext/cosmos';
|
|
7
|
+
import { WalletAction, MagicProvider, WalletDeviceType, BaseConcreteStrategy, } from '@injectivelabs/wallet-base';
|
|
8
|
+
export class Magic extends BaseConcreteStrategy {
|
|
9
|
+
provider;
|
|
10
|
+
metadata;
|
|
11
|
+
magicWallet;
|
|
12
|
+
constructor(args) {
|
|
13
|
+
if (!args.metadata?.apiKey) {
|
|
14
|
+
throw new WalletException(new Error('You have to pass the apiKey within metadata to use Magic wallet'));
|
|
15
|
+
}
|
|
16
|
+
if (!args.metadata.rpcEndpoint) {
|
|
17
|
+
throw new WalletException(new Error('You have to pass the rpc url endpoint within metadata to use Magic wallet'));
|
|
18
|
+
}
|
|
19
|
+
super(args);
|
|
20
|
+
this.metadata = args.metadata;
|
|
21
|
+
this.magicWallet = new MagicWallet(args.metadata.apiKey, {
|
|
22
|
+
extensions: [
|
|
23
|
+
new OAuthExtension(),
|
|
24
|
+
new CosmosExtension({
|
|
25
|
+
rpcUrl: args.metadata.rpcEndpoint,
|
|
26
|
+
chain: 'inj',
|
|
27
|
+
}),
|
|
28
|
+
],
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
async getWalletDeviceType() {
|
|
32
|
+
return Promise.resolve(WalletDeviceType.Browser);
|
|
33
|
+
}
|
|
34
|
+
async enable({ email, provider, }) {
|
|
35
|
+
if (!provider) {
|
|
36
|
+
return Promise.resolve(true);
|
|
37
|
+
}
|
|
38
|
+
try {
|
|
39
|
+
if (provider === MagicProvider.Email) {
|
|
40
|
+
await this.connectViaEmail(email);
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
await this.connectViaOauth(provider);
|
|
44
|
+
}
|
|
45
|
+
await this.pollUserLoggedInState();
|
|
46
|
+
return Promise.resolve(true);
|
|
47
|
+
}
|
|
48
|
+
catch (e) {
|
|
49
|
+
throw new WalletException(new Error(e.message), {
|
|
50
|
+
code: UnspecifiedErrorCode,
|
|
51
|
+
type: ErrorType.WalletError,
|
|
52
|
+
contextModule: WalletAction.GetAccounts,
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
async connectViaEmail(email) {
|
|
57
|
+
if (!email) {
|
|
58
|
+
throw new WalletException(new Error('You have to pass the email for using Magic wallet'));
|
|
59
|
+
}
|
|
60
|
+
return this.magicWallet.auth.loginWithMagicLink({ email });
|
|
61
|
+
}
|
|
62
|
+
async connectViaOauth(provider) {
|
|
63
|
+
return this.magicWallet.oauth2.loginWithRedirect({
|
|
64
|
+
provider: provider,
|
|
65
|
+
redirectURI: window.location.origin,
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
async disconnect() {
|
|
69
|
+
const isUserLoggedIn = await this.magicWallet.user.isLoggedIn();
|
|
70
|
+
if (!isUserLoggedIn) {
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
await this.magicWallet.user.logout();
|
|
74
|
+
}
|
|
75
|
+
async getAddresses({ provider, }) {
|
|
76
|
+
if (!provider) {
|
|
77
|
+
try {
|
|
78
|
+
await this.magicWallet.oauth2.getRedirectResult();
|
|
79
|
+
}
|
|
80
|
+
catch {
|
|
81
|
+
// fail silently
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
try {
|
|
85
|
+
const { publicAddress } = await this.magicWallet.user.getInfo();
|
|
86
|
+
if (!publicAddress?.startsWith('inj')) {
|
|
87
|
+
const address = await this.magicWallet.cosmos.changeAddress('inj');
|
|
88
|
+
return [address || ''];
|
|
89
|
+
}
|
|
90
|
+
return [publicAddress || ''];
|
|
91
|
+
}
|
|
92
|
+
catch (e) {
|
|
93
|
+
throw new WalletException(new Error(e.message), {
|
|
94
|
+
code: UnspecifiedErrorCode,
|
|
95
|
+
type: ErrorType.WalletError,
|
|
96
|
+
contextModule: WalletAction.GetAccounts,
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
// eslint-disable-next-line class-methods-use-this
|
|
101
|
+
async getSessionOrConfirm(address) {
|
|
102
|
+
return Promise.resolve(`0x${Buffer.from(`Confirmation for ${address} at time: ${Date.now()}`).toString('hex')}`);
|
|
103
|
+
}
|
|
104
|
+
async sendEthereumTransaction(_transaction, _options) {
|
|
105
|
+
throw new CosmosWalletException(new Error('sendEthereumTransaction is not supported. Leap only supports sending cosmos transactions'), {
|
|
106
|
+
code: UnspecifiedErrorCode,
|
|
107
|
+
context: WalletAction.SendEthereumTransaction,
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
async sendTransaction(transaction, options) {
|
|
111
|
+
const { endpoints, txTimeout } = options;
|
|
112
|
+
if (!endpoints) {
|
|
113
|
+
throw new WalletException(new Error('You have to pass endpoints.grpc within the options for using Magic wallet'));
|
|
114
|
+
}
|
|
115
|
+
const txApi = new TxGrpcApi(endpoints.grpc);
|
|
116
|
+
const response = await txApi.broadcast(transaction, { txTimeout });
|
|
117
|
+
if (response.code !== 0) {
|
|
118
|
+
throw new TransactionException(new Error(response.rawLog), {
|
|
119
|
+
code: UnspecifiedErrorCode,
|
|
120
|
+
contextCode: response.code,
|
|
121
|
+
contextModule: response.codespace,
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
return response;
|
|
125
|
+
}
|
|
126
|
+
async signEip712TypedData(eip712json, _address) {
|
|
127
|
+
const signature = await this.magicWallet.cosmos.signTypedData(eip712json);
|
|
128
|
+
return `0x${signature}`;
|
|
129
|
+
}
|
|
130
|
+
// eslint-disable-next-line class-methods-use-this
|
|
131
|
+
async signCosmosTransaction(_transaction) {
|
|
132
|
+
throw new WalletException(new Error('This wallet does not support signing Cosmos transactions'), {
|
|
133
|
+
code: UnspecifiedErrorCode,
|
|
134
|
+
type: ErrorType.WalletError,
|
|
135
|
+
contextModule: WalletAction.SignTransaction,
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
async signAminoCosmosTransaction(_transaction) {
|
|
139
|
+
throw new WalletException(new Error('This wallet does not support signAminoCosmosTransaction'), {
|
|
140
|
+
code: UnspecifiedErrorCode,
|
|
141
|
+
type: ErrorType.WalletError,
|
|
142
|
+
contextModule: WalletAction.SignTransaction,
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
async signArbitrary(_signer, _data) {
|
|
146
|
+
throw new WalletException(new Error('This wallet does not support signArbitrary'), {
|
|
147
|
+
code: UnspecifiedErrorCode,
|
|
148
|
+
type: ErrorType.WalletError,
|
|
149
|
+
contextModule: WalletAction.SignTransaction,
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
async getEthereumChainId() {
|
|
153
|
+
throw new CosmosWalletException(new Error('getEthereumChainId is not supported on Magic wallet'), {
|
|
154
|
+
code: UnspecifiedErrorCode,
|
|
155
|
+
context: WalletAction.GetChainId,
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
async getEthereumTransactionReceipt(_txHash) {
|
|
159
|
+
throw new CosmosWalletException(new Error('getEthereumTransactionReceipt is not supported on Cosmostation'), {
|
|
160
|
+
code: UnspecifiedErrorCode,
|
|
161
|
+
type: ErrorType.WalletError,
|
|
162
|
+
context: WalletAction.GetEthereumTransactionReceipt,
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
// eslint-disable-next-line class-methods-use-this
|
|
166
|
+
async getPubKey() {
|
|
167
|
+
throw new WalletException(new Error('You can only fetch PubKey from Cosmos native wallets'));
|
|
168
|
+
}
|
|
169
|
+
async pollUserLoggedInState(timeout = 60 * 1000) {
|
|
170
|
+
const POLL_INTERVAL = 3 * 1000;
|
|
171
|
+
for (let i = 0; i <= timeout / POLL_INTERVAL; i += 1) {
|
|
172
|
+
try {
|
|
173
|
+
const result = await this.magicWallet.user.isLoggedIn();
|
|
174
|
+
if (result) {
|
|
175
|
+
return result;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
catch (e) {
|
|
179
|
+
// We throw only if the transaction failed on chain
|
|
180
|
+
if (e instanceof TransactionException) {
|
|
181
|
+
throw e;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
await new Promise((resolve) => setTimeout(resolve, POLL_INTERVAL));
|
|
185
|
+
}
|
|
186
|
+
// Transaction was not included in the block in the desired timeout
|
|
187
|
+
throw new WalletException(new Error(`User did not verify sign in - timeout of ${timeout}ms`), {
|
|
188
|
+
context: 'Wallet',
|
|
189
|
+
contextModule: 'Magic-Wallet-pollUserLoggedInState',
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
//# sourceMappingURL=strategy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"strategy.js","sourceRoot":"","sources":["../../../src/strategy/strategy.ts"],"names":[],"mappings":"AAAA,2CAA2C;AAC3C,OAAO,EACL,SAAS,EACT,eAAe,EACf,oBAAoB,EACpB,oBAAoB,EACpB,qBAAqB,GACtB,MAAM,2BAA2B,CAAA;AAClC,OAAO,EAAE,KAAK,IAAI,WAAW,EAAE,MAAM,WAAW,CAAA;AAChD,OAAO,EAEL,SAAS,GAGV,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAEnD,OAAO,EAEL,YAAY,EAEZ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AI,CAAC;gBACH,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,UAAU,EAAE,CAAA;gBAEvD,IAAI,MAAM,EAAE,CAAC;oBACX,OAAO,MAAM,CAAA;gBACf,CAAC;YACH,CAAC;YAAC,OAAO,CAAU,EAAE,CAAC;gBACpB,mDAAmD;gBACnD,IAAI,CAAC,YAAY,oBAAoB,EAAE,CAAC;oBACtC,MAAM,CAAC,CAAA;gBACT,CAAC;YACH,CAAC;YAED,MAAM,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,aAAa,CAAC,CAAC,CAAA;QACpE,CAAC;QAED,mEAAmE;QACnE,MAAM,IAAI,eAAe,CACvB,IAAI,KAAK,CAAC,4CAA4C,OAAO,IAAI,CAAC,EAClE;YACE,OAAO,EAAE,QAAQ;YACjB,aAAa,EAAE,oCAAoC;SACpD,CACF,CAAA;IACH,CAAC;CACF"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@injectivelabs/wallet-magic",
|
|
3
3
|
"description": "Magic wallet strategy for use with @injectivelabs/wallet-core.",
|
|
4
|
-
"version": "1.15.
|
|
4
|
+
"version": "1.15.1",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"type": "module",
|
|
7
7
|
"author": {
|
|
@@ -56,16 +56,16 @@
|
|
|
56
56
|
"start": "node dist/index.js"
|
|
57
57
|
},
|
|
58
58
|
"dependencies": {
|
|
59
|
-
"@injectivelabs/exceptions": "^1.15.
|
|
60
|
-
"@injectivelabs/sdk-ts": "^1.15.
|
|
61
|
-
"@injectivelabs/ts-types": "^1.15.
|
|
62
|
-
"@injectivelabs/utils": "^1.15.
|
|
63
|
-
"@injectivelabs/wallet-base": "^1.15.
|
|
59
|
+
"@injectivelabs/exceptions": "^1.15.1",
|
|
60
|
+
"@injectivelabs/sdk-ts": "^1.15.1",
|
|
61
|
+
"@injectivelabs/ts-types": "^1.15.1",
|
|
62
|
+
"@injectivelabs/utils": "^1.15.1",
|
|
63
|
+
"@injectivelabs/wallet-base": "^1.15.1",
|
|
64
64
|
"@magic-ext/cosmos": "23.9.1",
|
|
65
65
|
"@magic-ext/oauth2": "9.9.0",
|
|
66
66
|
"magic-sdk": "28.9.0"
|
|
67
67
|
},
|
|
68
|
-
"gitHead": "
|
|
68
|
+
"gitHead": "fb65dd287e7b3191238483d9b9b11acc9f40843d",
|
|
69
69
|
"typedoc": {
|
|
70
70
|
"entryPoint": "./src/index.ts",
|
|
71
71
|
"readmeFile": "./README.md",
|