Skip to content
Open
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
30 changes: 25 additions & 5 deletions docs/TrialAccounts/Creation/drop-creation.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ This is done with `NEAR-API-JS` and consists of:
* Specifying the location where the keys are stored for the drop funder's account. This location is commonly in the `~/.near-credentials` folder on your local machine.

```js reference
https://github.com/keypom/keypom-docs-examples/blob/4c8f86dab842c16e9c2bc6ad6f22e1eee2dced9e/advanced-tutorials/trial-accounts/create-trial-drop.js#L11-L29
https://github.com/keypom/keypom-docs-examples/blob/f71760cb9cda203c389c3927c8e0a667db345bac/advanced-tutorials/trial-accounts/create-trial-drop.js#L45-L61
```

---
Expand Down Expand Up @@ -59,23 +59,43 @@ async function createTrialAccount() {
}
```

---

## Creating the Trial Drop

Now that both the SDK and NEAR connections have been established, it's time to create the drop itself. This is done using the `createTrialAccountDrop` function. You'll start by defining the restrictions that the trial account will have. You'll want the trial account to only call methods on the guest book contract and attach up to 1 $NEAR per method. In this case, the guest book contract is deployed to the `guest-book.examples.keypom.testnet` account.
Now that both the SDK and NEAR connections have been established, it's time to create the drop itself. This is done using the `createTrialAccountDrop` function.

You'll start by defining the restrictions that the trial account will have. You'll want the trial account to only call methods on the guest book and social contracts and attach up to 1 $NEAR per method. In this case, the guest book and social contracts are deployed to the `guest-book.examples.keypom.testnet` and `v1.social08.testnet` accounts respectively.

```js reference
https://github.com/keypom/keypom-docs-examples/blob/4c8f86dab842c16e9c2bc6ad6f22e1eee2dced9e/advanced-tutorials/trial-accounts/create-trial-drop.js#L37-L51
https://github.com/keypom/keypom-docs-examples/blob/f71760cb9cda203c389c3927c8e0a667db345bac/advanced-tutorials/trial-accounts/create-trial-drop.js#L20-L34
```

:::note
Note that a `*` was passed in for the callable methods. This means that the trial account can call any method as long as it's on the guest book contract.
:::

In addition to specifying methods, you can also pre-claim a key so that the user receives an initialized account that can use the dApp right away. This can be done with the following:

```js reference
https://github.com/keypom/keypom-docs-examples/blob/f71760cb9cda203c389c3927c8e0a667db345bac/advanced-tutorials/trial-accounts/create-trial-drop.js#L82-L94
```

Once this is finished, you can create the drop itself. The account will start with `2.5 $NEAR` and will reach the floor once `1.25 $NEAR` has been spent on attached deposits and burnt gas.

```js reference
https://github.com/keypom/keypom-docs-examples/blob/4c8f86dab842c16e9c2bc6ad6f22e1eee2dced9e/advanced-tutorials/trial-accounts/create-trial-drop.js#L53-L67
https://github.com/keypom/keypom-docs-examples/blob/f71760cb9cda203c389c3927c8e0a667db345bac/advanced-tutorials/trial-accounts/create-trial-drop.js#L69-L79
```

In the above example, you only created 1 drop but you can create as many as you want for your users. It's super simple and the Keypom SDK has abstracted all the complexities away from you. In the next tutorial, you'll run the script and instantly sign into the guest-book app.
---

## Full Code

```js reference
https://github.com/keypom/keypom-docs-examples/blob/f71760cb9cda203c389c3927c8e0a667db345bac/advanced-tutorials/trial-accounts/create-trial-drop.js#L1-L133
```

---

## Conclusion
In this example, you only created 1 drop but you can create as many as you want for your users. It's super simple and the Keypom SDK has abstracted all the complexities away from you. In the next tutorial, you'll run the script and instantly sign into the guest-book app.
14 changes: 12 additions & 2 deletions docs/TrialAccounts/Creation/integration.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ https://github.com/keypom/keypom-docs-examples/blob/f1f634a629808f0d0943e508c2be
In addition, change the `guestBookInstance` to whichever URL your app is running on:

```js reference
https://github.com/keypom/keypom-docs-examples/blob/f1f634a629808f0d0943e508c2be6576622d32b1/advanced-tutorials/trial-accounts/create-trial-drop.js#L70
https://github.com/keypom/keypom-docs-examples/blob/f71760cb9cda203c389c3927c8e0a667db345bac/advanced-tutorials/trial-accounts/create-trial-drop.js#L14-L19
```

Once this is finished, you can run the following command to create the trial account drop.
Expand Down Expand Up @@ -168,7 +168,17 @@ You'll notice that there are a couple of parameters that are passed into the `se

By default, the modals that are shown to the user can be heavily customized to match the look and feel of your website. If you brand the regular wallet selector modal, the CSS will **automatically be applied** to the trial account modals.

