@mysten/wallet-standard 0.1.2 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,28 @@
1
1
  # @mysten/wallet-standard
2
2
 
3
+ ## 0.2.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [01989d3d5]
8
+ - Updated dependencies [5e20e6569]
9
+ - @mysten/sui.js@0.16.0
10
+
11
+ ## 0.2.0
12
+
13
+ ### Minor Changes
14
+
15
+ - e97d280d7: Update to 1.0 release of wallet standard
16
+ - 56de8448f: Update wallet standard adapters to use new wallet registration logic.
17
+
18
+ ### Patch Changes
19
+
20
+ - Updated dependencies [c27933292]
21
+ - Updated dependencies [90898d366]
22
+ - Updated dependencies [c27933292]
23
+ - Updated dependencies [c27933292]
24
+ - @mysten/sui.js@0.15.0
25
+
3
26
  ## 0.1.2
4
27
 
5
28
  ### Patch Changes
package/README.md CHANGED
@@ -72,13 +72,13 @@ class YourWallet implements Wallet {
72
72
  // Your wallet's events on implementation.
73
73
  };
74
74
 
75
- #connect: ConnectMethod = () => {
76
- // Your wallet's connect implementation
77
- };
75
+ #connect: ConnectMethod = () => {
76
+ // Your wallet's connect implementation
77
+ };
78
78
 
79
- #signAndExecuteTransaction: SuiSignAndExecuteTransactionMethod = () => {
80
- // Your wallet's signAndExecuteTransaction implementation
81
- };
79
+ #signAndExecuteTransaction: SuiSignAndExecuteTransactionMethod = () => {
80
+ // Your wallet's signAndExecuteTransaction implementation
81
+ };
82
82
  }
83
83
  ```
84
84
 
@@ -104,7 +104,7 @@ class YourWallet implements Wallet {
104
104
  chains: [SUI_DEVNET_CHAIN],
105
105
  // The features that this account supports. This can be a subset of the wallet's supported features.
106
106
  // These features must exist on the wallet as well.
107
- features: ["sui:signAndExecuteTransaction", "standard:signMessage"],
107
+ features: ["sui:signAndExecuteTransaction"],
108
108
  })
109
109
  );
110
110
  }
@@ -113,15 +113,12 @@ class YourWallet implements Wallet {
113
113
 
114
114
  ### Registering in the window
115
115
 
116
- Once you have a compatible interface for your wallet, you can register it in the window under the `window.navigator.wallets` interface. Wallets self-register by pushing their standard wallet interface to this array-like interface.
116
+ Once you have a compatible interface for your wallet, you can register it using the `registerWallet` function.
117
117
 
118
118
  ```typescript
119
- // This makes TypeScript aware of the `window.navigator.wallets` interface.
120
- declare const window: import("@mysten/wallet-standard").WalletsWindow;
119
+ import { registerWallet } from '@mysten/wallet-standard';
121
120
 
