commit
cbd5621715
|
@ -207,12 +207,12 @@ export class TonhubConnector {
|
|||
return safeSignVerify(toSign, Buffer.from(config.walletSig, 'base64'), publicKey);
|
||||
}
|
||||
|
||||
readonly network: 'mainnet' | 'sandbox';
|
||||
readonly network: 'mainnet' | 'testnet';
|
||||
readonly transport: Transport;
|
||||
|
||||
|
||||
constructor(args?: { network?: 'mainnet' | 'sandbox', transport?: Transport }) {
|
||||
let network: 'mainnet' | 'sandbox' = 'mainnet';
|
||||
constructor(args?: { network?: 'mainnet' | 'testnet', transport?: Transport }) {
|
||||
let network: 'mainnet' | 'testnet' = 'mainnet';
|
||||
if (args) {
|
||||
if (args.network !== undefined) {
|
||||
network = args.network;
|
||||
|
@ -234,7 +234,7 @@ export class TonhubConnector {
|
|||
await backoff(async () => {
|
||||
let session = await this.transport.call('session_new', {
|
||||
key: sessionId,
|
||||
testnet: this.network === 'sandbox',
|
||||
testnet: this.network === 'testnet',
|
||||
name: args.name,
|
||||
url: args.url,
|
||||
});
|
||||
|
@ -249,7 +249,7 @@ export class TonhubConnector {
|
|||
return {
|
||||
id: sessionId,
|
||||
seed: seed.toString('base64'),
|
||||
link: (this.network === 'sandbox' ? 'ton-test://connect/' : 'ton://connect/') + sessionId + '?endpoint=connect.tonhubapi.com'
|
||||
link: (this.network === 'testnet' ? 'ton-test://connect/' : 'ton://connect/') + sessionId + '?endpoint=connect.tonhubapi.com'
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -258,7 +258,7 @@ export class TonhubConnector {
|
|||
throw Error('Invalid response from server');
|
||||
}
|
||||
if (ex.state === 'initing') {
|
||||
if (ex.testnet !== (this.network === 'sandbox')) {
|
||||
if (ex.testnet !== (this.network === 'testnet')) {
|
||||
return { state: 'revoked' };
|
||||
}
|
||||
return {
|
||||
|
@ -273,7 +273,7 @@ export class TonhubConnector {
|
|||
if (ex.revoked) {
|
||||
return { state: 'revoked' };
|
||||
}
|
||||
if (ex.testnet !== (this.network === 'sandbox')) {
|
||||
if (ex.testnet !== (this.network === 'testnet')) {
|
||||
return { state: 'revoked' };
|
||||
}
|
||||
if (!TonhubConnector.verifyWalletConfig(sessionId, ex.wallet)) {
|
||||
|
|
|
@ -6,7 +6,7 @@ const configCodec = t.type({
|
|||
version: t.literal(1),
|
||||
platform: t.union([t.literal('ios'), t.literal('android')]),
|
||||
platformVersion: t.union([t.string, t.number]),
|
||||
network: t.union([t.literal('sandbox'), t.literal('mainnet')]),
|
||||
network: t.union([t.literal('testnet'), t.literal('mainnet')]),
|
||||
address: t.string,
|
||||
publicKey: t.string,
|
||||
walletConfig: t.string,
|
||||
|
@ -23,7 +23,7 @@ const configCodec = t.type({
|
|||
|
||||
export type TonhubLocalConfig = {
|
||||
version: number,
|
||||
network: 'sandbox' | 'mainnet',
|
||||
network: 'testnet' | 'mainnet',
|
||||
address: string,
|
||||
publicKey: string,
|
||||
walletConfig: string,
|
||||
|
@ -140,12 +140,12 @@ export class TonhubLocalConnector {
|
|||
return true;
|
||||
}
|
||||
|
||||
readonly network: 'mainnet' | 'sandbox';
|
||||
readonly network: 'mainnet' | 'testnet';
|
||||
readonly config: TonhubLocalConfig;
|
||||
|
||||
#provider: (name: string, args: any, callback: (res: any) => void) => void;
|
||||
|
||||
constructor(network: 'mainnet' | 'sandbox') {
|
||||
constructor(network: 'mainnet' | 'testnet') {
|
||||
if (typeof window === 'undefined') {
|
||||
throw Error('Not running in browser');
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue