Skip to content

Commit

Permalink
chore: Cleanup Capy and Iotafren mentions
Browse files Browse the repository at this point in the history
  • Loading branch information
DaughterOfMars committed Nov 4, 2024
1 parent 0694954 commit 2c30798
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 22 deletions.
2 changes: 1 addition & 1 deletion crates/iota-open-rpc/spec/openrpc.json
Original file line number Diff line number Diff line change
Expand Up @@ -883,7 +883,7 @@
},
{
"name": "module",
"value": "iotafrens"
"value": "my_module"
},
{
"name": "function",
Expand Down
2 changes: 1 addition & 1 deletion crates/iota-open-rpc/src/examples.rs
Original file line number Diff line number Diff line change
Expand Up @@ -938,7 +938,7 @@ impl RpcExampleProvider {
"Returns the argument types for the package and function the request provides.",
vec![
("package", json!(ObjectID::new(self.rng.gen()))),
("module", json!("iotafrens".to_string())),
("module", json!("my_module".to_string())),
("function", json!("mint".to_string())),
],
json!(result),
Expand Down
20 changes: 10 additions & 10 deletions docs/content/references/ts-sdk/kiosk/advanced-examples.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ For these examples, assume you have the following data and functions available:
<AlphaNet />

```typescript
// a constant for bullshark's type.
const bullsharkType = `${packageId}::iotafrens::IotaFren<${packageId}::bullshark::Bullshark>`;
// a constant for capy's type.
const capyType = `${packageId}::iotafrens::IotaFren<${packageId}::capy::Capy>`;
// a constant for my type.
const myType = `${packageId}::my_module::MyStruct<${packageId}::my_coin_module::MyCoin>`;
// a constant for another type.
const otherType = `${packageId}::other_module::OtherStruct<${packageId}::other_coin_module::OtherCoin>`;

// initialize a kioskClient.
const kioskClient = new KioskClient({
Expand All @@ -21,9 +21,9 @@ const kioskClient = new KioskClient({
});
```

## Minting a IotaFren
## Minting a MyCoin

This example demonstrates how to mint a IotaFren.
This example demonstrates how to mint a MyCoin.

```typescript
async function mintFren(address: string) {
Expand All @@ -38,11 +38,11 @@ async function mintFren(address: string) {
// We're mixing the logic here. If the cap is undefined, we create a new kiosk.
if (!cap) kioskTx.create();

// Let's mint a capy here into the kiosk (either a new or an existing one).
// Let's mint a MyCoin here into the kiosk (either a new or an existing one).
txb.moveCall({
target: `${packageId}::iotafrens::mint_app::mint`,
target: `${packageId}::my_module::mint_app::mint`,
arguments: [kioskTx.getKiosk(), kioskTx.getKioskCap()],
typeArguments: [capyType],
typeArguments: [myType],
});

// If we don't have a cap, that means we create a new kiosk for the user in this flow.
Expand All @@ -55,7 +55,7 @@ async function mintFren(address: string) {
}
```

## Mixing two Iotafrens
## Mixing two MyCoins

This example demonstrates how to use the Kiosk SDK to mix two `bullsharks`.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,35 +16,35 @@ always be able to pay for the gas of the transaction.

However, in more complex scenarios, you might want to define your own split strategy.

Assume that you want to execute multiple transactions that transfer an object of type `CapyNFT`,
Assume that you want to execute multiple transactions that transfer an object of type `MyNFT`,
each to a different recipient.

For this to work, the `ExecutorServiceHandler` needs to split the `mainPool` in a way such that
every worker:

- Contains at least one `CapyNFT` object.
- Contains at least one `MyNFT` object.
- Contains at least a coin (or set of coins) with a total balance enough to pay for the gas of the
transaction.

To do this, you have to implement the `SplitStrategy` interface. In detail:

```ts
class MyCustomSplitStrategy implements SplitStrategy {
private capyIncluded = false;
private myNftIncluded = false;
private balanceSoFar = 0;
private readonly minimumBalance;

public pred(obj: PoolObject | undefined) {
if (!obj) throw new Error('No object found!.');
// If each requirement is fulfilled then terminate the split by returning null
// This stops the split process and the worker pool is created
const terminateWhen = this.balanceSoFar >= this.minimumBalance && this.capyIncluded;
const terminateWhen = this.balanceSoFar >= this.minimumBalance && this.myNftIncluded;
if (terminateWhen) {
return null;
}
// If a CapyNFT object is not already included, and the object is a CapyNFT, then include it
if (!capyIncluded && obj.type.includes('CapyNFT')) {
this.capyIncluded = true;
// If a MyNFT object is not already included, and the object is a MyNFT, then include it
if (!myNftIncluded && obj.type.includes('MyNFT')) {
this.myNftIncluded = true;
return true;
}
// If the object is a coin and coins are still needed, then include it to the new pool
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"answerOptions": [
{ "answerText": "IOTA", "isCorrect": false },
{ "answerText": "GEM", "isCorrect": true },
{ "answerText": "Capy", "isCorrect": false },
{ "answerText": "Doge", "isCorrect": false },
{ "answerText": "Swords", "isCorrect": false }
]
}
Expand Down
4 changes: 2 additions & 2 deletions examples/move/token/sources/gems.move
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ module examples::gem {
// rules for different types of actions.
fun init(otw: GEM, ctx: &mut TxContext) {
let (treasury_cap, coin_metadata) = coin::create_currency(
otw, 0, b"GEM", b"Capy Gems", // otw, decimal, symbol, name
b"In-game currency for Capy Miners", none(), // description, url
otw, 0, b"GEM", b"Gems", // otw, decimal, symbol, name
b"In-game currency for Miners", none(), // description, url
ctx
);

Expand Down

0 comments on commit 2c30798

Please sign in to comment.