New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@0xsequence/waas

Package Overview
Dependencies
Maintainers
0
Versions
155
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@0xsequence/waas - npm Package Compare versions

Comparing version 2.2.3 to 2.2.4

5

dist/declarations/src/auth.d.ts
import { Observer } from "./base.js";
import { Account, IdentityType, IntentResponseIdToken } from "./clients/intent.gen.js";
import { Store } from "./store.js";
import { SendContractCallArgs, SendERC1155Args, SendERC20Args, SendERC721Args, SendTransactionsArgs, SignMessageArgs } from "./intents/index.js";
import { FeeOptionsResponse, MaySentTransactionResponse, SignedMessageResponse } from "./intents/responses.js";
import { SendContractCallArgs, SendERC1155Args, SendERC20Args, SendERC721Args, SendTransactionsArgs, SignMessageArgs, SignTypedDataArgs } from "./intents/index.js";
import { FeeOptionsResponse, MaySentTransactionResponse, SignedMessageResponse, SignedTypedDataResponse } from "./intents/responses.js";
import { Chain, Session } from "./clients/authenticator.gen.js";

@@ -132,2 +132,3 @@ import { SimpleNetwork, WithSimpleNetwork } from "./networks.js";

signMessage(args: WithSimpleNetwork<SignMessageArgs> & CommonAuthArgs): Promise<SignedMessageResponse>;
signTypedData(args: WithSimpleNetwork<SignTypedDataArgs> & CommonAuthArgs): Promise<SignedTypedDataResponse>;
private trySendTransactionIntent;

@@ -134,0 +135,0 @@ sendTransaction(args: WithSimpleNetwork<SendTransactionsArgs> & CommonAuthArgs): Promise<MaySentTransactionResponse>;

16

dist/declarations/src/base.d.ts

@@ -1,6 +0,6 @@

import { GetTransactionReceiptArgs, Intent, OpenSessionArgs, SendContractCallArgs, SendERC1155Args, SendERC20Args, SendERC721Args, SendTransactionsArgs, SignedIntent, SignMessageArgs } from "./intents/index.js";
import { GetTransactionReceiptArgs, Intent, OpenSessionArgs, SendContractCallArgs, SendERC1155Args, SendERC20Args, SendERC721Args, SendTransactionsArgs, SignedIntent, SignMessageArgs, SignTypedDataArgs } from "./intents/index.js";
import { Store } from "./store.js";
import { OpenSessionResponse } from "./intents/responses.js";
import { SimpleNetwork, WithSimpleNetwork } from "./networks.js";
import { IntentDataFederateAccount, IntentDataFeeOptions, IntentDataFinishValidateSession, IntentDataGetSession, IntentDataGetTransactionReceipt, IntentDataInitiateAuth, IntentDataListAccounts, IntentDataOpenSession, IntentDataSendTransaction, IntentDataSignMessage, IntentDataValidateSession } from "./clients/intent.gen.js";
import { IntentDataFederateAccount, IntentDataFeeOptions, IntentDataFinishValidateSession, IntentDataGetSession, IntentDataGetTransactionReceipt, IntentDataInitiateAuth, IntentDataListAccounts, IntentDataOpenSession, IntentDataSendTransaction, IntentDataSignMessage, IntentDataSignTypedData, IntentDataValidateSession } from "./clients/intent.gen.js";
import { SubtleCryptoBackend } from "./subtle-crypto.js";

@@ -107,2 +107,14 @@ import { SecureStoreBackend } from "./secure-store.js";

