From 8f5b7bf474277247670d506d1f2fcfa4f4a1cb9c Mon Sep 17 00:00:00 2001 From: marc2332 Date: Wed, 27 Nov 2024 09:05:56 +0100 Subject: [PATCH 1/5] docs(ts-sdk): Update outdated TS SDK Docs --- dapps/kiosk-cli/index.js | 4 ++-- dapps/kiosk/src/context/KioskClientContext.tsx | 5 +++-- .../developer/standards/wallet-standard.mdx | 6 +++--- .../ts-sdk/kiosk/advanced-examples.mdx | 2 +- .../ts-sdk/kiosk/kiosk-client/introduction.mdx | 17 ++++++----------- .../kiosk-transaction/purchasing.mdx | 5 ++--- 6 files changed, 17 insertions(+), 22 deletions(-) diff --git a/dapps/kiosk-cli/index.js b/dapps/kiosk-cli/index.js index a54976a9a9a..aff1f965b12 100644 --- a/dapps/kiosk-cli/index.js +++ b/dapps/kiosk-cli/index.js @@ -34,7 +34,7 @@ import { } from '@iota/iota-sdk/utils'; import { bcs } from '@iota/iota-sdk/bcs'; import { program } from 'commander'; -import { KIOSK_LISTING, KioskClient, KioskTransaction, Network } from '@iota/kiosk'; +import { KIOSK_LISTING, KioskClient, KioskTransaction } from '@iota/kiosk'; import { IotaClient, getFullnodeUrl } from '@iota/iota-sdk/client'; import { Ed25519Keypair } from '@iota/iota-sdk/keypairs/ed25519'; import { Transaction } from '@iota/iota-sdk/transactions'; @@ -49,7 +49,7 @@ const client = new IotaClient({ url: getFullnodeUrl('testnet') }); const kioskClient = new KioskClient({ client, - network: Network.TESTNET, + network: 'testnet', }); /** diff --git a/dapps/kiosk/src/context/KioskClientContext.tsx b/dapps/kiosk/src/context/KioskClientContext.tsx index e193465a553..1aa6339edfd 100644 --- a/dapps/kiosk/src/context/KioskClientContext.tsx +++ b/dapps/kiosk/src/context/KioskClientContext.tsx @@ -3,7 +3,8 @@ // SPDX-License-Identifier: Apache-2.0 import { useIotaClient, useIotaClientContext } from '@iota/dapp-kit'; -import { KioskClient, Network } from '@iota/kiosk'; +import { NetworkId } from '@iota/iota-sdk/client'; +import { KioskClient } from '@iota/kiosk'; import { createContext, ReactNode, useContext, useMemo } from 'react'; export const KioskClientContext = createContext(undefined); @@ -15,7 +16,7 @@ export function KioskClientProvider({ children }: { children: ReactNode }) { () => new KioskClient({ client: iotaClient, - network: network as Network, + network: network as NetworkId, }), [iotaClient, network], ); diff --git a/docs/content/developer/standards/wallet-standard.mdx b/docs/content/developer/standards/wallet-standard.mdx index 8cc9142dde4..4a529531af1 100644 --- a/docs/content/developer/standards/wallet-standard.mdx +++ b/docs/content/developer/standards/wallet-standard.mdx @@ -20,7 +20,7 @@ Create a class that represents your wallet. Use the `Wallet` interface from `@iota/wallet-standard` to help ensure your class adheres to the standard. ```tsx -import { IOTA_DEVNET_CHAIN, Wallet } from '@iota/wallet-standard'; +import { SUPPORTED_CHAINS, Wallet } from '@iota/wallet-standard'; class YourWallet implements Wallet { get version() { @@ -35,7 +35,7 @@ class YourWallet implements Wallet { } // Return the IOTA chains that your wallet supports. get chains() { - return [IOTA_DEVNET_CHAIN]; + return SUPPORTED_CHAINS; } } ``` @@ -152,7 +152,7 @@ class YourWallet implements Wallet { address: walletAccount.iotaAddress, publicKey: walletAccount.pubkey, // The IOTA chains that your wallet supports. - chains: [IOTA_DEVNET_CHAIN], + chains: [SUPPORTED_CHAINS], // The features that this account supports. This can be a subset of the wallet's supported features. // These features must exist on the wallet as well. features: [ diff --git a/docs/content/references/ts-sdk/kiosk/advanced-examples.mdx b/docs/content/references/ts-sdk/kiosk/advanced-examples.mdx index 181ec1ed41d..b0e3fef6c06 100644 --- a/docs/content/references/ts-sdk/kiosk/advanced-examples.mdx +++ b/docs/content/references/ts-sdk/kiosk/advanced-examples.mdx @@ -14,7 +14,7 @@ const kioskClient = new KioskClient({ client: new IotaClient({ url: getFullnodeUrl('testnet'), }), - network: Network.TESTNET, + network: 'testnet', }); ``` diff --git a/docs/content/references/ts-sdk/kiosk/kiosk-client/introduction.mdx b/docs/content/references/ts-sdk/kiosk/kiosk-client/introduction.mdx index 73bea1b8fce..e28adcb0c4f 100644 --- a/docs/content/references/ts-sdk/kiosk/kiosk-client/introduction.mdx +++ b/docs/content/references/ts-sdk/kiosk/kiosk-client/introduction.mdx @@ -7,15 +7,10 @@ Kiosk Client is the base for all Kiosk SDK functionality. ## Creating a kiosk client -You can follow the example to create a `KioskClient`. The client currently supports `MAINNET` and -`TESTNET`. View next section for usage in other networks. - -_IOTA Kiosk rules and extensions are not supported in Devnet due to network wipes (that would -require constantly changing the package IDs)._ - +You can follow the example to create a `KioskClient`. View next section for usage in custom networks. ```typescript -import { KioskClient, Network } from '@iota/kiosk'; +import { KioskClient } from '@iota/kiosk'; import { getFullnodeUrl, IotaClient } from '@iota/iota-sdk/client'; // We need a IOTA Client. You can re-use the IotaClient of your project @@ -25,20 +20,20 @@ const client = new IotaClient({ url: getFullnodeUrl('testnet') }); // Now we can use it to create a kiosk Client. const kioskClient = new KioskClient({ client, - network: Network.TESTNET, + network: 'testnet, }); ``` -### Using KioskClient on devnet or localnet +### Using KioskClient on custom networks -To use all the functionality of Kiosk SDK outside of `MAINNET` and `TESTNET`, use `Network.CUSTOM` +To use all the functionality of Kiosk SDK outside of official networks, use `custom` as the network, and pass the `packageIds` for the rules and extensions you want to use. ```typescript // constructing it for custom network use. const kioskClient = new KioskClient({ client, - network: Network.CUSTOM, + network: 'custom', packageIds: { kioskLockRulePackageId: '0x...', royaltyRulePackageId: '0x...', diff --git a/docs/content/references/ts-sdk/kiosk/kiosk-client/kiosk-transaction/purchasing.mdx b/docs/content/references/ts-sdk/kiosk/kiosk-client/kiosk-transaction/purchasing.mdx index 0e2492241ce..771150f2592 100644 --- a/docs/content/references/ts-sdk/kiosk/kiosk-client/kiosk-transaction/purchasing.mdx +++ b/docs/content/references/ts-sdk/kiosk/kiosk-client/kiosk-transaction/purchasing.mdx @@ -1,9 +1,8 @@ # Purchasing from a kiosk One of the base functionalities of the SDK is a seamless purchasing flow, allowing for ease of rules -resolving (hiding away the calls). The SDK supports all four rules by default, and works for -`TESTNET` and `MAINNET`. To support other networks, -[follow the instructions in the Introduction](../introduction#using-kioskclient-on-devnet-or-localnet). +resolving (hiding away the calls). To use custom networks, +[follow the instructions in the Introduction](../introduction#using-kioskclient-on-custom-networks). ## How to purchase From f5be9b2cb852410b6b70150acd120b1d7e2d183e Mon Sep 17 00:00:00 2001 From: marc2332 Date: Wed, 27 Nov 2024 09:14:41 +0100 Subject: [PATCH 2/5] ' --- .../references/ts-sdk/kiosk/kiosk-client/introduction.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/content/references/ts-sdk/kiosk/kiosk-client/introduction.mdx b/docs/content/references/ts-sdk/kiosk/kiosk-client/introduction.mdx index e28adcb0c4f..0e6e68fa800 100644 --- a/docs/content/references/ts-sdk/kiosk/kiosk-client/introduction.mdx +++ b/docs/content/references/ts-sdk/kiosk/kiosk-client/introduction.mdx @@ -20,7 +20,7 @@ const client = new IotaClient({ url: getFullnodeUrl('testnet') }); // Now we can use it to create a kiosk Client. const kioskClient = new KioskClient({ client, - network: 'testnet, + network: 'testnet', }); ``` From 750ef68847d63046e96db43d1645d3ab6d41b230 Mon Sep 17 00:00:00 2001 From: marc2332 Date: Wed, 27 Nov 2024 10:23:36 +0100 Subject: [PATCH 3/5] use Network enum --- docs/content/references/ts-sdk/kiosk/advanced-examples.mdx | 4 ++-- .../references/ts-sdk/kiosk/kiosk-client/introduction.mdx | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/content/references/ts-sdk/kiosk/advanced-examples.mdx b/docs/content/references/ts-sdk/kiosk/advanced-examples.mdx index b0e3fef6c06..1948d65c4f1 100644 --- a/docs/content/references/ts-sdk/kiosk/advanced-examples.mdx +++ b/docs/content/references/ts-sdk/kiosk/advanced-examples.mdx @@ -12,9 +12,9 @@ const otherType = `${packageId}::other_module::OtherStruct<${packageId}::other_c // initialize a kioskClient. const kioskClient = new KioskClient({ client: new IotaClient({ - url: getFullnodeUrl('testnet'), + url: getFullnodeUrl(Network.Testnet), }), - network: 'testnet', + network: Network.Testnet, }); ``` diff --git a/docs/content/references/ts-sdk/kiosk/kiosk-client/introduction.mdx b/docs/content/references/ts-sdk/kiosk/kiosk-client/introduction.mdx index 0e6e68fa800..86cfc76c1ac 100644 --- a/docs/content/references/ts-sdk/kiosk/kiosk-client/introduction.mdx +++ b/docs/content/references/ts-sdk/kiosk/kiosk-client/introduction.mdx @@ -10,17 +10,17 @@ Kiosk Client is the base for all Kiosk SDK functionality. You can follow the example to create a `KioskClient`. View next section for usage in custom networks. ```typescript -import { KioskClient } from '@iota/kiosk'; +import { KioskClient, Network } from '@iota/kiosk'; import { getFullnodeUrl, IotaClient } from '@iota/iota-sdk/client'; // We need a IOTA Client. You can re-use the IotaClient of your project // (it's not recommended to create a new one). -const client = new IotaClient({ url: getFullnodeUrl('testnet') }); +const client = new IotaClient({ url: getFullnodeUrl(Network.Testnet) }); // Now we can use it to create a kiosk Client. const kioskClient = new KioskClient({ client, - network: 'testnet', + network: Network.Testnet, }); ``` From 0ad651bd08dfbe383714a2c7254d03db1b81eaa9 Mon Sep 17 00:00:00 2001 From: marc2332 Date: Wed, 27 Nov 2024 10:30:35 +0100 Subject: [PATCH 4/5] fix usage of Network --- .../references/ts-sdk/kiosk/kiosk-client/introduction.mdx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/content/references/ts-sdk/kiosk/kiosk-client/introduction.mdx b/docs/content/references/ts-sdk/kiosk/kiosk-client/introduction.mdx index 86cfc76c1ac..9bd807a2318 100644 --- a/docs/content/references/ts-sdk/kiosk/kiosk-client/introduction.mdx +++ b/docs/content/references/ts-sdk/kiosk/kiosk-client/introduction.mdx @@ -10,8 +10,8 @@ Kiosk Client is the base for all Kiosk SDK functionality. You can follow the example to create a `KioskClient`. View next section for usage in custom networks. ```typescript -import { KioskClient, Network } from '@iota/kiosk'; -import { getFullnodeUrl, IotaClient } from '@iota/iota-sdk/client'; +import { KioskClient } from '@iota/kiosk'; +import { getFullnodeUrl, IotaClient, Network } from '@iota/iota-sdk/client'; // We need a IOTA Client. You can re-use the IotaClient of your project // (it's not recommended to create a new one). @@ -33,7 +33,7 @@ as the network, and pass the `packageIds` for the rules and extensions you want // constructing it for custom network use. const kioskClient = new KioskClient({ client, - network: 'custom', + network: Network.Custom, packageIds: { kioskLockRulePackageId: '0x...', royaltyRulePackageId: '0x...', From 551abdf96d05601d7f7dbce3b9daa89abbb674c9 Mon Sep 17 00:00:00 2001 From: marc2332 Date: Wed, 27 Nov 2024 10:31:48 +0100 Subject: [PATCH 5/5] fix reference of Network.Custom --- .../references/ts-sdk/kiosk/kiosk-client/introduction.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/content/references/ts-sdk/kiosk/kiosk-client/introduction.mdx b/docs/content/references/ts-sdk/kiosk/kiosk-client/introduction.mdx index 9bd807a2318..e52f56bc105 100644 --- a/docs/content/references/ts-sdk/kiosk/kiosk-client/introduction.mdx +++ b/docs/content/references/ts-sdk/kiosk/kiosk-client/introduction.mdx @@ -26,7 +26,7 @@ const kioskClient = new KioskClient({ ### Using KioskClient on custom networks -To use all the functionality of Kiosk SDK outside of official networks, use `custom` +To use all the functionality of Kiosk SDK outside of official networks, use `Network.Custom` as the network, and pass the `packageIds` for the rules and extensions you want to use. ```typescript