Stephen Kresov
Stephen Kresov

Reputation: 21

Near smart-contract obscure instructions in the documentation

example from documentation: https://docs.near.org/tutorials/examples/escrow

Here is the complete sequence of steps to run the example from the readme.md file: https://github.com/near-examples/escrow-js

  1. Login to your NEAR account
near login
  1. Create sub accounts for deploying the contracts
near create-account --accountId <your-escrow-testnet-account-id> --masterAccount <your-testnet-account-id> --initialBalance <your-escrow-testnet-account-balance>
near create-account --accountId <your-assets-testnet-account-id> --masterAccount <your-testnet-account-id> --initialBalance <your-assets-testnet-account-balance>

I replace:

<your-testnet-account-id> : gettherefast.testnet
<your-escrow-testnet-account-id> : escrow.gettherefast.testnet
<your-assets-testnet-account-id> : assets.gettherefast.testnet
  1. Deploy the Contracts
near deploy --wasmFile build/escrow.wasm --accountId <your-escrow-testnet-account-id>
near deploy --wasmFile build/assets.wasm --accountId <your-assets-testnet-account-id>
  1. Initialize the Assets Contract
near call <your-assets-testnet-account-id> init '{"owner_id": "<your-asset-owner-account-id>", "total_supply": "1000", "escrow_contract_id": "<your-escrow-testnet-account-id>", "asset_price": "100000000000000000000000"}' --accountId <your-assets-testnet-account-id>

There is some new account that I don't know anything about:

   <your-asset-owner-account-id>
  1. Perform a Purchase on Escrow
near call <your-escrow-testnet-account-id> purchase_in_escrow '{"seller_account_id": "<your-asset-owner-account-id>", "asset_contract_id ": "<your-assets-testnet-account-id>"}' --accountId <your-buyer-account-id> --amount 0.11 --gas=300000000000000

and one more

<your-buyer-account-id>
  1. Check the Balance of the Buyer Account
      near view <your-assets-testnet-account-id> get_account_assets '{"account_id": "<your-buyer-account-id>"}'  

and one more

near state <seller-account-id>
  1. Approve the Purchase
near call <your-escrow-testnet-account-id> approve_purchase '{}' --accountId <your-buyer-account-id>

Question: What to put in their place:

<your-asset-owner-account-id>
<your-buyer-account-id> 
<seller-account-id>

I have no thoughts on this. I have 3 accounts, but I need 6.

Upvotes: 2

Views: 62

Answers (1)

idea404
idea404

Reputation: 409

The README could have been a little more explicit. I have updated it in the repository and will update the documentation in a brief moment as well.

As for what to do with these other accounts:

You actually only need two other accounts, namely:

  • <your-asset-owner-account-id> that holds all the desired assets or assets for sale
  • <your-buyer-account-id> which is the account seeking to purchase assets from the asset holder for some $NEAR.

I suggest you make sub accounts for each of these. I would call them something like asset-seller.gettherefast.testnet and asset-buyer.gettherefast.testnet.

As for <seller-account-id>, this is equal to <your-asset-owner-account-id> in this README example. So I have substituted this for <your-asset-owner-account-id>.

Upvotes: 1

Related Questions