@pontem/wallet-adapter-plugin
Advanced tools
Comparing version 0.1.5 to 0.2.0
@@ -9,6 +9,6 @@ import { WalletName, AdapterPlugin, AccountInfo, SignMessagePayload, SignMessageResponse, NetworkName, PluginProvider, NetworkInfo } from '@aptos-labs/wallet-adapter-core'; | ||
}; | ||
type PonetmNetworkNames = keyof typeof PontemNetworkNameMapping; | ||
interface PontemPluginProvider extends Omit<PluginProvider, 'network' | 'onNetworkChange'> { | ||
type PontemNetworkNames = keyof typeof PontemNetworkNameMapping; | ||
interface PontemPluginProvider extends Omit<PluginProvider, "network" | "onNetworkChange"> { | ||
network: () => Promise<{ | ||
name: PonetmNetworkNames; | ||
name: PontemNetworkNames; | ||
chainId?: string; | ||
@@ -19,3 +19,3 @@ api?: string; | ||
networkName?: NetworkInfo; | ||
name?: PonetmNetworkNames; | ||
name?: PontemNetworkNames; | ||
chainId?: string; | ||
@@ -38,6 +38,9 @@ api?: string; | ||
provider: PontemPluginProvider | undefined; | ||
deeplinkProvider(data: { | ||
url: string; | ||
}): string; | ||
connect(): Promise<AccountInfo>; | ||
account(): Promise<AccountInfo>; | ||
disconnect(): Promise<void>; | ||
signAndSubmitTransaction(transaction: Types.TransactionPayload, options?: any): Promise<{ | ||
signAndSubmitTransaction(transaction: any, options?: any): Promise<{ | ||
hash: Types.HexEncodedBytes; | ||
@@ -44,0 +47,0 @@ }>; |
@@ -41,2 +41,5 @@ "use strict"; | ||
} | ||
deeplinkProvider(data) { | ||
return `pontem-wallet://link?url=${data.url}`; | ||
} | ||
async connect() { | ||
@@ -85,2 +88,5 @@ var _a; | ||
} | ||
if (response == null ? void 0 : response.code) { | ||
throw new Error(response == null ? void 0 : response.message); | ||
} | ||
const hash = response.result.hash; | ||
@@ -87,0 +93,0 @@ return { hash }; |
{ | ||
"name": "@pontem/wallet-adapter-plugin", | ||
"version": "0.1.5", | ||
"version": "0.2.0", | ||
"description": "Pontem plugin to use with Aptos Wallet Adapter", | ||
@@ -20,11 +20,11 @@ "author": "Pontem Network", | ||
"dependencies": { | ||
"@aptos-labs/wallet-adapter-core": "^0.1.7", | ||
"aptos": "^1.4.0" | ||
"@aptos-labs/wallet-adapter-core": "2.2.0", | ||
"aptos": "^1.9.1" | ||
}, | ||
"devDependencies": { | ||
"tsup": "^6.5.0", | ||
"typescript": "^4.9.3", | ||
"@types/jest": "^29.2.3", | ||
"jest": "^29.3.1", | ||
"ts-jest": "^29.0.3" | ||
"ts-jest": "^29.0.3", | ||
"tsup": "^6.5.0", | ||
"typescript": "^4.9.3" | ||
}, | ||
@@ -31,0 +31,0 @@ "repository": { |
@@ -9,4 +9,8 @@ import type { | ||
} from "@aptos-labs/wallet-adapter-core"; | ||
import {AptosWalletErrorResult, NetworkName, PluginProvider,} from "@aptos-labs/wallet-adapter-core"; | ||
import {Types} from "aptos"; | ||
import { | ||
AptosWalletErrorResult, | ||
NetworkName, | ||
PluginProvider, | ||
} from "@aptos-labs/wallet-adapter-core"; | ||
import { TxnBuilderTypes, Types } from "aptos"; | ||
@@ -23,11 +27,22 @@ interface PontemWindow extends Window { | ||
type PonetmNetworkNames = keyof typeof PontemNetworkNameMapping; | ||
type PontemNetworkNames = keyof typeof PontemNetworkNameMapping; | ||
interface PontemPluginProvider extends Omit<PluginProvider, 'network' | 'onNetworkChange'> { | ||
network: () => Promise<{ name: PonetmNetworkNames, chainId?: string, api?: string } | NetworkName>; | ||
onNetworkChange: (listener: ( | ||
newNetwork: { networkName?: NetworkInfo, name?: PonetmNetworkNames, chainId?: string; api?: string } | ||
) => Promise<void>) => Promise<void>; | ||
interface PontemPluginProvider | ||
extends Omit<PluginProvider, "network" | "onNetworkChange"> { | ||
network: () => Promise< | ||
{ name: PontemNetworkNames; chainId?: string; api?: string } | NetworkName | ||
>; | ||
onNetworkChange: ( | ||
listener: (newNetwork: { | ||
networkName?: NetworkInfo; | ||
name?: PontemNetworkNames; | ||
chainId?: string; | ||
api?: string; | ||
}) => Promise<void>, | ||
) => Promise<void>; | ||
publicKey?: () => Promise<string>; | ||
signAndSubmit?: (transaction: any, options?: any) => Promise<{success: boolean, result: {hash: string}}>; | ||
signAndSubmit?: ( | ||
transaction: any, | ||
options?: any, | ||
) => Promise<{ success: boolean; result: { hash: string } }>; | ||
} | ||
@@ -41,6 +56,5 @@ | ||
readonly name = PontemWalletName; | ||
readonly url = | ||
"https://onelink.to/t3sae5"; | ||
readonly url = "https://onelink.to/t3sae5"; | ||
readonly icon = | ||
"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzYiIGhlaWdodD0iMzYiIHZpZXdCb3g9IjAgMCAzNiAzNiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTE4IDBDOC4wNzMwNCAwIDAgOC4wNzEzOSAwIDE3Ljk5NjNDMCAyNS4xMjk4IDQuMTczMTYgMzEuMzEwOCAxMC4yMDc2IDM0LjIyMDNWMzQuMjM1MUgxMC4yMzcyQzEyLjU4NiAzNS4zNjQ5IDE1LjIyMjggMzYgMTggMzZDMjcuOTI3IDM2IDM2IDI3LjkyODYgMzYgMTguMDAzN0MzNiA4LjA3MTM4IDI3LjkyNyAwIDE4IDBaTTE4IDEuNDc2OTJDMjcuMTA3MSAxLjQ3NjkyIDM0LjUyMjggOC44OTEwOCAzNC41MjI4IDE3Ljk5NjNDMzQuNTIyOCAyMC42MTA1IDMzLjkwOTcgMjMuMDkxNyAzMi44MjQgMjUuMjkyM0MzMC40NDU2IDI0LjE0MDMgMjguMDMwNCAyMy4yODM3IDI1LjU5MjkgMjIuNzAwM1Y4LjkyMDYyQzI1LjU5MjkgOC40NDA2MiAyNS4yMTYyIDguMDU2NjIgMjQuNzQzNSA4LjA1NjYySDIxLjcxNTJIMTQuMDg1NEgxMS4wNTdDMTAuNTkxNyA4LjA1NjYyIDEwLjIwNzYgOC40NDA2MiAxMC4yMDc2IDguOTIwNjJWMjIuNzY2OEM3Ljg0NDA3IDIzLjM1MDIgNS40OTUyOCAy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jAuNDY2NyIgc3RvcC1jb2xvcj0iI0E5MkZBQyIvPgo8c3RvcCBvZmZzZXQ9IjAuNzQxMyIgc3RvcC1jb2xvcj0iI0NBMzc5MyIvPgo8c3RvcCBvZmZzZXQ9IjEiIHN0b3AtY29sb3I9IiNGMDNGNzciLz4KPC9saW5lYXJHcmFkaWVudD4KPC9kZWZzPgo8L3N2Zz4K"; | ||
@@ -50,2 +64,6 @@ provider: PontemPluginProvider | undefined = | ||
deeplinkProvider(data: { url: string }): string { | ||
return `pontem-wallet://link?url=${data.url}`; | ||
} | ||
async connect(): Promise<AccountInfo> { | ||
@@ -64,3 +82,3 @@ try { | ||
if (!response) throw `${PontemWalletName} Account Error`; | ||
let publicKey = ''; | ||
let publicKey = ""; | ||
if (this.provider?.publicKey) { | ||
@@ -81,3 +99,3 @@ publicKey = await this.provider?.publicKey(); | ||
async signAndSubmitTransaction( | ||
transaction: Types.TransactionPayload, | ||
transaction: any, | ||
options?: any | ||
@@ -97,2 +115,6 @@ ): Promise<{ hash: Types.HexEncodedBytes }> { | ||
} | ||
if ((response as unknown as AptosWalletErrorResult)?.code) { | ||
throw new Error((response as unknown as AptosWalletErrorResult)?.message); | ||
} | ||
const hash = response.result.hash; | ||
@@ -124,11 +146,15 @@ | ||
async network(): Promise<{ name: NetworkName, chainId?: string, api?: string } | NetworkName> { | ||
async network(): Promise< | ||
{ name: NetworkName; chainId?: string; api?: string } | NetworkName | ||
> { | ||
try { | ||
const response = await this.provider?.network(); | ||
if (!response) throw `${PontemWalletName} Network Error`; | ||
if (typeof response === 'object' && response?.name) { | ||
if (typeof response === "object" && response?.name) { | ||
return { | ||
name: PontemNetworkNameMapping[response.name], | ||
name: PontemNetworkNameMapping[ | ||
response.name as keyof typeof PontemNetworkNameMapping | ||
], | ||
chainId: response?.chainId ?? undefined, | ||
api: response?.api ?? undefined | ||
api: response?.api ?? undefined, | ||
}; | ||
@@ -144,5 +170,8 @@ } | ||
try { | ||
const handleNetworkChange = async ( | ||
newNetwork: { networkName?: NetworkInfo, name?: PonetmNetworkNames, chainId?: string; api?: string } | ||
): Promise<void> => { | ||
const handleNetworkChange = async (newNetwork: { | ||
networkName?: NetworkInfo; | ||
name?: PontemNetworkNames; | ||
chainId?: string; | ||
api?: string; | ||
}): Promise<void> => { | ||
if (newNetwork?.name) { | ||
@@ -173,3 +202,3 @@ callback({ | ||
const handleAccountChange = async ( | ||
newAccount: AccountInfo | ||
newAccount: AccountInfo, | ||
): Promise<void> => { | ||
@@ -176,0 +205,0 @@ if (newAccount?.publicKey) { |
@@ -17,5 +17,6 @@ { | ||
"skipLibCheck": true, | ||
"strict": true | ||
"strict": true, | ||
"lib": ["ES2015", "DOM"] | ||
}, | ||
"exclude": ["node_modules"] | ||
} |
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
33654
697
+ Added@aptos-labs/wallet-adapter-core@2.2.0(transitive)
+ Addedbase64-js@1.5.1(transitive)
+ Addedbuffer@6.0.3(transitive)
+ Addedieee754@1.2.1(transitive)
- Removed@aptos-labs/wallet-adapter-core@0.1.7(transitive)
Updatedaptos@^1.9.1