depositStorage
Deposits
0.01 * listAmount
of NEAR Token to the market smart contract to be consumed for each listing.If the amount of active listings becomes larger than the corresponding deposits called by an account, another deposit will need to be made to make listing possible.
Market address default values depend on the NEAR_NETWORK enviroment variable. If you set it to
mainnet
you will get the mainnet marketId
simple.market.mintbase1.near
otherwise it will default to the testnet
value market-v2-beta.mintspace2.testnet
.depositStorage
takes a single argument of type DepositStorageArgs
export type DepositStorageArgs = {
//the deposit corresponding roughly to the amounts of listings you will be doing
listAmount?: number;
//accountId of the mintbase market, this defaults to the correct value depending on the NEAR_NETWORK environment variable
marketAddress?: string;
};
Example usage of deployContract method in a hypothetical React component:
DepositStorageComponent.ts
1
import { useState } from 'react';
2
import { useWallet } from '@mintbase-js/react';
3
import { execute, depositStorage, DepositStorageArgs } from '@mintbase-js/sdk';
4
5
6
export const DepositStorageComponent = ({ listAmount, marketAddress }:DepositStorageArgs):JSX.Element => {
7
8
const { selector } = useWallet();
9
10
const handleDepositStorage = async (): Promise<void> => {
11
const wallet = await selector.wallet();
12
13
await execute(
14
{wallet},
15
depositStorage({
16
listAmount: listAmount,
17
marketAddress: marketAddress
18
})
19
)
20
}
21
22
return (
23
<div>
24
<button onClick={handleDepositStorage}>
25
DeployContract with name= {name} and owner= {owner}
26
</button>
27
</div>
28
);
29
};
Last modified 10mo ago