Deposit
Mystiko Deposit Related APIs.
Data Structure
Quote
Retrieve quote information for a deposit.
import mystiko from '@mystikonetwork/node';
import { core, common } from '@mystikonetwork/protos';
const options = new core.handler.v1.QuoteDepositOptions({
chainId: BigInt(11155111),
assetSymbol: 'MTT',
dstChainId: BigInt(11155111),
bridgeType: common.v1.BridgeType.LOOP,
});
const depositQuote = mystiko.deposit?.quote(options);
QuoteDepositOptions
:
Parameter | Required | Description |
---|---|---|
chainId | true | The chain ID of the asset. |
assetSymbol | true | Asset symbol. |
queryTimeoutMs | false | Query timeout in milliseconds. |
dstChainId | false | Destination chain id. |
bridgeType | false | Bridge type. |
DepositQuote
data structure is as follows:
Property | Type | Description |
---|---|---|
assetSymbol | string | Asset symbol. |
assetDecimals | number | Asset decimals. |
minAmount | number | Minimum amount. |
minDecimalAmount | string | Minimum decimal amount. |
maxAmount | number | Maximum amount. |
maxDecimalAmount | string | Maximum decimal amount. |
minRollupFeeAmount | number | Minimum rollup fee amount. |
minRollupFeeDecimalAmount | string | Minimum rollup fee decimal amount. |
rollupFeeAssetSymbol | string | Rollup fee asset symbol. |
rollupFeeAssetDecimals | number | Rollup fee asset decimals. |
minBridgeFeeAmount | number | Minimum bridge fee amount. |
minBridgeFeeDecimalAmount | string | Minimum bridge fee decimal amount. |
bridgeFeeAssetSymbol | string | Bridge fee asset symbol. |
bridgeFeeAssetDecimals | number | Bridge fee asset decimals. |
minExecutorFeeAmount | number | Minimum executor fee amount. |
minExecutorFeeDecimalAmount | string | Minimum executor fee decimal amount. |
executorFeeAssetSymbol | string | Executor fee asset symbol. |
executorFeeAssetDecimals | number | Executor fee asset decimals. |
recommendedAmounts | number[] | Recommended amounts. |
recommendedDecimalAmounts | string[] | Recommended decimal amounts. |
Summary
Retrieve summary information for a deposit.
import mystiko from '@mystikonetwork/node';
import { core } from '@mystikonetwork/protos';
const options = new core.handler.v1.CreateDepositOptions({
chainId: BigInt(11155111),
assetSymbol: 'MTT',
amount: 1,
shieldedAddress:
'13hMt2P6h8zp5t8Cxm5oAzTULg1boVEvzjaEPXmLtSBUmF4KKnaooWkBKBqZs9BYncvY6rA6TpCkAJ6cEXFEHWMHt',
dstChainId: BigInt(11155111),
bridgeType: common.v1.BridgeType.LOOP,
});
const depositSummary = mystiko.deposit?.summary(options);
CreateDepositOptions
:
Parameter | Required | Description |
---|---|---|
chain_id | true | Chain id. |
asset_symbol | true | Asset symbol. |
amount | true | Amount. |
shielded_address | true | Shielded address. |
dst_chain_id | false | Destination chain id. |
rollup_fee_amount | false | Rollup fee amount. |
bridge_fee_amount | false | Bridge fee amount. |
executor_fee_amount | false | Executor fee amount. |
query_timeout_ms | false | Query timeout in milliseconds. |
deposit_quote | false | Deposit quote. |
bridge_type | false | Bridge type. |
DepositSummary
data structure is as follows:
Property | Type | Description |
---|---|---|
chainId | bigint | Chain id. |
assetSymbol | string | Asset symbol. |
assetDecimals | number | Asset decimals. |
amount | number | Amount. |
decimalAmount | string | Decimal amount. |
shieldedAddress | string | Shielded address. |
rollupFeeAmount | number | Rollup fee amount. |
rollupFeeDecimalAmount | string | Rollup fee decimal amount. |
rollupFeeAssetSymbol | string | Rollup fee asset symbol. |
rollupFeeAssetDecimals | number | Rollup fee asset decimals. |
dstChainId | bigint | Destination chain id. |
bridgeFeeAmount | number | Bridge fee amount. |
bridgeFeeDecimalAmount | string | Bridge fee decimal amount. |
bridgeFeeAssetSymbol | string | Bridge fee asset symbol. |
bridgeFeeAssetDecimals | number | Bridge fee asset decimals. |
executorFeeAmount | number | Executor fee amount. |
executorFeeDecimalAmount | string | Executor fee decimal amount. |
executorFeeAssetSymbol | string | Executor fee asset symbol. |
executorFeeAssetDecimals | number | Executor fee asset decimals. |
bridgeType | BridgeType | Bridge type. |
totalAmounts | {[key: string]: number;} | Total amounts. |
totalDecimalAmounts | {[key: string]: string;} | Total decimal amounts. |
Create
Create a Deposit request.
import mystiko from '@mystikonetwork/node';
import { core } from '@mystikonetwork/protos';
const options = new core.handler.v1.CreateDepositOptions({
chainId: BigInt(11155111),
assetSymbol: 'MTT',
amount: 1,
shieldedAddress:
'13hMt2P6h8zp5t8Cxm5oAzTULg1boVEvzjaEPXmLtSBUmF4KKnaooWkBKBqZs9BYncvY6rA6TpCkAJ6cEXFEHWMHt',
dstChainId: BigInt(11155111),
bridgeType: common.v1.BridgeType.LOOP,
});
const deposit = mystiko.deposit?.create(options);
Deposit
data structure is as follows:
Property | Type | Description |
---|---|---|
id | string | Id. |
createdAt | bigint | Created at. |
updatedAt | bigint | Updated at. |
chainId | bigint | Chain id. |
contractAddress | string | Contract address. |
poolAddress | string | Pool address. |
dstChainId | bigint | Destination chain id. |
dstChainContractAddress | string | Destination chain contract address. |
dstPoolAddress | string | Destination pool address. |
commitmentHash | string | Commitment hash. |
hashK | string | Hash K. |
randomS | string | Random S. |
encryptedNote | string | Encrypted note. |
assetSymbol | string | Asset symbol. |
assetDecimals | number | Asset decimals. |
amount | number | Amount. |
decimalAmount | string | Decimal amount. |
rollupFeeAmount | number | Rollup fee amount. |
rollupFeeDecimalAmount | string | Rollup fee decimal amount. |
shieldedAddress | string | Shielded address. |
walletId | string | Wallet id. |
assetAddress | string | Asset address. |
bridgeFeeAmount | number | Bridge fee amount. |
bridgeFeeDecimalAmount | string | Bridge fee decimal amount. |
executorFeeAmount | number | Executor fee amount. |
executorFeeDecimalAmount | string | Executor fee decimal amount. |
bridgeFeeAssetAddress | string | Bridge fee asset address. |
bridgeFeeAssetSymbol | string | Bridge fee asset symbol. |
bridgeFeeAssetDecimals | number | Bridge fee asset decimals. |
executorFeeAssetAddress | string | Executor fee asset address. |
executorFeeAssetSymbol | string | Executor fee asset symbol. |
executorFeeAssetDecimals | number | Executor fee asset decimals. |
queuedTransactionHash | string | Queued transaction hash. |
includedTransactionHash | string | Included transaction hash. |
srcChainTransactionHash | string | Source chain transaction hash. |
assetApproveTransactionHash | string[] | Asset approve transaction hash. |
errorMessage | string | Error message. |
bridgeType | BridgeType | Bridge type. |
status | DepositStatus | Deposit status. |
Send
Send a deposit transaction using a private key.
import mystiko from '@mystikonetwork/node';
import { core } from '@mystikonetwork/protos';
const options = new core.handler.v1.SendDepositOptions({
depositId: 'id',
privateKey: 'private key of transaction signer'
});
const deposit = mystiko.deposit?.send(options);
SendDepositOptions
:
Parameter | Required | Description |
---|---|---|
depositId | true | Deposit id. |
privateKey | false | Private key. |
signerProvider | false | Signer provider. |
queryTimeoutMs | false | Query timeout in milliseconds. |
assetApproveConfirmations | false | Asset approve confirmations. |
depositConfirmations | false | Deposit confirmations. |
txSendTimeoutMs | false | Transaction send timeout in milliseconds. |
txWaitTimeoutMs | false | Transaction wait timeout in milliseconds. |
txWaitIntervalMs | false | Transaction wait interval in milliseconds. |
assetApproveTx | false | Asset approve transaction. |
depositTx | false | Deposit transaction. |
screeningMessage | false | Screening message. |
SendWithGrpc
Send a deposit transaction by signing through the given gRPC interface.
import mystiko from '@mystikonetwork/node';
import { core, service } from '@mystikonetwork/protos';
const options1 = new core.handler.v1.SendDepositOptions({
depositId: 'id',
});
const options2 = new service.v1.ClientOptions({});
const deposit = mystiko.deposit?.sendWithGrpc(options1, options2);
ClientOptions
:
Parameter | Required | Description |
---|---|---|
host | true | Host. |
port | true | Port. |
isSsl | false | Is SSL. |
sslCert | false | SSL cert. |
sslCertPath | false | SSL cert path. |
sslServerName | false | SSL server name. |
Find
Query deposit data using Filter
.
import mystiko from '@mystikonetwork/node';
import { storage } from '@mystikonetwork/protos';
const filter = new storage.v1.SubFilter({
column: 'id',
values: ['deposit1'],
operator: storage.v1.SubFilterOperator.IN,
});
const deposits = mystiko.deposit?.find(filter);
FindAll
Query all Deposit data.
import mystiko from '@mystikonetwork/node';
const deposits = mystiko.deposit?.find(undefined);
FindOne
Find a single Deposit record using Filter
.
import mystiko from '@mystikonetwork/node';
import { storage } from '@mystikonetwork/protos';
const filter = new storage.v1.SubFilter({
column: 'id',
values: ['deposit1'],
operator: storage.v1.SubFilterOperator.IN,
});
const deposits = mystiko.deposit?.findOne(filter);
FindById
Find a single Deposit record by its ID.
import mystiko from '@mystikonetwork/node';
const deposit = mystiko.deposit?.findById("id");
Count
Query the count of data that matches the QueryFilter
criteria.
import mystiko from '@mystikonetwork/node';
import { storage } from '@mystikonetwork/protos';
const filter = new storage.v1.SubFilter({
column: 'id',
values: ['id'],
operator: storage.v1.SubFilterOperator.IN,
});
const total = mystiko.deposit?.count(filter);
CountAll
Query the total count of all Deposit data.
import mystiko from '@mystikonetwork/node';
const total = mystiko.deposit?.count(undefined);
Update
Update a Deposit record.
import mystiko from '@mystikonetwork/node';
const deposit = mystiko.deposit?.findById("id");
deposit.amount = 2000;
const newDeposit = mystiko.deposit?.update(deposit);
UpdateBatch
Batch update Deposit records.
import mystiko from '@mystikonetwork/node';
const deposit = mystiko.deposit?.findById("id");
deposit.amount = 2000;
const newDeposits = mystiko.deposit?.updateBatch([deposit]);
UpdateByFilter
Update Deposit records based on the conditions specified in the Filter
.
import mystiko from '@mystikonetwork/node';
import { api, storage } from '@mystikonetwork/protos';
const columnValues = [
new api.handler.v1.ColumnValuePair({
column: 'amount',
value: new storage.v1.ColumnValue({
value: {
value: 2000,
case: 'f64Value',
},
}),
}),
];
const filter = new storage.v1.QueryFilter({
conditions: [],
conditionsOperator: storage.v1.ConditionOperator.OR,
});
mystiko.deposit?.updateByValues(columnValues, filter);
UpdateAll
Update all Deposit records.
import mystiko from '@mystikonetwork/node';
import { api, storage } from '@mystikonetwork/protos';
const columnValues = [
new api.handler.v1.ColumnValuePair({
column: 'amount',
value: new storage.v1.ColumnValue({
value: {
value: 2000,
case: 'f64Value',
},
}),
}),
];
mystiko.deposit?.updateByValues(columnValues, undefined);
Delete
Delete a Deposit record.
import mystiko from '@mystikonetwork/node';
const deposit = mystiko.deposit?.findById("id");
mystiko.deposit?.delete(deposit);
DeleteBatch
Batch delete Deposit records.
import mystiko from '@mystikonetwork/node';
const deposit = mystiko.deposit?.findById("id");
mystiko.deposit?.deleteBatch([deposit]);
DeleteByFilter
Delete Deposit records based on the conditions specified in the Filter
.
import mystiko from '@mystikonetwork/node';
import { storage } from '@mystikonetwork/protos';
const filter = new storage.v1.SubFilter({
column: 'id',
values: ['id'],
operator: storage.v1.SubFilterOperator.IN,
});
const total = mystiko.deposit?.deleteByFilter(filter);
DeleteAll
Delete all Deposit records.
import mystiko from '@mystikonetwork/node';
mystiko.deposit?.deleteAll();