@mysten/zksend
Advanced tools
Comparing version 0.0.0-experimental-20240110025336 to 0.0.0-experimental-20240110033255
# @mysten/zksend | ||
## 0.0.0-experimental-20240110025336 | ||
## 0.0.0-experimental-20240110033255 | ||
@@ -11,2 +11,3 @@ ### Minor Changes | ||
- f041b10b9f: Allow origin to be set when registering zksend wallet" | ||
- c1f6cfff47: Fix import paths | ||
@@ -13,0 +14,0 @@ |
import type { Output } from 'valibot'; | ||
import type { ZkSendRequestTypes, ZkSendResponsePayload, ZkSendResponseTypes } from './events.js'; | ||
import { ZkSendRequest } from './events.js'; | ||
export declare const DEFAULT_ZKSEND_ORIGIN = "https://zksend.com"; | ||
interface ZkSendPopupOptions { | ||
@@ -5,0 +6,0 @@ origin?: string; |
@@ -39,2 +39,3 @@ "use strict"; | ||
__export(channel_exports, { | ||
DEFAULT_ZKSEND_ORIGIN: () => DEFAULT_ZKSEND_ORIGIN, | ||
ZkSendHost: () => ZkSendHost, | ||
@@ -41,0 +42,0 @@ ZkSendPopup: () => ZkSendPopup |
@@ -12,4 +12,10 @@ import { SuiClient } from '@mysten/sui.js/client'; | ||
get features(): StandardConnectFeature & StandardDisconnectFeature & StandardEventsFeature & SuiSignTransactionBlockFeature & SuiSignPersonalMessageFeature; | ||
constructor(suiClient: SuiClient, name: string); | ||
constructor({ client, name, origin, }: { | ||
client: SuiClient; | ||
origin?: string; | ||
name: string; | ||
}); | ||
} | ||
export declare function registerZkSendWallet(name: string): () => void; | ||
export declare function registerZkSendWallet(name: string, { origin, }: { | ||
origin?: string; | ||
}): () => void; |
@@ -63,6 +63,10 @@ "use strict"; | ||
var import_channel = require("./channel/index.js"); | ||
var _events, _accounts, _client, _name, _signTransactionBlock, _signPersonalMessage, _on, _setAccount, setAccount_fn, _connect, _disconnect; | ||
var _events, _accounts, _client, _origin, _name, _signTransactionBlock, _signPersonalMessage, _on, _setAccount, setAccount_fn, _connect, _disconnect; | ||
const ZKSEND_RECENT_ADDRESS_KEY = "zksend:recentAddress"; | ||
class ZkSendWallet { | ||
constructor(suiClient, name) { | ||
constructor({ | ||
client, | ||
name, | ||
origin = import_channel.DEFAULT_ZKSEND_ORIGIN | ||
}) { | ||
__privateAdd(this, _setAccount); | ||
@@ -72,2 +76,3 @@ __privateAdd(this, _events, void 0); | ||
__privateAdd(this, _client, void 0); | ||
__privateAdd(this, _origin, void 0); | ||
__privateAdd(this, _name, void 0); | ||
@@ -81,3 +86,3 @@ __privateAdd(this, _signTransactionBlock, async ({ transactionBlock, account }) => { | ||
); | ||
const popup = new import_channel.ZkSendPopup({ name: __privateGet(this, _name) }); | ||
const popup = new import_channel.ZkSendPopup({ name: __privateGet(this, _name), origin: __privateGet(this, _origin) }); | ||
const response = await popup.createRequest("sign-transaction-block", { | ||
@@ -94,3 +99,3 @@ bytes, | ||
const bytes = (0, import_utils.toB64)(import_bcs.bcs.vector(import_bcs.bcs.u8()).serialize(message).toBytes()); | ||
const popup = new import_channel.ZkSendPopup({ name: __privateGet(this, _name) }); | ||
const popup = new import_channel.ZkSendPopup({ name: __privateGet(this, _name), origin: __privateGet(this, _origin) }); | ||
const response = await popup.createRequest("sign-personal-message", { | ||
@@ -117,3 +122,3 @@ bytes, | ||
} | ||
const popup = new import_channel.ZkSendPopup({ name: __privateGet(this, _name) }); | ||
const popup = new import_channel.ZkSendPopup({ name: __privateGet(this, _name), origin: __privateGet(this, _origin) }); | ||
const response = await popup.createRequest("connect", {}); | ||
@@ -132,3 +137,4 @@ if (!("address" in response)) { | ||
__privateSet(this, _events, (0, import_mitt.default)()); | ||
__privateSet(this, _client, suiClient); | ||
__privateSet(this, _client, client); | ||
__privateSet(this, _origin, origin); | ||
__privateSet(this, _name, name); | ||
@@ -179,2 +185,3 @@ } | ||
_client = new WeakMap(); | ||
_origin = new WeakMap(); | ||
_name = new WeakMap(); | ||
@@ -204,7 +211,9 @@ _signTransactionBlock = new WeakMap(); | ||
_disconnect = new WeakMap(); | ||
function registerZkSendWallet(name) { | ||
function registerZkSendWallet(name, { | ||
origin | ||
}) { | ||
const wallets = (0, import_wallet_standard.getWallets)(); | ||
const client = new import_client.SuiClient({ url: (0, import_client.getFullnodeUrl)("mainnet") }); | ||
return wallets.register(new ZkSendWallet(client, name)); | ||
return wallets.register(new ZkSendWallet({ client, name, origin })); | ||
} | ||
//# sourceMappingURL=wallet.js.map |
import type { Output } from 'valibot'; | ||
import type { ZkSendRequestTypes, ZkSendResponsePayload, ZkSendResponseTypes } from './events.js'; | ||
import { ZkSendRequest } from './events.js'; | ||
export declare const DEFAULT_ZKSEND_ORIGIN = "https://zksend.com"; | ||
interface ZkSendPopupOptions { | ||
@@ -5,0 +6,0 @@ origin?: string; |
@@ -116,2 +116,3 @@ var __accessCheck = (obj, member, msg) => { | ||
export { | ||
DEFAULT_ZKSEND_ORIGIN, | ||
ZkSendHost, | ||
@@ -118,0 +119,0 @@ ZkSendPopup |
@@ -12,4 +12,10 @@ import { SuiClient } from '@mysten/sui.js/client'; | ||
get features(): StandardConnectFeature & StandardDisconnectFeature & StandardEventsFeature & SuiSignTransactionBlockFeature & SuiSignPersonalMessageFeature; | ||
constructor(suiClient: SuiClient, name: string); | ||
constructor({ client, name, origin, }: { | ||
client: SuiClient; | ||
origin?: string; | ||
name: string; | ||
}); | ||
} | ||
export declare function registerZkSendWallet(name: string): () => void; | ||
export declare function registerZkSendWallet(name: string, { origin, }: { | ||
origin?: string; | ||
}): () => void; |
@@ -23,3 +23,3 @@ var __accessCheck = (obj, member, msg) => { | ||
}; | ||
var _events, _accounts, _client, _name, _signTransactionBlock, _signPersonalMessage, _on, _setAccount, setAccount_fn, _connect, _disconnect; | ||
var _events, _accounts, _client, _origin, _name, _signTransactionBlock, _signPersonalMessage, _on, _setAccount, setAccount_fn, _connect, _disconnect; | ||
import { bcs } from "@mysten/sui.js/bcs"; | ||
@@ -30,6 +30,10 @@ import { getFullnodeUrl, SuiClient } from "@mysten/sui.js/client"; | ||
import mitt from "mitt"; | ||
import { ZkSendPopup } from "./channel/index.js"; | ||
import { DEFAULT_ZKSEND_ORIGIN, ZkSendPopup } from "./channel/index.js"; | ||
const ZKSEND_RECENT_ADDRESS_KEY = "zksend:recentAddress"; | ||
class ZkSendWallet { | ||
constructor(suiClient, name) { | ||
constructor({ | ||
client, | ||
name, | ||
origin = DEFAULT_ZKSEND_ORIGIN | ||
}) { | ||
__privateAdd(this, _setAccount); | ||
@@ -39,2 +43,3 @@ __privateAdd(this, _events, void 0); | ||
__privateAdd(this, _client, void 0); | ||
__privateAdd(this, _origin, void 0); | ||
__privateAdd(this, _name, void 0); | ||
@@ -48,3 +53,3 @@ __privateAdd(this, _signTransactionBlock, async ({ transactionBlock, account }) => { | ||
); | ||
const popup = new ZkSendPopup({ name: __privateGet(this, _name) }); | ||
const popup = new ZkSendPopup({ name: __privateGet(this, _name), origin: __privateGet(this, _origin) }); | ||
const response = await popup.createRequest("sign-transaction-block", { | ||
@@ -61,3 +66,3 @@ bytes, | ||
const bytes = toB64(bcs.vector(bcs.u8()).serialize(message).toBytes()); | ||
const popup = new ZkSendPopup({ name: __privateGet(this, _name) }); | ||
const popup = new ZkSendPopup({ name: __privateGet(this, _name), origin: __privateGet(this, _origin) }); | ||
const response = await popup.createRequest("sign-personal-message", { | ||
@@ -84,3 +89,3 @@ bytes, | ||
} | ||
const popup = new ZkSendPopup({ name: __privateGet(this, _name) }); | ||
const popup = new ZkSendPopup({ name: __privateGet(this, _name), origin: __privateGet(this, _origin) }); | ||
const response = await popup.createRequest("connect", {}); | ||
@@ -99,3 +104,4 @@ if (!("address" in response)) { | ||
__privateSet(this, _events, mitt()); | ||
__privateSet(this, _client, suiClient); | ||
__privateSet(this, _client, client); | ||
__privateSet(this, _origin, origin); | ||
__privateSet(this, _name, name); | ||
@@ -146,2 +152,3 @@ } | ||
_client = new WeakMap(); | ||
_origin = new WeakMap(); | ||
_name = new WeakMap(); | ||
@@ -171,6 +178,8 @@ _signTransactionBlock = new WeakMap(); | ||
_disconnect = new WeakMap(); | ||
function registerZkSendWallet(name) { | ||
function registerZkSendWallet(name, { | ||
origin | ||
}) { | ||
const wallets = getWallets(); | ||
const client = new SuiClient({ url: getFullnodeUrl("mainnet") }); | ||
return wallets.register(new ZkSendWallet(client, name)); | ||
return wallets.register(new ZkSendWallet({ client, name, origin })); | ||
} | ||
@@ -177,0 +186,0 @@ export { |
{ | ||
"name": "@mysten/zksend", | ||
"version": "0.0.0-experimental-20240110025336", | ||
"version": "0.0.0-experimental-20240110033255", | ||
"description": "TODO: Write Description", | ||
@@ -5,0 +5,0 @@ "license": "Apache-2.0", |
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
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
265231
2049