@blocto/sdk
Advanced tools
Comparing version 0.2.11-beta.1 to 0.2.11-beta.2
@@ -49,3 +49,3 @@ /// <reference types="typescript" /> | ||
connect(): Promise<string[]>; | ||
connect(): Promise<void>; | ||
disconnect(): void; | ||
@@ -52,0 +52,0 @@ request(params: { method: string }): Promise<any>; |
{ | ||
"name": "@blocto/sdk", | ||
"version": "0.2.11-beta.1", | ||
"version": "0.2.11-beta.2", | ||
"author": "Yang Lin", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -43,3 +43,3 @@ import invariant from 'invariant'; | ||
const existedSDK = (window as any).solana; | ||
if (existedSDK && existedSDK.isBlocto) { | ||
if (existedSDK && existedSDK.isBlocto && payload.method !== 'getAccounts') { | ||
return existedSDK.request(payload); | ||
@@ -85,8 +85,11 @@ } | ||
connect(): Promise<string[]> { | ||
async connect(): Promise<void> { | ||
const existedSDK = (window as any).solana; | ||
if (existedSDK && existedSDK.isBlocto) { | ||
return existedSDK.connect(); | ||
existedSDK.once('connect', (pubkey: PublicKey) => { | ||
this.accounts = [pubkey.toString()]; | ||
}); | ||
await existedSDK.connect(); | ||
} | ||
return new Promise((resolve: (v: string[]) => void, reject) => { | ||
return new Promise((resolve: () => void, reject) => { | ||
if (typeof window === 'undefined') { reject('Currently only supported in browser'); } | ||
@@ -111,3 +114,3 @@ const location = encodeURIComponent(window.location.origin); | ||
this.accounts = [e.data.addr]; | ||
resolve(this.accounts as Array<string>); | ||
resolve(); | ||
} | ||
@@ -114,0 +117,0 @@ |
@@ -17,3 +17,3 @@ import { Connection, Transaction } from '@solana/web3.js'; | ||
connect(): Promise<string[]>; | ||
connect(): Promise<void>; | ||
disconnect(): void; | ||
@@ -20,0 +20,0 @@ request(params: { method: string }): Promise<any>; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
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
1230979
28208