@solana/wallet-adapter-bitpie
Advanced tools
Comparing version 0.1.0 to 0.1.1
@@ -0,1 +1,2 @@ | ||
"use strict"; | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
@@ -10,5 +11,7 @@ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
}; | ||
import { BaseSignerWalletAdapter, pollUntilReady, WalletAccountError, WalletNotConnectedError, WalletNotFoundError, WalletPublicKeyError, WalletSignTransactionError, } from '@solana/wallet-adapter-base'; | ||
import { PublicKey } from '@solana/web3.js'; | ||
export class BitpieWalletAdapter extends BaseSignerWalletAdapter { | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.BitpieWalletAdapter = void 0; | ||
const wallet_adapter_base_1 = require("@solana/wallet-adapter-base"); | ||
const web3_js_1 = require("@solana/web3.js"); | ||
class BitpieWalletAdapter extends wallet_adapter_base_1.BaseSignerWalletAdapter { | ||
constructor(config = {}) { | ||
@@ -20,3 +23,3 @@ super(); | ||
if (!this.ready) | ||
pollUntilReady(this, config.pollInterval || 1000, config.pollCount || 3); | ||
(0, wallet_adapter_base_1.pollUntilReady)(this, config.pollInterval || 1000, config.pollCount || 3); | ||
} | ||
@@ -27,3 +30,3 @@ get publicKey() { | ||
get ready() { | ||
return !!window.bitpie; | ||
return typeof window !== 'undefined' && !!window.bitpie; | ||
} | ||
@@ -45,5 +48,5 @@ get connecting() { | ||
this._connecting = true; | ||
const wallet = window.bitpie; | ||
const wallet = typeof window !== 'undefined' && window.bitpie; | ||
if (!wallet) | ||
throw new WalletNotFoundError(); | ||
throw new wallet_adapter_base_1.WalletNotFoundError(); | ||
let account; | ||
@@ -54,10 +57,10 @@ try { | ||
catch (error) { | ||
throw new WalletAccountError(error === null || error === void 0 ? void 0 : error.message, error); | ||
throw new wallet_adapter_base_1.WalletAccountError(error === null || error === void 0 ? void 0 : error.message, error); | ||
} | ||
let publicKey; | ||
try { | ||
publicKey = new PublicKey(account); | ||
publicKey = new web3_js_1.PublicKey(account); | ||
} | ||
catch (error) { | ||
throw new WalletPublicKeyError(error === null || error === void 0 ? void 0 : error.message, error); | ||
throw new wallet_adapter_base_1.WalletPublicKeyError(error === null || error === void 0 ? void 0 : error.message, error); | ||
} | ||
@@ -91,8 +94,8 @@ this._wallet = wallet; | ||
if (!wallet) | ||
throw new WalletNotConnectedError(); | ||
throw new wallet_adapter_base_1.WalletNotConnectedError(); | ||
try { | ||
return wallet.signTransaction(transaction); | ||
return yield wallet.signTransaction(transaction); | ||
} | ||
catch (error) { | ||
throw new WalletSignTransactionError(error === null || error === void 0 ? void 0 : error.message, error); | ||
throw new wallet_adapter_base_1.WalletSignTransactionError(error === null || error === void 0 ? void 0 : error.message, error); | ||
} | ||
@@ -111,8 +114,8 @@ } | ||
if (!wallet) | ||
throw new WalletNotConnectedError(); | ||
throw new wallet_adapter_base_1.WalletNotConnectedError(); | ||
try { | ||
return wallet.signAllTransactions(transactions); | ||
return yield wallet.signAllTransactions(transactions); | ||
} | ||
catch (error) { | ||
throw new WalletSignTransactionError(error === null || error === void 0 ? void 0 : error.message, error); | ||
throw new wallet_adapter_base_1.WalletSignTransactionError(error === null || error === void 0 ? void 0 : error.message, error); | ||
} | ||
@@ -127,2 +130,3 @@ } | ||
} | ||
exports.BitpieWalletAdapter = BitpieWalletAdapter; | ||
//# sourceMappingURL=adapter.js.map |
@@ -1,2 +0,14 @@ | ||
export * from './adapter'; | ||
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __exportStar = (this && this.__exportStar) || function(m, exports) { | ||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
__exportStar(require("./adapter"), exports); | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@solana/wallet-adapter-bitpie", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"author": "Solana Maintainers <maintainers@solana.foundation>", | ||
@@ -22,10 +22,10 @@ "repository": "https://github.com/solana-labs/wallet-adapter", | ||
"peerDependencies": { | ||
"@solana/wallet-adapter-base": "^0.5.0", | ||
"@solana/wallet-adapter-base": "^0.5.1", | ||
"@solana/web3.js": "^1.20.0" | ||
}, | ||
"devDependencies": { | ||
"@solana/wallet-adapter-base": "^0.5.0", | ||
"@solana/wallet-adapter-base": "^0.5.1", | ||
"@solana/web3.js": "^1.20.0" | ||
}, | ||
"gitHead": "76ff330eaf74b916f448eb8870302ae127a94b3d" | ||
"gitHead": "4e46f44d180bda0f9ca4d20e48f62759a9af4c2c" | ||
} |
@@ -48,3 +48,3 @@ import { | ||
get ready(): boolean { | ||
return !!window.bitpie; | ||
return typeof window !== 'undefined' && !!window.bitpie; | ||
} | ||
@@ -69,3 +69,3 @@ | ||
const wallet = window.bitpie; | ||
const wallet = typeof window !== 'undefined' && window.bitpie; | ||
if (!wallet) throw new WalletNotFoundError(); | ||
@@ -76,3 +76,3 @@ | ||
account = await wallet.getAccount(); | ||
} catch (error) { | ||
} catch (error: any) { | ||
throw new WalletAccountError(error?.message, error); | ||
@@ -84,3 +84,3 @@ } | ||
publicKey = new PublicKey(account); | ||
} catch (error) { | ||
} catch (error: any) { | ||
throw new WalletPublicKeyError(error?.message, error); | ||
@@ -93,3 +93,3 @@ } | ||
this.emit('connect'); | ||
} catch (error) { | ||
} catch (error: any) { | ||
this.emit('error', error); | ||
@@ -117,7 +117,7 @@ throw error; | ||
try { | ||
return wallet.signTransaction(transaction); | ||
} catch (error) { | ||
return await wallet.signTransaction(transaction); | ||
} catch (error: any) { | ||
throw new WalletSignTransactionError(error?.message, error); | ||
} | ||
} catch (error) { | ||
} catch (error: any) { | ||
this.emit('error', error); | ||
@@ -134,7 +134,7 @@ throw error; | ||
try { | ||
return wallet.signAllTransactions(transactions); | ||
} catch (error) { | ||
return await wallet.signAllTransactions(transactions); | ||
} catch (error: any) { | ||
throw new WalletSignTransactionError(error?.message, error); | ||
} | ||
} catch (error) { | ||
} catch (error: any) { | ||
this.emit('error', error); | ||
@@ -141,0 +141,0 @@ throw error; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
25263
272