Comparing version 1.10.7 to 1.10.8
@@ -25,4 +25,5 @@ import Api from "./lib/api"; | ||
generate(): Promise<JWKInterface>; | ||
jwkToAddress(jwk: JWKInterface): Promise<string>; | ||
jwkToAddress(jwk?: JWKInterface | "use_wallet"): Promise<string>; | ||
getAddress(jwk?: JWKInterface | "use_wallet"): Promise<string>; | ||
ownerToAddress(owner: string): Promise<string>; | ||
} |
@@ -71,4 +71,25 @@ "use strict"; | ||
async jwkToAddress(jwk) { | ||
return this.ownerToAddress(jwk.n); | ||
if (!jwk || jwk === "use_wallet") { | ||
return this.getAddress(); | ||
} | ||
else { | ||
return this.getAddress(jwk); | ||
} | ||
} | ||
async getAddress(jwk) { | ||
if (!jwk || jwk === "use_wallet") { | ||
try { | ||
// @ts-ignore | ||
await window.weavemask.connect(["ACCESS_ADDRESS"]); | ||
} | ||
catch (_a) { | ||
// Permission is already granted | ||
} | ||
// @ts-ignore | ||
return window.weavemask.getActiveAddress(); | ||
} | ||
else { | ||
return this.ownerToAddress(jwk.n); | ||
} | ||
} | ||
async ownerToAddress(owner) { | ||
@@ -75,0 +96,0 @@ return ArweaveUtils.bufferTob64Url(await this.crypto.hash(ArweaveUtils.b64UrlToBuffer(owner))); |
{ | ||
"name": "arweave", | ||
"version": "1.10.7", | ||
"version": "1.10.8", | ||
"description": "Arweave JS client library", | ||
@@ -5,0 +5,0 @@ "main": "./node/index.js", |
@@ -25,4 +25,5 @@ import Api from "./lib/api"; | ||
generate(): Promise<JWKInterface>; | ||
jwkToAddress(jwk: JWKInterface): Promise<string>; | ||
jwkToAddress(jwk?: JWKInterface | "use_wallet"): Promise<string>; | ||
getAddress(jwk?: JWKInterface | "use_wallet"): Promise<string>; | ||
ownerToAddress(owner: string): Promise<string>; | ||
} |
@@ -52,4 +52,25 @@ "use strict"; | ||
async jwkToAddress(jwk) { | ||
return this.ownerToAddress(jwk.n); | ||
if (!jwk || jwk === "use_wallet") { | ||
return this.getAddress(); | ||
} | ||
else { | ||
return this.getAddress(jwk); | ||
} | ||
} | ||
async getAddress(jwk) { | ||
if (!jwk || jwk === "use_wallet") { | ||
try { | ||
// @ts-ignore | ||
await window.weavemask.connect(["ACCESS_ADDRESS"]); | ||
} | ||
catch (_a) { | ||
// Permission is already granted | ||
} | ||
// @ts-ignore | ||
return window.weavemask.getActiveAddress(); | ||
} | ||
else { | ||
return this.ownerToAddress(jwk.n); | ||
} | ||
} | ||
async ownerToAddress(owner) { | ||
@@ -56,0 +77,0 @@ return ArweaveUtils.bufferTob64Url(await this.crypto.hash(ArweaveUtils.b64UrlToBuffer(owner))); |
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
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
1225694
13369