Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs(ts-sdk): Update outdated TS SDK Docs #4255

Merged
merged 5 commits into from
Nov 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions dapps/kiosk-cli/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -49,7 +49,7 @@ const client = new IotaClient({ url: getFullnodeUrl('testnet') });

const kioskClient = new KioskClient({
client,
network: Network.TESTNET,
network: 'testnet',
});

/**
Expand Down
5 changes: 3 additions & 2 deletions dapps/kiosk/src/context/KioskClientContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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<KioskClient | undefined>(undefined);
Expand All @@ -15,7 +16,7 @@ export function KioskClientProvider({ children }: { children: ReactNode }) {
() =>
new KioskClient({
client: iotaClient,
network: network as Network,
network: network as NetworkId,
}),
[iotaClient, network],
);
Expand Down
6 changes: 3 additions & 3 deletions docs/content/developer/standards/wallet-standard.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand All @@ -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;
}
}
```
Expand Down Expand Up @@ -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: [
Expand Down
4 changes: 2 additions & 2 deletions docs/content/references/ts-sdk/kiosk/advanced-examples.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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: Network.TESTNET,
network: Network.Testnet,
});
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,38 +7,33 @@ 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 { 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).
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: Network.TESTNET,
network: 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 `Network.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: Network.Custom,
packageIds: {
kioskLockRulePackageId: '0x...',
royaltyRulePackageId: '0x...',
Expand Down
Original file line number Diff line number Diff line change
@@ -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

Expand Down
Loading