/**
* This method can be used to sign typed data using waas API. It can only be used
* after successfully signing in with the `signIn` and `completeSignIn` methods.
*
* The method does not sign the typed data. It only returns a payload
* that must be sent to the waas API to complete the sign process.
*
* @param chainId The network on which the typed data will be signed
* @param typedData The typed data that will be signed
* @return a payload that must be sent to the waas API to complete sign process
*/
signTypedData(args: WithSimpleNetwork<SignTypedDataArgs> & ExtraArgs): Promise<SignedIntent<IntentDataSignTypedData>>;
/**
* This method can be used to send transactions to the waas API. It can only be used

@@ -109,0 +121,0 @@ * after successfully signing in with the `signIn` and `completeSignIn` methods.

export declare const WebRPCVersion = "v1";
export declare const WebRPCSchemaVersion = "v0.1.0";
export declare const WebRPCSchemaHash = "35f86317a98af91896d1114ad52dd22102d9de9f";
export declare const WebRPCSchemaHash = "562a7e7a15dc77925b3f241a08d83c8c548ba5c3";
export declare enum IntentName {

@@ -15,2 +15,3 @@ initiateAuth = "initiateAuth",

signMessage = "signMessage",
signTypedData = "signTypedData",
sendTransaction = "sendTransaction",

@@ -21,3 +22,7 @@ getTransactionReceipt = "getTransactionReceipt",

listAccounts = "listAccounts",
getIdToken = "getIdToken"
getIdToken = "getIdToken",
adoptChildWallet = "adoptChildWallet",
getAdopter = "getAdopter",
confirmIntent = "confirmIntent",
getConfirmationStatus = "getConfirmationStatus"
}

@@ -34,2 +39,3 @@ export declare enum IntentResponseCode {

signedMessage = "signedMessage",
signedTypedData = "signedTypedData",
feeOptions = "feeOptions",

@@ -42,3 +48,6 @@ transactionReceipt = "transactionReceipt",

accountRemoved = "accountRemoved",
idToken = "idToken"
idToken = "idToken",
adopter = "adopter",
childWalletAdopted = "childWalletAdopted",
confirmationRequired = "confirmationRequired"
}

@@ -69,2 +78,6 @@ export declare enum IdentityType {

}
export declare enum Migration {
OIDCToStytch = "OIDCToStytch",
OIDCToEmail = "OIDCToEmail"
}
export interface Version {

@@ -178,2 +191,6 @@ webrpcVersion: string;

}
export interface Page {
limit?: number;
after?: string;
}
export interface WaasAuthenticator {

@@ -210,2 +227,4 @@ registerSession(args: RegisterSessionArgs, headers?: object, signal?: AbortSignal): Promise<RegisterSessionReturn>;

updateTenant(args: UpdateTenantArgs, headers?: object, signal?: AbortSignal): Promise<UpdateTenantReturn>;
nextMigrationBatch(args: NextMigrationBatchArgs, headers?: object, signal?: AbortSignal): Promise<NextMigrationBatchReturn>;
processMigrationBatch(args: ProcessMigrationBatchArgs, headers?: object, signal?: AbortSignal): Promise<ProcessMigrationBatchReturn>;
}

@@ -255,2 +274,24 @@ export interface VersionArgs {

}
export interface NextMigrationBatchArgs {
migration: Migration;
projectId: number;
page: Page;
}
export interface NextMigrationBatchReturn {
page: Page;
items: Array<string>;
}
export interface ProcessMigrationBatchArgs {
migration: Migration;
projectId: number;
items: Array<string>;
}
export interface ProcessMigrationBatchReturn {
logs: {
[key: string]: Array<string>;
};
errors: {
[key: string]: string;
};
}
export declare class WaasAuthenticator implements WaasAuthenticator {

@@ -278,2 +319,4 @@ protected hostname: string;

updateTenant: (args: UpdateTenantArgs, headers?: object, signal?: AbortSignal) => Promise<UpdateTenantReturn>;
nextMigrationBatch: (args: NextMigrationBatchArgs, headers?: object, signal?: AbortSignal) => Promise<NextMigrationBatchReturn>;
processMigrationBatch: (args: ProcessMigrationBatchArgs, headers?: object, signal?: AbortSignal) => Promise<ProcessMigrationBatchReturn>;
}

@@ -280,0 +323,0 @@ export declare class WebrpcError extends Error {

export declare const WebRPCVersion = "v1";
export declare const WebRPCSchemaVersion = "v0.1.0";
export declare const WebRPCSchemaHash = "2e4f5d4a4107d8e8c74c252f4d1a7aad391db6e7";
export declare const WebRPCSchemaHash = "2ceeffac8ca0cebead69d58a1aa7a27d30ecb864";
export declare enum IntentName {

@@ -15,2 +15,3 @@ initiateAuth = "initiateAuth",

signMessage = "signMessage",
signTypedData = "signTypedData",
sendTransaction = "sendTransaction",

@@ -21,3 +22,7 @@ getTransactionReceipt = "getTransactionReceipt",

listAccounts = "listAccounts",
getIdToken = "getIdToken"
getIdToken = "getIdToken",
adoptChildWallet = "adoptChildWallet",
getAdopter = "getAdopter",
confirmIntent = "confirmIntent",
getConfirmationStatus = "getConfirmationStatus"
}

@@ -42,2 +47,3 @@ export declare enum TransactionType {

signedMessage = "signedMessage",
signedTypedData = "signedTypedData",
feeOptions = "feeOptions",

@@ -50,3 +56,6 @@ transactionReceipt = "transactionReceipt",

accountRemoved = "accountRemoved",
idToken = "idToken"
idToken = "idToken",
adopter = "adopter",
childWalletAdopted = "childWalletAdopted",
confirmationRequired = "confirmationRequired"
}

@@ -66,2 +75,5 @@ export declare enum FeeTokenType {

}
export declare enum ChallengeType {
EmailOTP = "EmailOTP"
}
export interface Intent {

@@ -125,2 +137,7 @@ version: string;

}
export interface IntentDataSignTypedData {
network: string;
wallet: string;
typedData: any;
}
export interface IntentDataFeeOptions {

@@ -158,2 +175,12 @@ network: string;

}
export interface IntentDataAdoptChildWallet {
network: string;
wallet: string;
adopter: string;
adopterProof: AdopterProof;
}
export interface AdopterProof {
message: string;
signature: string;
}
export interface IntentDataGetIdToken {

@@ -164,2 +191,14 @@ sessionId: string;

}
export interface IntentDataGetAdopter {
wallet: string;
}
export interface IntentDataConfirmIntent {
wallet: string;
confirmationID: string;
challengeAnswer: string;
}
export interface IntentDataGetConfirmationStatus {
wallet: string;
confirmationID: string;
}
export interface TransactionRaw {

@@ -259,2 +298,6 @@ type: string;

}
export interface IntentResponseSignedTypedData {
signature: string;
encodedTypedData: string;
}
export interface FeeOption {

@@ -306,2 +349,15 @@ token: FeeToken;

}
export interface IntentResponseChildWalletAdopted {
adopterAddress: string;
}
export interface IntentResponseAdopter {
adopterAddress: string;
}
export interface IntentResponseConfirmationRequired {
confirmationId: string;
salt: string;
challengeType: ChallengeType;
challengeDestination?: string;
expiresIn: number;
}
export interface Account {

@@ -308,0 +364,0 @@ id: string;

@@ -1,2 +0,2 @@

import { IntentDataSignMessage } from "../clients/intent.gen.js";
import { IntentDataSignMessage, IntentDataSignTypedData } from "../clients/intent.gen.js";
import { Intent } from "./base.js";

@@ -12,2 +12,6 @@ interface BaseArgs {

export declare function signMessage({ wallet, chainId, message, lifespan }: SignMessageArgs & BaseArgs): Intent<IntentDataSignMessage>;
export type SignTypedDataArgs = {
typedData: any;
};
export declare function signTypedData({ wallet, chainId, typedData, lifespan }: SignTypedDataArgs & BaseArgs): Intent<IntentDataSignTypedData>;
export {};

@@ -85,2 +85,9 @@ import { FeeOption, IntentDataSendTransaction, IntentResponseAccountFederated, IntentResponseAccountList, IntentResponseAuthInitiated, IntentResponseCode, IntentResponseGetSession, IntentResponseIdToken, IntentResponseValidationFinished, IntentResponseValidationStarted } from "../clients/intent.gen.js";

};
export type SignedTypedDataResponse = {
code: 'signedTypedData';
data: {
typedData: any;
signature: string;
};
};
export type SessionAuthProofResponse = {

@@ -114,2 +121,3 @@ code: 'sessionAuthProof';

export declare function isSignedMessageResponse(receipt: any): receipt is SignedMessageResponse;
export declare function isSignedTypedDataResponse(receipt: any): receipt is SignedTypedDataResponse;
export declare function isSessionAuthProofResponse(receipt: any): receipt is SessionAuthProofResponse;

@@ -116,0 +124,0 @@ export declare function isFeeOptionsResponse(receipt: any): receipt is FeeOptionsResponse;

{
"name": "@0xsequence/waas",
"version": "2.2.3",
"version": "2.2.4",
"description": "waas session client",

@@ -17,5 +17,5 @@ "repository": "https://github.com/0xsequence/sequence.js/tree/master/packages/waas",

"jwt-decode": "^4.0.0",
"@0xsequence/core": "2.2.3",
"@0xsequence/network": "2.2.3",
"@0xsequence/utils": "2.2.3"
"@0xsequence/core": "2.2.4",
"@0xsequence/network": "2.2.4",
"@0xsequence/utils": "2.2.4"
},

@@ -22,0 +22,0 @@ "files": [

@@ -22,3 +22,4 @@ import { Observer, SequenceWaaSBase } from './base'

updateTimeDrift,
getLocalTime
getLocalTime,
SignTypedDataArgs
} from './intents'

@@ -39,6 +40,8 @@ import {

isSignedMessageResponse,
isSignedTypedDataResponse,
isTimedOutTransactionResponse,
isValidationRequiredResponse,
MaySentTransactionResponse,
SignedMessageResponse
SignedMessageResponse,
SignedTypedDataResponse
} from './intents/responses'

@@ -785,2 +788,9 @@ import { WaasAuthenticator, AnswerIncorrectError, Chain, EmailAlreadyInUseError, Session } from './clients/authenticator.gen'

async signTypedData(args: WithSimpleNetwork<SignTypedDataArgs> & CommonAuthArgs): Promise<SignedTypedDataResponse> {
await this.updateTimeDrift()
const intent = await this.waas.signTypedData(await this.useIdentifier(args))
return this.trySendIntent(args, intent, isSignedTypedDataResponse)
}
private async trySendTransactionIntent(

@@ -787,0 +797,0 @@ intent: SignedIntent<IntentDataSendTransaction>,

@@ -31,2 +31,4 @@ import {

SignMessageArgs,
signTypedData,
SignTypedDataArgs,
validateSession

@@ -51,2 +53,3 @@ } from './intents'

IntentDataSignMessage,
IntentDataSignTypedData,
IntentDataValidateSession

@@ -428,2 +431,24 @@ } from './clients/intent.gen'

/**
* This method can be used to sign typed data using waas API. It can only be used
* after successfully signing in with the `signIn` and `completeSignIn` methods.
*
* The method does not sign the typed data. It only returns a payload
* that must be sent to the waas API to complete the sign process.
*
* @param chainId The network on which the typed data will be signed
* @param typedData The typed data that will be signed
* @return a payload that must be sent to the waas API to complete sign process
*/
async signTypedData(args: WithSimpleNetwork<SignTypedDataArgs> & ExtraArgs): Promise<SignedIntent<IntentDataSignTypedData>> {
const packet = signTypedData({
chainId: toNetworkID(args.network || this.config.network),
...args,
lifespan: args.lifespan ?? DEFAULT_LIFESPAN,
wallet: await this.getWalletAddress()
})
return this.signIntent(packet)
}
/**
* This method can be used to send transactions to the waas API. It can only be used

@@ -430,0 +455,0 @@ * after successfully signing in with the `signIn` and `completeSignIn` methods.

/* eslint-disable */
// sequence-waas-authenticator v0.1.0 35f86317a98af91896d1114ad52dd22102d9de9f
// sequence-waas-authenticator v0.1.0 562a7e7a15dc77925b3f241a08d83c8c548ba5c3
// --
// Code generated by webrpc-gen@v0.18.8 with typescript generator. DO NOT EDIT.
// Code generated by webrpc-gen@v0.19.3 with typescript generator. DO NOT EDIT.
//