In addition, you can specify a suite of titles and descriptions. These will be covered further in a different tutorial.
You may also brand and customize the modal with titiles, descriptions, colours etc. using a code snippet stored on IPFS, by appending a `cid` prop to the end of the URL. This is seen below:

```js reference
https://github.com/keypom/keypom-docs-examples/blob/f71760cb9cda203c389c3927c8e0a667db345bac/advanced-tutorials/trial-accounts/create-trial-drop.js#L118-L120
```

Where the `includedCID` is

```js
const includedCID = "bafkreidneri4ffymscahjprlapg4j62yleli73ncwdmopnkxpgczpusqn4"
```

## Conclusion

Expand Down
10 changes: 5 additions & 5 deletions docs/keypom-sdk/Core/welcome.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,24 @@ custom_edit_url: null
<p align="center">
<a href="https://docs.keypom.xyz/">
<picture>
<img src="https://cloudflare-ipfs.com/ipfs/bafybeightypuoqly32gsrivh4efckhdv6wsefiynpnonlem6ts3ypgdm7e" height="128">
<img src="https://cloudflare-ipfs.com/ipfs/bafybeightypuoqly32gsrivh4efckhdv6wsefiynpnonlem6ts3ypgdm7e" height="128"/>
</picture>
<h1 align="center">Keypom Core SDK</h1>
</a>
</p>

<p align="center">
<a aria-label="Made by Ben Kurrek" href="https://github.com/BenKurrek">
<img src="https://img.shields.io/badge/MADE%20BY-Ben%20Kurrek-000000.svg?style=for-the-badge">
<img src="https://img.shields.io/badge/MADE%20BY-Ben%20Kurrek-000000.svg?style=for-the-badge"/>
</a>
<a aria-label="Made by Matt Lockyer" href="https://github.com/mattlockyer">
<img src="https://img.shields.io/badge/MADE%20BY-Matt%20Lockyer-000000.svg?style=for-the-badge">
<img src="https://img.shields.io/badge/MADE%20BY-Matt%20Lockyer-000000.svg?style=for-the-badge"/>
</a>
<a aria-label="License" href="https://github.com/keypom/keypom-js/blob/main/LICENSE">
<img alt="" src="https://img.shields.io/badge/License-GNU%20GPL-green?style=for-the-badge">
<img alt="" src="https://img.shields.io/badge/License-GNU%20GPL-green?style=for-the-badge"/>
</a>
<a aria-label="Join the community" href="https://t.me/+OqI-cKxQU05lZDIx">
<img alt="" src="https://img.shields.io/badge/Join%20The-community-blueviolet.svg?style=for-the-badge">
<img alt="" src="https://img.shields.io/badge/Join%20The-community-blueviolet.svg?style=for-the-badge"/>
</a>
</p>

Expand Down
10 changes: 5 additions & 5 deletions docs/keypom-sdk/Selector/welcome.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,24 @@ custom_edit_url: null
<p align="center">
<a href="https://docs.keypom.xyz/">
<picture>
<img src="https://cloudflare-ipfs.com/ipfs/bafybeightypuoqly32gsrivh4efckhdv6wsefiynpnonlem6ts3ypgdm7e" height="128">
<img src="https://cloudflare-ipfs.com/ipfs/bafybeightypuoqly32gsrivh4efckhdv6wsefiynpnonlem6ts3ypgdm7e" height="128"/>
</picture>
<h1 align="center">Keypom Wallet Selector</h1>
</a>
</p>

<p align="center">
<a aria-label="Made by Ben Kurrek" href="https://github.com/BenKurrek">
<img src="https://img.shields.io/badge/MADE%20BY-Ben%20Kurrek-000000.svg?style=for-the-badge">
<img src="https://img.shields.io/badge/MADE%20BY-Ben%20Kurrek-000000.svg?style=for-the-badge"/>
</a>
<a aria-label="Made by Matt Lockyer" href="https://github.com/mattlockyer">
<img src="https://img.shields.io/badge/MADE%20BY-Matt%20Lockyer-000000.svg?style=for-the-badge">
<img src="https://img.shields.io/badge/MADE%20BY-Matt%20Lockyer-000000.svg?style=for-the-badge"/>
</a>
<a aria-label="License" href="https://github.com/keypom/keypom-js/blob/main/LICENSE">
<img alt="" src="https://img.shields.io/badge/License-GNU%20GPL-green?style=for-the-badge">
<img alt="" src="https://img.shields.io/badge/License-GNU%20GPL-green?style=for-the-badge"/>
</a>
<a aria-label="Join the community" href="https://t.me/+OqI-cKxQU05lZDIx">
<img alt="" src="https://img.shields.io/badge/Join%20The-community-blueviolet.svg?style=for-the-badge">
<img alt="" src="https://img.shields.io/badge/Join%20The-community-blueviolet.svg?style=for-the-badge"/>
</a>
</p>

Expand Down