122
- (window.navigator.wallets || []).push(({ register }) => {
123
- register(new YourWallet());
124
- });
121
+ registerWallet(new YourWallet());
125
122
  ```
126
123
 
127
- > Note that while this interface is array-like, it is not always an array, and the only method that should be called on it is `push`.
124
+ > If you're interested in the internal implementation of the `registerWallet` method, you can [see how it works here](https://github.com/wallet-standard/wallet-standard/blob/b4794e761de688906827829d5380b24cb8ed5fd5/packages/core/wallet/src/register.ts#L9).
package/dist/detect.d.ts CHANGED
@@ -1,5 +1,4 @@
1
- import { ConnectFeature, DisconnectFeature, EventsFeature } from "@wallet-standard/features";
2
- import { Wallet, WalletWithFeatures } from "@wallet-standard/standard";
1
+ import { ConnectFeature, DisconnectFeature, EventsFeature, Wallet, WalletWithFeatures } from "@wallet-standard/core";
3
2
  import { SuiSignAndExecuteTransactionFeature } from "./features";
4
3
  export declare type StandardWalletAdapterWallet = WalletWithFeatures<ConnectFeature & EventsFeature & SuiSignAndExecuteTransactionFeature & Partial<DisconnectFeature>>;
5
4
  export declare function isStandardWalletAdapterCompatibleWallet(wallet: Wallet): wallet is StandardWalletAdapterWallet;
@@ -1,4 +1,4 @@
1
- import type { WalletWithFeatures } from "@wallet-standard/standard";
1
+ import type { WalletWithFeatures } from "@wallet-standard/core";
2
2
  import type { SuiSignAndExecuteTransactionFeature } from "./suiSignAndExecuteTransaction";
3
3
  /**
4
4
  * Wallet Standard features that are unique to Sui, and that all Sui wallets are expected to implement.
@@ -1,5 +1,4 @@
1
1
  import type { SignableTransaction, SuiTransactionResponse } from "@mysten/sui.js";
2
- import type { SignAndSendTransactionInput } from "@wallet-standard/features";
3
2
  /** The latest API version of the signAndExecuteTransaction API. */
4
3
  export declare type SuiSignAndExecuteTransactionVersion = "1.0.0";
5
4
  /**
@@ -17,9 +16,9 @@ export declare type SuiSignAndExecuteTransactionFeature = {
17
16
  };
18
17
  export declare type SuiSignAndExecuteTransactionMethod = (input: SuiSignAndExecuteTransactionInput) => Promise<SuiSignAndExecuteTransactionOutput>;
19
18
  /** Input for signing and sending transactions. */
20
- export interface SuiSignAndExecuteTransactionInput extends Omit<SignAndSendTransactionInput, "transaction" | "chain" | "account"> {
21
- options?: SuiSignAndExecuteTransactionOptions;
19
+ export interface SuiSignAndExecuteTransactionInput {
22
20
  transaction: SignableTransaction;
21
+ options?: SuiSignAndExecuteTransactionOptions;
23
22
  }
24
23
  /** Output of signing and sending transactions. */
25
24
  export interface SuiSignAndExecuteTransactionOutput extends SuiTransactionResponse {
package/dist/index.d.ts CHANGED
@@ -1,6 +1,4 @@
1
- export * from '@wallet-standard/standard';
2
- export * from '@wallet-standard/features';
3
- export * from '@wallet-standard/util';
1
+ export * from '@wallet-standard/core';
4
2
  export * from "./features";
5
3
  export * from "./detect";
6
4
  export * from './chains';
package/dist/index.js CHANGED
@@ -28,9 +28,7 @@ __export(src_exports, {
28
28
  isStandardWalletAdapterCompatibleWallet: () => isStandardWalletAdapterCompatibleWallet
29
29
  });
30
30
  module.exports = __toCommonJS(src_exports);
31
- __reExport(src_exports, require("@wallet-standard/standard"), module.exports);
32
- __reExport(src_exports, require("@wallet-standard/features"), module.exports);
33
- __reExport(src_exports, require("@wallet-standard/util"), module.exports);
31
+ __reExport(src_exports, require("@wallet-standard/core"), module.exports);
34
32
 
35
33
  // src/detect.ts
36
34
  function isStandardWalletAdapterCompatibleWallet(wallet) {
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts","../src/detect.ts","../src/chains.ts"],"sourcesContent":["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nexport * from '@wallet-standard/standard';\nexport * from '@wallet-standard/features';\nexport * from '@wallet-standard/util';\n\nexport * from \"./features\";\nexport * from \"./detect\";\nexport * from './chains';\n","// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport {\n ConnectFeature,\n DisconnectFeature,\n EventsFeature,\n} from \"@wallet-standard/features\";\nimport { Wallet, WalletWithFeatures } from \"@wallet-standard/standard\";\nimport { SuiSignAndExecuteTransactionFeature } from \"./features\";\n\nexport type StandardWalletAdapterWallet = WalletWithFeatures<\n ConnectFeature &\n EventsFeature &\n SuiSignAndExecuteTransactionFeature &\n // Disconnect is an optional feature:\n Partial<DisconnectFeature>\n>;\n\nexport function isStandardWalletAdapterCompatibleWallet(\n wallet: Wallet\n): wallet is StandardWalletAdapterWallet {\n return (\n \"standard:connect\" in wallet.features &&\n \"standard:events\" in wallet.features &&\n \"sui:signAndExecuteTransaction\" in wallet.features\n );\n}\n","// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\n/** Sui Devnet */\nexport const SUI_DEVNET_CHAIN = \"sui:devnet\";\n\n/** Sui Testnet */\nexport const SUI_TESTNET_CHAIN = \"sui:testnet\";\n\n/** Sui Localnet */\nexport const SUI_LOCALNET_CHAIN = \"sui:localnet\";\n\nexport const SUI_CHAINS = [\n SUI_DEVNET_CHAIN,\n SUI_TESTNET_CHAIN,\n SUI_LOCALNET_CHAIN,\n] as const;\n\nexport type SuiChain =\n | typeof SUI_DEVNET_CHAIN\n | typeof SUI_TESTNET_CHAIN\n | typeof SUI_LOCALNET_CHAIN;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,wBAAc,sCAHd;AAIA,wBAAc,sCAJd;AAKA,wBAAc,kCALd;;;ACmBO,SAAS,wCACd,QACuC;AACvC,SACE,sBAAsB,OAAO,YAC7B,qBAAqB,OAAO,YAC5B,mCAAmC,OAAO;AAE9C;;;ACvBO,IAAM,mBAAmB;AAGzB,IAAM,oBAAoB;AAG1B,IAAM,qBAAqB;AAE3B,IAAM,aAAa;AAAA,EACxB;AAAA,EACA;AAAA,EACA;AACF;","names":[]}
1
+ {"version":3,"sources":["../src/index.ts","../src/detect.ts","../src/chains.ts"],"sourcesContent":["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nexport * from '@wallet-standard/core';\n\nexport * from \"./features\";\nexport * from \"./detect\";\nexport * from './chains';\n","// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport {\n ConnectFeature,\n DisconnectFeature,\n EventsFeature,\n Wallet,\n WalletWithFeatures,\n} from \"@wallet-standard/core\";\nimport { SuiSignAndExecuteTransactionFeature } from \"./features\";\n\nexport type StandardWalletAdapterWallet = WalletWithFeatures<\n ConnectFeature &\n EventsFeature &\n SuiSignAndExecuteTransactionFeature &\n // Disconnect is an optional feature:\n Partial<DisconnectFeature>\n>;\n\nexport function isStandardWalletAdapterCompatibleWallet(\n wallet: Wallet\n): wallet is StandardWalletAdapterWallet {\n return (\n \"standard:connect\" in wallet.features &&\n \"standard:events\" in wallet.features &&\n \"sui:signAndExecuteTransaction\" in wallet.features\n );\n}\n","// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\n/** Sui Devnet */\nexport const SUI_DEVNET_CHAIN = \"sui:devnet\";\n\n/** Sui Testnet */\nexport const SUI_TESTNET_CHAIN = \"sui:testnet\";\n\n/** Sui Localnet */\nexport const SUI_LOCALNET_CHAIN = \"sui:localnet\";\n\nexport const SUI_CHAINS = [\n SUI_DEVNET_CHAIN,\n SUI_TESTNET_CHAIN,\n SUI_LOCALNET_CHAIN,\n] as const;\n\nexport type SuiChain =\n | typeof SUI_DEVNET_CHAIN\n | typeof SUI_TESTNET_CHAIN\n | typeof SUI_LOCALNET_CHAIN;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,wBAAc,kCAHd;;;ACoBO,SAAS,wCACd,QACuC;AACvC,SACE,sBAAsB,OAAO,YAC7B,qBAAqB,OAAO,YAC5B,mCAAmC,OAAO;AAE9C;;;ACxBO,IAAM,mBAAmB;AAGzB,IAAM,oBAAoB;AAG1B,IAAM,qBAAqB;AAE3B,IAAM,aAAa;AAAA,EACxB;AAAA,EACA;AAAA,EACA;AACF;","names":[]}
package/dist/index.mjs CHANGED
@@ -1,7 +1,5 @@
1
1
  // src/index.ts
2
- export * from "@wallet-standard/standard";
3
- export * from "@wallet-standard/features";
4
- export * from "@wallet-standard/util";
2
+ export * from "@wallet-standard/core";
5
3
 
6
4
  // src/detect.ts
7
5
  function isStandardWalletAdapterCompatibleWallet(wallet) {
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts","../src/detect.ts","../src/chains.ts"],"sourcesContent":["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nexport * from '@wallet-standard/standard';\nexport * from '@wallet-standard/features';\nexport * from '@wallet-standard/util';\n\nexport * from \"./features\";\nexport * from \"./detect\";\nexport * from './chains';\n","// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport {\n ConnectFeature,\n DisconnectFeature,\n EventsFeature,\n} from \"@wallet-standard/features\";\nimport { Wallet, WalletWithFeatures } from \"@wallet-standard/standard\";\nimport { SuiSignAndExecuteTransactionFeature } from \"./features\";\n\nexport type StandardWalletAdapterWallet = WalletWithFeatures<\n ConnectFeature &\n EventsFeature &\n SuiSignAndExecuteTransactionFeature &\n // Disconnect is an optional feature:\n Partial<DisconnectFeature>\n>;\n\nexport function isStandardWalletAdapterCompatibleWallet(\n wallet: Wallet\n): wallet is StandardWalletAdapterWallet {\n return (\n \"standard:connect\" in wallet.features &&\n \"standard:events\" in wallet.features &&\n \"sui:signAndExecuteTransaction\" in wallet.features\n );\n}\n","// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\n/** Sui Devnet */\nexport const SUI_DEVNET_CHAIN = \"sui:devnet\";\n\n/** Sui Testnet */\nexport const SUI_TESTNET_CHAIN = \"sui:testnet\";\n\n/** Sui Localnet */\nexport const SUI_LOCALNET_CHAIN = \"sui:localnet\";\n\nexport const SUI_CHAINS = [\n SUI_DEVNET_CHAIN,\n SUI_TESTNET_CHAIN,\n SUI_LOCALNET_CHAIN,\n] as const;\n\nexport type SuiChain =\n | typeof SUI_DEVNET_CHAIN\n | typeof SUI_TESTNET_CHAIN\n | typeof SUI_LOCALNET_CHAIN;\n"],"mappings":";AAGA,cAAc;AACd,cAAc;AACd,cAAc;;;ACcP,SAAS,wCACd,QACuC;AACvC,SACE,sBAAsB,OAAO,YAC7B,qBAAqB,OAAO,YAC5B,mCAAmC,OAAO;AAE9C;;;ACvBO,IAAM,mBAAmB;AAGzB,IAAM,oBAAoB;AAG1B,IAAM,qBAAqB;AAE3B,IAAM,aAAa;AAAA,EACxB;AAAA,EACA;AAAA,EACA;AACF;","names":[]}
1
+ {"version":3,"sources":["../src/index.ts","../src/detect.ts","../src/chains.ts"],"sourcesContent":["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nexport * from '@wallet-standard/core';\n\nexport * from \"./features\";\nexport * from \"./detect\";\nexport * from './chains';\n","// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport {\n ConnectFeature,\n DisconnectFeature,\n EventsFeature,\n Wallet,\n WalletWithFeatures,\n} from \"@wallet-standard/core\";\nimport { SuiSignAndExecuteTransactionFeature } from \"./features\";\n\nexport type StandardWalletAdapterWallet = WalletWithFeatures<\n ConnectFeature &\n EventsFeature &\n SuiSignAndExecuteTransactionFeature &\n // Disconnect is an optional feature:\n Partial<DisconnectFeature>\n>;\n\nexport function isStandardWalletAdapterCompatibleWallet(\n wallet: Wallet\n): wallet is StandardWalletAdapterWallet {\n return (\n \"standard:connect\" in wallet.features &&\n \"standard:events\" in wallet.features &&\n \"sui:signAndExecuteTransaction\" in wallet.features\n );\n}\n","// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\n/** Sui Devnet */\nexport const SUI_DEVNET_CHAIN = \"sui:devnet\";\n\n/** Sui Testnet */\nexport const SUI_TESTNET_CHAIN = \"sui:testnet\";\n\n/** Sui Localnet */\nexport const SUI_LOCALNET_CHAIN = \"sui:localnet\";\n\nexport const SUI_CHAINS = [\n SUI_DEVNET_CHAIN,\n SUI_TESTNET_CHAIN,\n SUI_LOCALNET_CHAIN,\n] as const;\n\nexport type SuiChain =\n | typeof SUI_DEVNET_CHAIN\n | typeof SUI_TESTNET_CHAIN\n | typeof SUI_LOCALNET_CHAIN;\n"],"mappings":";AAGA,cAAc;;;ACiBP,SAAS,wCACd,QACuC;AACvC,SACE,sBAAsB,OAAO,YAC7B,qBAAqB,OAAO,YAC5B,mCAAmC,OAAO;AAE9C;;;ACxBO,IAAM,mBAAmB;AAGzB,IAAM,oBAAoB;AAG1B,IAAM,qBAAqB;AAE3B,IAAM,aAAa;AAAA,EACxB;AAAA,EACA;AAAA,EACA;AACF;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mysten/wallet-standard",
3
- "version": "0.1.2",
3
+ "version": "0.2.1",
4
4
  "description": "A suite of standard utilities for implementing wallets based on the Wallet Standard.",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Mysten Labs <build@mystenlabs.com>",
@@ -19,10 +19,8 @@
19
19
  "CHANGELOG.md"
20
20
  ],
21
21
  "dependencies": {
22
- "@mysten/sui.js": "0.14.0",
23
- "@wallet-standard/features": "0.1.0-alpha.4",
24
- "@wallet-standard/standard": "0.1.0-alpha.5",
25
- "@wallet-standard/util": "0.1.0-alpha.6"
22
+ "@mysten/sui.js": "0.16.0",
23
+ "@wallet-standard/core": "1.0.0"
26
24
  },
27
25
  "devDependencies": {
28
26
  "tsup": "^6.2.2",
package/src/detect.ts CHANGED
@@ -5,8 +5,9 @@ import {
5
5
  ConnectFeature,
6
6
  DisconnectFeature,
7
7
  EventsFeature,
8
- } from "@wallet-standard/features";
9
- import { Wallet, WalletWithFeatures } from "@wallet-standard/standard";
8
+ Wallet,
9
+ WalletWithFeatures,
10
+ } from "@wallet-standard/core";
10
11
  import { SuiSignAndExecuteTransactionFeature } from "./features";
11
12
 
12
13
  export type StandardWalletAdapterWallet = WalletWithFeatures<
@@ -1,7 +1,7 @@
1
1
  // Copyright (c) Mysten Labs, Inc.
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
 
4
- import type { WalletWithFeatures } from "@wallet-standard/standard";
4
+ import type { WalletWithFeatures } from "@wallet-standard/core";
5
5
  import type { SuiSignAndExecuteTransactionFeature } from "./suiSignAndExecuteTransaction";
6
6
 
7
7
  /**
@@ -5,7 +5,6 @@ import type {
5
5
  SignableTransaction,
6
6
  SuiTransactionResponse,
7
7
  } from "@mysten/sui.js";
8
- import type { SignAndSendTransactionInput } from "@wallet-standard/features";
9
8
 
10
9
  /** The latest API version of the signAndExecuteTransaction API. */
11
10
  export type SuiSignAndExecuteTransactionVersion = "1.0.0";
@@ -29,15 +28,9 @@ export type SuiSignAndExecuteTransactionMethod = (
29
28
  ) => Promise<SuiSignAndExecuteTransactionOutput>;
30
29
 
31
30
  /** Input for signing and sending transactions. */
32
- export interface SuiSignAndExecuteTransactionInput
33
- extends Omit<
34
- SignAndSendTransactionInput,
35
- // TODO: Right now, we don't have intent signing, but eventually we'll need to re-introduce
36
- // the concept of chains + account during the signing here.
37
- "transaction" | "chain" | "account"
38
- > {
39
- options?: SuiSignAndExecuteTransactionOptions;
31
+ export interface SuiSignAndExecuteTransactionInput {
40
32
  transaction: SignableTransaction;
33
+ options?: SuiSignAndExecuteTransactionOptions;
41
34
  }
42
35
 
43
36
  /** Output of signing and sending transactions. */
package/src/index.ts CHANGED
@@ -1,9 +1,7 @@
1
1
  // Copyright (c) Mysten Labs, Inc.
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
 
4
- export * from '@wallet-standard/standard';
5
- export * from '@wallet-standard/features';
6
- export * from '@wallet-standard/util';
4
+ export * from '@wallet-standard/core';
7
5
 
8
6
  export * from "./features";
9
7
  export * from "./detect";