@@ -9,9 +9,9 @@ // webrpc-gen -schema=authenticator.ridl -target=typescript -client -out=./clients/authenticator.gen.ts

// WebRPC description and code-gen version
export const WebRPCVersion = 'v1'
export const WebRPCVersion = "v1"
// Schema version of your RIDL schema
export const WebRPCSchemaVersion = 'v0.1.0'
export const WebRPCSchemaVersion = "v0.1.0"
// Schema hash generated from your RIDL schema
export const WebRPCSchemaHash = '35f86317a98af91896d1114ad52dd22102d9de9f'
export const WebRPCSchemaHash = "562a7e7a15dc77925b3f241a08d83c8c548ba5c3"

@@ -22,2 +22,3 @@ //

export enum IntentName {

@@ -34,2 +35,3 @@ initiateAuth = 'initiateAuth',

signMessage = 'signMessage',
signTypedData = 'signTypedData',
sendTransaction = 'sendTransaction',

@@ -40,3 +42,7 @@ getTransactionReceipt = 'getTransactionReceipt',

listAccounts = 'listAccounts',
getIdToken = 'getIdToken'
getIdToken = 'getIdToken',
adoptChildWallet = 'adoptChildWallet',
getAdopter = 'getAdopter',
confirmIntent = 'confirmIntent',
getConfirmationStatus = 'getConfirmationStatus'
}

