@aptos-labs/wallet-standard
Advanced tools
Comparing version 0.0.1 to 0.0.2
@@ -1,5 +0,15 @@ | ||
import { WalletWithFeatures, IdentifierRecord, StandardDisconnectMethod, Wallet } from '@wallet-standard/core'; | ||
import { WalletAccount, WalletWithFeatures, IdentifierRecord, StandardDisconnectMethod, Wallet } from '@wallet-standard/core'; | ||
export * from '@wallet-standard/core'; | ||
import { Account, Network, AnyRawTransaction, PendingTransactionResponse, Signature, AccountAuthenticator } from '@aptos-labs/ts-sdk'; | ||
declare enum AptosAccountVariant { | ||
Ed25519 = 0, | ||
MultiEd25519 = 1, | ||
SingleKey = 2, | ||
MultiKey = 3 | ||
} | ||
interface AptosWalletAccount extends WalletAccount { | ||
readonly variant: AptosAccountVariant; | ||
} | ||
/** TODO: docs */ | ||
@@ -82,3 +92,3 @@ type TransactionHash = `0x${string}`; | ||
prefix: 'APTOS'; | ||
signature: Signature; | ||
signature: Signature | Signature[]; | ||
bitmap?: Uint8Array; | ||
@@ -258,3 +268,3 @@ }; | ||
*/ | ||
type AptosFeatures = AptosSignAndSubmitTransactionFeature & AptosSignTransactionFeature & AptosSignMessageFeature & AptosConnectFeature & AptosOnAccountChangeFeature & AptosOnNetworkChangeFeature & AptosGetNetworkFeature & AptosGetAccountFeature & AptosDisconnectFeature & AptosOpenInMobileAppFeature & AptosChangeNetworkFeature; | ||
type AptosFeatures = AptosConnectFeature & AptosGetAccountFeature & AptosGetNetworkFeature & AptosOnAccountChangeFeature & AptosOnNetworkChangeFeature & AptosSignAndSubmitTransactionFeature & AptosSignMessageFeature & AptosSignTransactionFeature & Partial<AptosChangeNetworkFeature> & Partial<AptosOpenInMobileAppFeature> & AptosDisconnectFeature; | ||
/** | ||
@@ -271,3 +281,3 @@ * Represents a wallet with all Aptos features. | ||
*/ | ||
type MinimallyRequiredFeatures = Omit<AptosFeatures, 'aptos:openInMobileApp' | 'aptos:changeNetwork'>; | ||
type MinimallyRequiredFeatures = AptosFeatures; | ||
@@ -303,6 +313,3 @@ type ChainsId = `${string}:${string}`; | ||
declare function isWalletWithRequiredFeatureSet<AdditionalFeatures extends Wallet['features']>(wallet: Wallet, additionalFeatures?: (keyof AdditionalFeatures)[]): wallet is WalletWithFeatures<MinimallyRequiredFeatures & AdditionalFeatures>; | ||
declare function getAptosWallets(): WalletWithAptosFeatures[]; | ||
interface AptosWallet extends Wallet { | ||
interface AptosWallet extends WalletWithAptosFeatures { | ||
/** | ||
@@ -314,2 +321,5 @@ * Website URL of the Wallet | ||
export { APTOS_CHAINS, APTOS_DEVNET_CHAIN, APTOS_LOCALNET_CHAIN, APTOS_MAINNET_CHAIN, APTOS_TESTNET_CHAIN, AccountInfo, AptoGetsAccountOutput, AptosAdapter, AptosChain, AptosChangeNetworkFeature, AptosChangeNetworkInput, AptosChangeNetworkMethod, AptosChangeNetworkNamespace, AptosChangeNetworkOutput, AptosChangeNetworkVersion, AptosConnectFeature, AptosConnectInput, AptosConnectMethod, AptosConnectNamespace, AptosConnectOutput, AptosConnectVersion, AptosDisconnectFeature, AptosDisconnectMethod, AptosDisconnectNamespace, AptosDisconnectVersion, AptosFeatures, AptosGetAccountFeature, AptosGetAccountMethod, AptosGetAccountNamespace, AptosGetAccountVersion, AptosGetNetworkFeature, AptosGetNetworkMethod, AptosGetNetworkNamespace, AptosGetNetworkOutput, AptosGetNetworkVersion, AptosOnAccountChangeFeature, AptosOnAccountChangeInput, AptosOnAccountChangeMethod, AptosOnAccountChangeNamespace, AptosOnAccountChangeVersion, AptosOnNetworkChangeFeature, AptosOnNetworkChangeInput, AptosOnNetworkChangeMethod, AptosOnNetworkChangeNamespace, AptosOnNetworkChangeVersion, AptosSignAndSubmitTransactionFeature, AptosSignAndSubmitTransactionInput, AptosSignAndSubmitTransactionMethod, AptosSignAndSubmitTransactionNamespace, AptosSignAndSubmitTransactionOutput, AptosSignAndSubmitTransactionVersion, AptosSignMessageFeature, AptosSignMessageInput, AptosSignMessageMethod, AptosSignMessageNamespace, AptosSignMessageOutput, AptosSignMessageVersion, AptosSignTransactionFeature, AptosSignTransactionMethod, AptosSignTransactionNamespace, AptosSignTransactionOutput, AptosSignTransactionVersion, AptosWallet, ChainsId, MinimallyRequiredFeatures, NetworkInfo, TransactionHash, UserApproval, UserRejection, UserResponse, WalletWithAptosFeatures, WalletWithRequiredFeatures, getAptosWallets, isWalletWithRequiredFeatureSet }; | ||
declare function isWalletWithRequiredFeatureSet<AdditionalFeatures extends Wallet['features']>(wallet: Wallet, additionalFeatures?: (keyof AdditionalFeatures)[]): wallet is WalletWithFeatures<MinimallyRequiredFeatures & AdditionalFeatures>; | ||
declare function getAptosWallets(): AptosWallet[]; | ||
export { APTOS_CHAINS, APTOS_DEVNET_CHAIN, APTOS_LOCALNET_CHAIN, APTOS_MAINNET_CHAIN, APTOS_TESTNET_CHAIN, AccountInfo, AptoGetsAccountOutput, AptosAccountVariant, AptosAdapter, AptosChain, AptosChangeNetworkFeature, AptosChangeNetworkInput, AptosChangeNetworkMethod, AptosChangeNetworkNamespace, AptosChangeNetworkOutput, AptosChangeNetworkVersion, AptosConnectFeature, AptosConnectInput, AptosConnectMethod, AptosConnectNamespace, AptosConnectOutput, AptosConnectVersion, AptosDisconnectFeature, AptosDisconnectMethod, AptosDisconnectNamespace, AptosDisconnectVersion, AptosFeatures, AptosGetAccountFeature, AptosGetAccountMethod, AptosGetAccountNamespace, AptosGetAccountVersion, AptosGetNetworkFeature, AptosGetNetworkMethod, AptosGetNetworkNamespace, AptosGetNetworkOutput, AptosGetNetworkVersion, AptosOnAccountChangeFeature, AptosOnAccountChangeInput, AptosOnAccountChangeMethod, AptosOnAccountChangeNamespace, AptosOnAccountChangeVersion, AptosOnNetworkChangeFeature, AptosOnNetworkChangeInput, AptosOnNetworkChangeMethod, AptosOnNetworkChangeNamespace, AptosOnNetworkChangeVersion, AptosSignAndSubmitTransactionFeature, AptosSignAndSubmitTransactionInput, AptosSignAndSubmitTransactionMethod, AptosSignAndSubmitTransactionNamespace, AptosSignAndSubmitTransactionOutput, AptosSignAndSubmitTransactionVersion, AptosSignMessageFeature, AptosSignMessageInput, AptosSignMessageMethod, AptosSignMessageNamespace, AptosSignMessageOutput, AptosSignMessageVersion, AptosSignTransactionFeature, AptosSignTransactionMethod, AptosSignTransactionNamespace, AptosSignTransactionOutput, AptosSignTransactionVersion, AptosWallet, AptosWalletAccount, ChainsId, MinimallyRequiredFeatures, NetworkInfo, TransactionHash, UserApproval, UserRejection, UserResponse, WalletWithAptosFeatures, WalletWithRequiredFeatures, getAptosWallets, isWalletWithRequiredFeatureSet }; |
@@ -1,2 +0,2 @@ | ||
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _createStarExport(obj) { Object.keys(obj) .filter((key) => key !== "default" && key !== "__esModule") .forEach((key) => { if (exports.hasOwnProperty(key)) { return; } Object.defineProperty(exports, key, {enumerable: true, configurable: true, get: () => obj[key]}); }); }var _core = require('@wallet-standard/core'); _createStarExport(_core);var s="aptos:devnet",p= exports.APTOS_TESTNET_CHAIN ="aptos:testnet",r= exports.APTOS_LOCALNET_CHAIN ="aptos:localnet",a= exports.APTOS_MAINNET_CHAIN ="aptos:mainnet",g= exports.APTOS_CHAINS =[s,p,r,a];var c=["aptos:account","aptos:connect","aptos:disconnect","aptos:onAccountChange","aptos:onNetworkChange","aptos:signAndSubmitTransaction","aptos:signMessage","aptos:signTransaction"];function A(e,o=[]){return[...c,...o].every(t=>t in e.features)}function d(){let{get:e}=_core.getWallets.call(void 0, ),o=e(),t=[];return o.map(n=>{A(n)&&t.push(n)}),t}var S="aptos:signAndSubmitTransaction";var y="aptos:signMessage";var w="aptos:account";var k="aptos:connect";var O="aptos:network";var M="aptos:onAccountChange";var b="aptos:onNetworkChange";var P="aptos:changeNetwork";var V="aptos:disconnect";var v="aptos:signTransaction";exports.APTOS_CHAINS = g; exports.APTOS_DEVNET_CHAIN = s; exports.APTOS_LOCALNET_CHAIN = r; exports.APTOS_MAINNET_CHAIN = a; exports.APTOS_TESTNET_CHAIN = p; exports.AptosChangeNetworkNamespace = P; exports.AptosConnectNamespace = k; exports.AptosDisconnectNamespace = V; exports.AptosGetAccountNamespace = w; exports.AptosGetNetworkNamespace = O; exports.AptosOnAccountChangeNamespace = M; exports.AptosOnNetworkChangeNamespace = b; exports.AptosSignAndSubmitTransactionNamespace = S; exports.AptosSignMessageNamespace = y; exports.AptosSignTransactionNamespace = v; exports.getAptosWallets = d; exports.isWalletWithRequiredFeatureSet = A; | ||
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _createStarExport(obj) { Object.keys(obj) .filter((key) => key !== "default" && key !== "__esModule") .forEach((key) => { if (exports.hasOwnProperty(key)) { return; } Object.defineProperty(exports, key, {enumerable: true, configurable: true, get: () => obj[key]}); }); }var _core = require('@wallet-standard/core'); _createStarExport(_core);var r=(t=>(t[t.Ed25519=0]="Ed25519",t[t.MultiEd25519=1]="MultiEd25519",t[t.SingleKey=2]="SingleKey",t[t.MultiKey=3]="MultiKey",t))(r||{});var p="aptos:devnet",a= exports.APTOS_TESTNET_CHAIN ="aptos:testnet",i= exports.APTOS_LOCALNET_CHAIN ="aptos:localnet",c= exports.APTOS_MAINNET_CHAIN ="aptos:mainnet",x= exports.APTOS_CHAINS =[p,a,i,c];var u=["aptos:account","aptos:connect","aptos:disconnect","aptos:network","aptos:onAccountChange","aptos:onNetworkChange","aptos:signAndSubmitTransaction","aptos:signMessage","aptos:signTransaction"];function m(o,n=[]){return[...u,...n].every(e=>e in o.features)}function h(){let{get:o}=_core.getWallets.call(void 0, ),n=o(),e=[];return n.map(s=>{m(s)&&e.push(s)}),e}var y="aptos:signAndSubmitTransaction";var w="aptos:signMessage";var k="aptos:account";var O="aptos:connect";var I="aptos:network";var R="aptos:onAccountChange";var P="aptos:onNetworkChange";var v="aptos:changeNetwork";var _="aptos:disconnect";var U="aptos:signTransaction";exports.APTOS_CHAINS = x; exports.APTOS_DEVNET_CHAIN = p; exports.APTOS_LOCALNET_CHAIN = i; exports.APTOS_MAINNET_CHAIN = c; exports.APTOS_TESTNET_CHAIN = a; exports.AptosAccountVariant = r; exports.AptosChangeNetworkNamespace = v; exports.AptosConnectNamespace = O; exports.AptosDisconnectNamespace = _; exports.AptosGetAccountNamespace = k; exports.AptosGetNetworkNamespace = I; exports.AptosOnAccountChangeNamespace = R; exports.AptosOnNetworkChangeNamespace = P; exports.AptosSignAndSubmitTransactionNamespace = y; exports.AptosSignMessageNamespace = w; exports.AptosSignTransactionNamespace = U; exports.getAptosWallets = h; exports.isWalletWithRequiredFeatureSet = m; | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@aptos-labs/wallet-standard", | ||
"description": "Aptos wallet standard", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"license": "Apache-2.0", | ||
@@ -6,0 +6,0 @@ "homepage": "https://github.com/aptos-labs/wallet-standard", |
@@ -6,3 +6,4 @@ // Copyright © Aptos Foundation | ||
import { MinimallyRequiredFeatures, WalletWithAptosFeatures } from './features' | ||
import { MinimallyRequiredFeatures } from './features' | ||
import { AptosWallet } from './wallet' | ||
@@ -15,2 +16,3 @@ // These features are absolutely required for wallets to function in the Aptos ecosystem. | ||
'aptos:disconnect', | ||
'aptos:network', | ||
'aptos:onAccountChange', | ||
@@ -32,3 +34,3 @@ 'aptos:onNetworkChange', | ||
export function getAptosWallets(): WalletWithAptosFeatures[] { | ||
export function getAptosWallets(): AptosWallet[] { | ||
const { get } = getWallets() | ||
@@ -48,3 +50,3 @@ | ||
return aptosWallets as WalletWithAptosFeatures[] | ||
return aptosWallets as AptosWallet[] | ||
} |
@@ -44,4 +44,4 @@ // Copyright © Aptos Foundation | ||
prefix: 'APTOS' | ||
signature: Signature | ||
signature: Signature | Signature[] | ||
bitmap?: Uint8Array | ||
} |
@@ -21,14 +21,15 @@ // Copyright © Aptos Foundation | ||
*/ | ||
export type AptosFeatures = AptosSignAndSubmitTransactionFeature & | ||
AptosSignTransactionFeature & | ||
AptosSignMessageFeature & | ||
AptosConnectFeature & | ||
export type AptosFeatures = AptosConnectFeature & | ||
AptosGetAccountFeature & | ||
AptosGetNetworkFeature & | ||
AptosOnAccountChangeFeature & | ||
AptosOnNetworkChangeFeature & | ||
AptosGetNetworkFeature & | ||
AptosGetAccountFeature & | ||
AptosDisconnectFeature & | ||
AptosOpenInMobileAppFeature & | ||
AptosChangeNetworkFeature | ||
AptosSignAndSubmitTransactionFeature & | ||
AptosSignMessageFeature & | ||
AptosSignTransactionFeature & | ||
//AptosChangeNetworkFeature is optional | ||
Partial<AptosChangeNetworkFeature> & | ||
//AptosOpenInMobileAppFeature is optional | ||
Partial<AptosOpenInMobileAppFeature> & | ||
AptosDisconnectFeature | ||
/** | ||
@@ -47,6 +48,3 @@ * Represents a wallet with all Aptos features. | ||
*/ | ||
export type MinimallyRequiredFeatures = Omit< | ||
AptosFeatures, | ||
'aptos:openInMobileApp' | 'aptos:changeNetwork' | ||
> | ||
export type MinimallyRequiredFeatures = AptosFeatures | ||
@@ -53,0 +51,0 @@ export * from './aptosSignAndSubmitTransaction' |
@@ -6,2 +6,3 @@ // Copyright © Aptos Foundation | ||
export * from './account' | ||
export * from './adapter' | ||
@@ -8,0 +9,0 @@ export * from './chains' |
// Copyright © Aptos Foundation | ||
// SPDX-License-Identifier: Apache-2.0 | ||
import { Wallet } from '@wallet-standard/core' | ||
import { WalletWithAptosFeatures } from './features' | ||
export interface AptosWallet extends Wallet { | ||
export interface AptosWallet extends WalletWithAptosFeatures { | ||
/** | ||
@@ -8,0 +8,0 @@ * Website URL of the Wallet |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
90440
114
815