@@ -54,2 +60,3 @@

signedMessage = 'signedMessage',
signedTypedData = 'signedTypedData',
feeOptions = 'feeOptions',

@@ -62,3 +69,6 @@ transactionReceipt = 'transactionReceipt',

accountRemoved = 'accountRemoved',
idToken = 'idToken'
idToken = 'idToken',
adopter = 'adopter',
childWalletAdopted = 'childWalletAdopted',
confirmationRequired = 'confirmationRequired'
}

@@ -94,2 +104,7 @@

export enum Migration {
OIDCToStytch = 'OIDCToStytch',
OIDCToEmail = 'OIDCToEmail'
}
export interface Version {

@@ -220,2 +235,7 @@ webrpcVersion: string

export interface Page {
limit?: number
after?: string
}
export interface WaasAuthenticator {

@@ -234,3 +254,3 @@ registerSession(args: RegisterSessionArgs, headers?: object, signal?: AbortSignal): Promise<RegisterSessionReturn>

session: Session
response: IntentResponse
response: IntentResponse
}

@@ -242,8 +262,9 @@ export interface SendIntentArgs {

export interface SendIntentReturn {
response: IntentResponse
response: IntentResponse
}
export interface ChainListArgs {}
export interface ChainListArgs {
}
export interface ChainListReturn {
chains: Array<Chain>
chains: Array<Chain>
}

@@ -258,18 +279,23 @@

updateTenant(args: UpdateTenantArgs, headers?: object, signal?: AbortSignal): Promise<UpdateTenantReturn>
nextMigrationBatch(args: NextMigrationBatchArgs, headers?: object, signal?: AbortSignal): Promise<NextMigrationBatchReturn>
processMigrationBatch(args: ProcessMigrationBatchArgs, headers?: object, signal?: AbortSignal): Promise<ProcessMigrationBatchReturn>
}
export interface VersionArgs {}
export interface VersionArgs {
}
export interface VersionReturn {
version: Version
version: Version
}
export interface RuntimeStatusArgs {}
export interface RuntimeStatusArgs {
}
export interface RuntimeStatusReturn {
status: RuntimeStatus
status: RuntimeStatus
}
export interface ClockArgs {}
export interface ClockArgs {
}
export interface ClockReturn {
serverTime: string
serverTime: string
}

@@ -281,3 +307,3 @@ export interface GetTenantArgs {

export interface GetTenantReturn {
tenant: Tenant
tenant: Tenant
}

@@ -295,3 +321,3 @@ export interface CreateTenantArgs {

tenant: Tenant
upgradeCode: string
upgradeCode: string
}

@@ -307,5 +333,27 @@ export interface UpdateTenantArgs {

export interface UpdateTenantReturn {
tenant: Tenant
tenant: Tenant
}
export interface NextMigrationBatchArgs {
migration: Migration
projectId: number
page: Page
}
export interface NextMigrationBatchReturn {
page: Page
items: Array<string>
}
export interface ProcessMigrationBatchArgs {
migration: Migration
projectId: number
items: Array<string>
}
export interface ProcessMigrationBatchReturn {
logs: {[key: string]: Array<string>}
errors: {[key: string]: string}
}
//

@@ -327,48 +375,47 @@ // Client

}
registerSession = (args: RegisterSessionArgs, headers?: object, signal?: AbortSignal): Promise<RegisterSessionReturn> => {
return this.fetch(this.url('RegisterSession'), createHTTPRequest(args, headers, signal)).then(
res => {
return buildResponse(res).then(_data => {
return {
session: <Session>_data.session,
response: <IntentResponse>_data.response
}
})
},
error => {
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` })
}
)
return this.fetch(
this.url('RegisterSession'),
createHTTPRequest(args, headers, signal)).then((res) => {
return buildResponse(res).then(_data => {
return {
session: <Session>(_data.session),
response: <IntentResponse>(_data.response),
}
})
}, (error) => {
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` })
})
}
sendIntent = (args: SendIntentArgs, headers?: object, signal?: AbortSignal): Promise<SendIntentReturn> => {
return this.fetch(this.url('SendIntent'), createHTTPRequest(args, headers, signal)).then(
res => {
return buildResponse(res).then(_data => {
return {
response: <IntentResponse>_data.response
}
})
},
error => {
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` })
}
)
return this.fetch(
this.url('SendIntent'),
createHTTPRequest(args, headers, signal)).then((res) => {
return buildResponse(res).then(_data => {
return {
response: <IntentResponse>(_data.response),
}
})
}, (error) => {
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` })
})
}
chainList = (headers?: object, signal?: AbortSignal): Promise<ChainListReturn> => {
return this.fetch(this.url('ChainList'), createHTTPRequest({}, headers, signal)).then(
res => {
return buildResponse(res).then(_data => {
return {
chains: <Array<Chain>>_data.chains
}
})
},
error => {
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` })
}
)
return this.fetch(
this.url('ChainList'),
createHTTPRequest({}, headers, signal)
).then((res) => {
return buildResponse(res).then(_data => {
return {
chains: <Array<Chain>>(_data.chains),
}
})
}, (error) => {
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` })
})
}
}

@@ -388,96 +435,124 @@ export class WaasAuthenticatorAdmin implements WaasAuthenticatorAdmin {

}
version = (headers?: object, signal?: AbortSignal): Promise<VersionReturn> => {
return this.fetch(this.url('Version'), createHTTPRequest({}, headers, signal)).then(
res => {
return buildResponse(res).then(_data => {
return {
version: <Version>_data.version
}
})
},
error => {
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` })
}
)
return this.fetch(
this.url('Version'),
createHTTPRequest({}, headers, signal)
).then((res) => {
return buildResponse(res).then(_data => {
return {
version: <Version>(_data.version),
}
})
}, (error) => {
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` })
})
}
runtimeStatus = (headers?: object, signal?: AbortSignal): Promise<RuntimeStatusReturn> => {
return this.fetch(this.url('RuntimeStatus'), createHTTPRequest({}, headers, signal)).then(
res => {
return buildResponse(res).then(_data => {
return {
status: <RuntimeStatus>_data.status
}
})
},
error => {
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` })
}
)
return this.fetch(
this.url('RuntimeStatus'),
createHTTPRequest({}, headers, signal)
).then((res) => {
return buildResponse(res).then(_data => {
return {
status: <RuntimeStatus>(_data.status),
}
})
}, (error) => {
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` })
})
}
clock = (headers?: object, signal?: AbortSignal): Promise<ClockReturn> => {
return this.fetch(this.url('Clock'), createHTTPRequest({}, headers, signal)).then(
res => {
return buildResponse(res).then(_data => {
return {
serverTime: <string>_data.serverTime
}
})
},
error => {
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` })
}
)
return this.fetch(
this.url('Clock'),
createHTTPRequest({}, headers, signal)
).then((res) => {
return buildResponse(res).then(_data => {
return {
serverTime: <string>(_data.serverTime),
}
})
}, (error) => {
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` })
})
}
getTenant = (args: GetTenantArgs, headers?: object, signal?: AbortSignal): Promise<GetTenantReturn> => {
return this.fetch(this.url('GetTenant'), createHTTPRequest(args, headers, signal)).then(
res => {
return buildResponse(res).then(_data => {
return {
tenant: <Tenant>_data.tenant
}
})
},
error => {
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` })
}
)
return this.fetch(
this.url('GetTenant'),
createHTTPRequest(args, headers, signal)).then((res) => {
return buildResponse(res).then(_data => {
return {
tenant: <Tenant>(_data.tenant),
}
})
}, (error) => {
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` })
})
}
createTenant = (args: CreateTenantArgs, headers?: object, signal?: AbortSignal): Promise<CreateTenantReturn> => {
return this.fetch(this.url('CreateTenant'), createHTTPRequest(args, headers, signal)).then(
res => {
return buildResponse(res).then(_data => {
return {
tenant: <Tenant>_data.tenant,
upgradeCode: <string>_data.upgradeCode
}
})
},
error => {
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` })
}
)
return this.fetch(
this.url('CreateTenant'),
createHTTPRequest(args, headers, signal)).then((res) => {
return buildResponse(res).then(_data => {
return {
tenant: <Tenant>(_data.tenant),
upgradeCode: <string>(_data.upgradeCode),
}
})
}, (error) => {
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` })
})
}
updateTenant = (args: UpdateTenantArgs, headers?: object, signal?: AbortSignal): Promise<UpdateTenantReturn> => {
return this.fetch(this.url('UpdateTenant'), createHTTPRequest(args, headers, signal)).then(
res => {
return buildResponse(res).then(_data => {
return {
tenant: <Tenant>_data.tenant
}
})
},
error => {
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` })
}
)
return this.fetch(
this.url('UpdateTenant'),
createHTTPRequest(args, headers, signal)).then((res) => {
return buildResponse(res).then(_data => {
return {
tenant: <Tenant>(_data.tenant),
}
})
}, (error) => {
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` })
})
}
nextMigrationBatch = (args: NextMigrationBatchArgs, headers?: object, signal?: AbortSignal): Promise<NextMigrationBatchReturn> => {
return this.fetch(
this.url('NextMigrationBatch'),
createHTTPRequest(args, headers, signal)).then((res) => {
return buildResponse(res).then(_data => {
return {
page: <Page>(_data.page),
items: <Array<string>>(_data.items),
}
})
}, (error) => {
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` })
})
}
processMigrationBatch = (args: ProcessMigrationBatchArgs, headers?: object, signal?: AbortSignal): Promise<ProcessMigrationBatchReturn> => {
return this.fetch(
this.url('ProcessMigrationBatch'),
createHTTPRequest(args, headers, signal)).then((res) => {
return buildResponse(res).then(_data => {
return {
logs: <{[key: string]: Array<string>}>(_data.logs),
errors: <{[key: string]: string}>(_data.errors),
}
})
}, (error) => {
throw WebrpcRequestFailedError.new({ cause: `fetch(): ${error.message || ''}` })
})
}
}
const createHTTPRequest = (body: object = {}, headers: object = {}, signal: AbortSignal | null = null): object => {
const createHTTPRequest = (body: object = {}, headers: object = {}, signal: AbortSignal | null = null): object => {
return {

@@ -496,5 +571,5 @@ method: 'POST',

data = JSON.parse(text)
} catch (error) {
} catch(error) {
let message = ''
if (error instanceof Error) {
if (error instanceof Error) {
message = error.message

@@ -504,7 +579,7 @@ }

status: res.status,
cause: `JSON.parse(): ${message}: response text: ${text}`
})
cause: `JSON.parse(): ${message}: response text: ${text}`},
)
}
if (!res.ok) {
const code: number = typeof data.code === 'number' ? data.code : 0
const code: number = (typeof data.code === 'number') ? data.code : 0
throw (webrpcErrorByCode[code] || WebrpcError).new(data)

@@ -691,2 +766,3 @@ }

// Schema errors

@@ -798,2 +874,3 @@

export enum errors {

@@ -818,3 +895,3 @@ WebrpcEndpoint = 'WebrpcEndpoint',

ChallengeExpired = 'ChallengeExpired',
TooManyAttempts = 'TooManyAttempts'
TooManyAttempts = 'TooManyAttempts',
}

@@ -841,5 +918,6 @@

[7004]: ChallengeExpiredError,
[7005]: TooManyAttemptsError
[7005]: TooManyAttemptsError,
}
export type Fetch = (input: RequestInfo, init?: RequestInit) => Promise<Response>
/* eslint-disable */
// sequence-waas-intents v0.1.0 2e4f5d4a4107d8e8c74c252f4d1a7aad391db6e7
// sequence-waas-intents v0.1.0 2ceeffac8ca0cebead69d58a1aa7a27d30ecb864
// --

@@ -9,9 +9,9 @@ // Code generated by webrpc-gen@v0.19.3 with typescript generator. DO NOT EDIT.

// WebRPC description and code-gen version
export const WebRPCVersion = 'v1'
export const WebRPCVersion = "v1"
// Schema version of your RIDL schema
export const WebRPCSchemaVersion = 'v0.1.0'
export const WebRPCSchemaVersion = "v0.1.0"
// Schema hash generated from your RIDL schema
export const WebRPCSchemaHash = '2e4f5d4a4107d8e8c74c252f4d1a7aad391db6e7'
export const WebRPCSchemaHash = "2ceeffac8ca0cebead69d58a1aa7a27d30ecb864"

@@ -22,2 +22,3 @@ //

export enum IntentName {

@@ -34,2 +35,3 @@ initiateAuth = 'initiateAuth',

signMessage = 'signMessage',
signTypedData = 'signTypedData',
sendTransaction = 'sendTransaction',

@@ -40,3 +42,7 @@ getTransactionReceipt = 'getTransactionReceipt',

listAccounts = 'listAccounts',
getIdToken = 'getIdToken'
getIdToken = 'getIdToken',
adoptChildWallet = 'adoptChildWallet',
getAdopter = 'getAdopter',
confirmIntent = 'confirmIntent',
getConfirmationStatus = 'getConfirmationStatus'
}

@@ -63,2 +69,3 @@

signedMessage = 'signedMessage',
signedTypedData = 'signedTypedData',
feeOptions = 'feeOptions',

@@ -71,3 +78,6 @@ transactionReceipt = 'transactionReceipt',

accountRemoved = 'accountRemoved',
idToken = 'idToken'
idToken = 'idToken',
adopter = 'adopter',
childWalletAdopted = 'childWalletAdopted',
confirmationRequired = 'confirmationRequired'
}

@@ -90,2 +100,6 @@

export enum ChallengeType {
EmailOTP = 'EmailOTP'
}
export interface Intent {

@@ -160,2 +174,8 @@ version: string

export interface IntentDataSignTypedData {
network: string
wallet: string
typedData: any
}
export interface IntentDataFeeOptions {

@@ -199,2 +219,14 @@ network: string

export interface IntentDataAdoptChildWallet {
network: string
wallet: string
adopter: string
adopterProof: AdopterProof
}
export interface AdopterProof {
message: string
signature: string
}
export interface IntentDataGetIdToken {

@@ -206,2 +238,17 @@ sessionId: string

export interface IntentDataGetAdopter {
wallet: string
}
export interface IntentDataConfirmIntent {
wallet: string
confirmationID: string
challengeAnswer: string
}
export interface IntentDataGetConfirmationStatus {
wallet: string
confirmationID: string
}
export interface TransactionRaw {

@@ -280,5 +327,7 @@ type: string

export interface IntentResponseSessionClosed {}
export interface IntentResponseSessionClosed {
}
export interface IntentResponseValidateSession {}
export interface IntentResponseValidateSession {
}

@@ -320,2 +369,7 @@ export interface IntentResponseValidationRequired {

export interface IntentResponseSignedTypedData {
signature: string
encodedTypedData: string
}
export interface FeeOption {

@@ -368,3 +422,4 @@ token: FeeToken

export interface IntentResponseAccountRemoved {}
export interface IntentResponseAccountRemoved {
}

@@ -376,2 +431,18 @@ export interface IntentResponseIdToken {

export interface IntentResponseChildWalletAdopted {
adopterAddress: string
}
export interface IntentResponseAdopter {
adopterAddress: string
}
export interface IntentResponseConfirmationRequired {
confirmationId: string
salt: string
challengeType: ChallengeType
challengeDestination?: string
expiresIn: number
}
export interface Account {

@@ -378,0 +449,0 @@ id: string

import { ethers } from 'ethers'
import { IntentDataSignMessage, IntentName } from '../clients/intent.gen'
import { IntentDataSignMessage, IntentDataSignTypedData, IntentName } from '../clients/intent.gen'
import { Intent, makeIntent } from './base'

@@ -22,1 +22,13 @@

}
export type SignTypedDataArgs = {
typedData: any
}
export function signTypedData({ wallet, chainId, typedData, lifespan }: SignTypedDataArgs & BaseArgs): Intent<IntentDataSignTypedData> {
return makeIntent(IntentName.signTypedData, lifespan, {
wallet,
network: chainId.toString(),
typedData
})
}

@@ -110,2 +110,10 @@ import {

export type SignedTypedDataResponse = {
code: 'signedTypedData'
data: {
typedData: any
signature: string
}
}
export type SessionAuthProofResponse = {

@@ -208,2 +216,13 @@ code: 'sessionAuthProof'

export function isSignedTypedDataResponse(receipt: any): receipt is SignedTypedDataResponse {
return (
typeof receipt === 'object' &&
typeof receipt.code === 'string' &&
receipt.code === 'signedTypedData' &&
typeof receipt.data === 'object' &&
typeof receipt.data.encodedTypedData === 'string' &&
typeof receipt.data.signature === 'string'
)
}
export function isSessionAuthProofResponse(receipt: any): receipt is SessionAuthProofResponse {

@@ -210,0 +229,0 @@ return (

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc