### Initialize Hardhat Project Source: https://docs.rayls.com/docs/cross-chain-transactions Commands to install Hardhat and initialize a new project structure. ```shell npm install --save-dev hardhat ``` ```shell npx hardhat init ``` -------------------------------- ### Run Privacy Ledger Source: https://docs.rayls.com/docs/rayls-privacy-ledger-installation-v1-7 Starts the Privacy Ledger container with necessary volume mappings and port exposures. ```shell sudo docker run -v ~/rayls/data:/app/data --env MONGODB_CONN=$MONGODB_CONN --env MONGODB_DATABASE=$MONGODB_DATABASE -p 8545:8545 -p 8660:8660 registry.parfin.io/rayls-privacy-ledger:v1.7.1 ``` -------------------------------- ### Install Rayls Contracts Source: https://docs.rayls.com/docs/cross-chain-transactions Command to add the Rayls Protocol SDK to an existing Hardhat project. ```shell npm i @rayls/contracts ``` -------------------------------- ### Start Rayls Privacy Ledger Service Source: https://docs.rayls.com/docs/rayls-privacy-ledger-installation-v1-7 Starts the Rayls Privacy Ledger node with HTTP/WS APIs, mining enabled, and MongoDB backend configuration. ```bash #!/bin/bash /app/rayls-privacy-ledger \ --http \ --http.vhosts='*' \ --http.addr="0.0.0.0" \ --http.api="net,web3,eth,debug,txpool" \ --http.port 8545 \ --http.corsdomain '*' \ --ws \ --ws.port 8660 \ --ws.addr="0.0.0.0" \ --ws.api eth,net,web3 \ --ws.origins '*' \ --datadir /app/data/ \ --networkid 12345 \ --mine \ --miner.threads=1 \ --miner.etherbase=0x1bE478ee83095aF7F21bd84743fB39B68Dd600A6 \ --rpc.gascap 0 \ --gcmode "archive" \ --syncmode=full \ --miner.gasprice 0 \ --port 30309 \ --config /app/var/config.toml \ --db.engine mongodb \ --db.engine.host $MONGODB_CONN \ --db.engine.name=$MONGODB_DATABASE ``` -------------------------------- ### Example ERC20 Token Deployment with Rayls Source: https://docs.rayls.com/docs/sdk This contract demonstrates how to deploy a custom ERC20 token that inherits from RaylsErc20Handler, enabling standard ERC20 functionalities along with Rayls cross-chain capabilities. It includes initial token minting upon deployment. ```solidity contract Erc20TokenExample is RaylsErc20Handler {     constructor(         string memory _name,         string memory _symbol,         address _endpoint     )         RaylsErc20Handler(             _name,             _symbol,             _endpoint,             msg.sender         )     {         _mint(msg.sender, 2000);     } ``` -------------------------------- ### All Tokens Approval Success Message Source: https://docs.rayls.com/docs/approving-new-tokens Example success message for approving all pending tokens, repeated for each token. ```bash ✅ The token "TokenName" (TokenSymbol) got approved! (repeated for each token) ``` -------------------------------- ### Install Rayls Contracts via pnpm Source: https://docs.rayls.com/docs/sdk Use this command to add the Rayls contracts package to your project when using pnpm. ```text pnpm add @rayls/contracts ``` -------------------------------- ### Install Rayls Contracts via npm Source: https://docs.rayls.com/docs/sdk Use this command to add the Rayls contracts package to your project when using npm. ```text npm install @rayls/contracts --save ``` -------------------------------- ### Token Approval Success Message Source: https://docs.rayls.com/docs/approving-new-tokens Example success message indicating a specific token has been approved. ```bash ✅ The token with resourceId got approved! ``` -------------------------------- ### Execute Docker Compose Add Participant Command Source: https://docs.rayls.com/docs/adding-new-participants Run this command in your terminal to start the Docker Compose service for adding a participant. This assumes you have a Makefile configured. ```bash make add-participant ``` -------------------------------- ### ERC20 Token Example with Teleportation Source: https://docs.rayls.com/docs/teleport-tokens Inherit from RaylsErc20Handler to create an ERC20 token with cross-network teleportation. Ensure a unique resourceId is provided for reliable referencing across different Rayls Privacy Node Ledgers. ```solidity // SPDX-License-Identifier: MIT pragma solidity ^0.8.20; import "@rayls/contracts/tokens/RaylsErc20Handler.sol"; contract TokenExample is RaylsErc20Handler { constructor( string memory _name, string memory _symbol, bytes32 _resourceId, address _endpoint, address _owner, uint256 _cCchainId, address _balanceCommitmentsContract ) RaylsErc20Handler( _name, _symbol, _resourceId, _endpoint, _owner, _cCchainId, _balanceCommitmentsContract ) { //your logic here } } ``` -------------------------------- ### ArbitraryMessage Contract Example Source: https://docs.rayls.com/docs/sdk An example contract demonstrating how to send a string message cross-chain. Both sender and receiver deploy this contract. The payload is encoded to call the receiveMsg function on the receiver. ```Solidity contract ArbitraryMessage is RaylsApp { string public msg; BridgedTransferMetadata private emptyMetadata; constructor(address _endpoint) RaylsApp(_endpoint) {} function sendMessage(bytes32 _resourceId, string memory message, uint256 destChainId) public { _raylsSendToResourceId( destChainId, _resourceId, abi.encodeWithSelector(this.receiveMsg.selector, message), "", "", "", emptyMetadata ); } function receiveMsg(string memory _msg) public { msg = _msg; } } ``` -------------------------------- ### Deploying with Foundry Source: https://docs.rayls.com/docs/public-chain-reference Use the forge create command to deploy contracts to the Rayls testnet. ```bash forge create --rpc-url https://testnet-rpc.rayls.com --private-key src/MyContract.sol:MyContract ``` -------------------------------- ### OpenAPI Definition for Get Balance by ID Source: https://docs.rayls.com/reference/get_api-token-id-balance-walletid This OpenAPI 3.0.1 definition outlines the GET request for retrieving a token's balance by ID. It specifies path parameters, response schemas for success and errors, and security schemes. ```json { "openapi": "3.0.1", "info": { "title": "Parfin Custody HSM API", "description": "Responsible to create wallets, transactions and setup their configuration.", "version": "v1", "x-logo": { "url": "https://app.parfin.io/assets/images/icons/parfin-logo.svg", "altText": "Parfin API Logo" } }, "paths": { "/api/token/{id}/balance/{walletId}": { "get": { "tags": [ "Token" ], "summary": "Get Balance by id", "description": "", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "string" } }, { "name": "walletId", "in": "path", "required": true, "schema": { "type": "string" } } ], "responses": { "200": { "description": "OK", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/TokenResponseIEnumerableInt32ValueTuple" } } } }, "400": { "description": "Bad Request", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ApiError" } } } }, "404": { "description": "Not Found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ApiError" } } } }, "500": { "description": "Server Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ApiError" } } } } } } } }, "components": { "schemas": { "ApiError": { "type": "object", "properties": { "message": { "type": "string", "nullable": true }, "detail": { "type": "string", "nullable": true }, "timestamp": { "type": "string", "format": "date-time" }, "path": { "type": "string", "nullable": true }, "errorCode": { "type": "string", "nullable": true }, "errors": { "type": "array", "items": { "type": "string" }, "nullable": true } }, "additionalProperties": false }, "TokenResponse": { "type": "object", "properties": { "id": { "title": "Id", "type": "string", "description": "", "nullable": true }, "address": { "title": "Address", "type": "string", "description": "", "nullable": true }, "decimals": { "title": "Decimals", "type": "integer", "description": "", "format": "int32", "nullable": true }, "name": { "title": "Name", "type": "string", "description": "", "nullable": true }, "symbol": { "title": "Symbol", "type": "string", "description": "", "nullable": true } }, "additionalProperties": false }, "TokenResponseIEnumerableInt32ValueTuple": { "type": "object", "properties": { "item1": { "type": "array", "items": { "$ref": "#/components/schemas/TokenResponse" }, "nullable": true }, "item2": { "type": "integer", "format": "int32" } }, "additionalProperties": false } }, "securitySchemes": { "Bearer": { "type": "apiKey", "description": "JWT Authorization header using the Bearer scheme. \r\n\r\n Enter 'Bearer' [space] and then your token in the text input below. \r\n\r\nExample: 'Bearer 12345abcdef'", "name": "Authorization", "in": "header" } } }, "security": [ { "Bearer": [] } ], "x-readme": { "explorer-enabled": true, "proxy-enabled": true } } ``` -------------------------------- ### initialize Source: https://docs.rayls.com/docs/raylserc721handler Initializes the RaylsErc721Handler contract, setting up the ERC721 metadata and RaylsApp configuration. This is intended for use with proxy contracts. ```APIDOC ## initialize ### Description Initializes the contract state, including ERC721 metadata and RaylsApp endpoint configuration. This method is designed for proxy contract compatibility. ### Parameters #### Request Body - **uri** (string) - Required - The URI for the ERC721 token. - **name_** (string) - Required - The name of the ERC721 token. - **symbol_** (string) - Required - The symbol of the ERC721 token. ``` -------------------------------- ### GET /api/transaction/{hash} Source: https://docs.rayls.com/reference/get_api-transaction-hash Retrieves the details of a specific transaction by its hash. ```APIDOC ## GET /api/transaction/{hash} ### Description Retrieves the details of a transaction based on the provided hash identifier. ### Method GET ### Endpoint /api/transaction/{hash} ### Parameters #### Path Parameters - **hash** (string) - Required - The unique hash identifier of the transaction. ### Response #### Success Response (200) - **id** (string) - The unique identifier of the wallet. - **type** (string) - The type of wallet (KEYSTORE_V3 or AWS_KMS). - **address** (string) - The wallet address. - **public_key** (string) - The public key associated with the wallet. #### Response Example { "id": "string", "type": "KEYSTORE_V3", "address": "string", "public_key": "string" } ``` -------------------------------- ### Initialize Privacy Ledger Source: https://docs.rayls.com/docs/rayls-privacy-ledger-installation-v1-7 Runs the initialization script within the container to set up the database and data structure. ```shell sudo docker run -it -v ~/rayls/data:/app/data --env MONGODB_CONN=$MONGODB_CONN --env MONGODB_DATABASE=$MONGODB_DATABASE --entrypoint /app/scripts/init.sh registry.parfin.io/rayls-privacy-ledger:v1.7.1 ``` -------------------------------- ### GET /api/token Source: https://docs.rayls.com/reference/get_api-token Retrieves a paginated list of tokens available in the system. ```APIDOC ## GET /api/token ### Description Retrieves a list of tokens with support for pagination. ### Method GET ### Endpoint /api/token ### Parameters #### Query Parameters - **page_number** (integer) - Optional - The page number to retrieve (default: 1). - **page_size** (integer) - Optional - The number of items per page (default: 100). ### Response #### Success Response (200) - **item1** (array) - A list of TokenResponse objects. - **item2** (integer) - Total count or metadata related to the collection. #### Response Example { "item1": [ { "id": "string", "address": "string", "decimals": 0, "name": "string", "symbol": "string" } ], "item2": 0 } ``` -------------------------------- ### GET /api/transaction/receipt/{hash} Source: https://docs.rayls.com/reference/get_api-transaction-receipt-hash Retrieves the receipt for a specific transaction using its hash. ```APIDOC ## GET /api/transaction/receipt/{hash} ### Description Retrieves the receipt for a specific transaction using its hash. ### Method GET ### Endpoint /api/transaction/receipt/{hash} ### Parameters #### Path Parameters - **hash** (string) - Required - The unique hash of the transaction. ### Response #### Success Response (200) - **id** (string) - The ID of the wallet. - **type** (WalletType) - The type of the wallet. - **address** (string) - The address of the wallet. - **public_key** (string) - The public key of the wallet. #### Response Example ```json { "id": "wallet-id-123", "type": "KEYSTORE_V3", "address": "0x123...", "public_key": "0xabc..." } ``` #### Error Response (400, 404, 500) - **message** (string) - Error message. - **detail** (string) - Detailed error information. - **timestamp** (string) - Timestamp of the error. - **path** (string) - Path of the request. - **errorCode** (string) - Specific error code. - **errors** (array of strings) - List of specific errors. #### Error Response Example ```json { "message": "Invalid hash format", "detail": "The provided hash is not a valid hexadecimal string.", "timestamp": "2023-10-27T10:00:00Z", "path": "/api/transaction/receipt/invalid_hash", "errorCode": "INVALID_INPUT", "errors": [] } ``` ``` -------------------------------- ### Initialize Proxy Contract Source: https://docs.rayls.com/docs/raylserc20handler Standard initialization method for proxy-based deployments to ensure contract state is updated correctly. ```solidity function initialize(string memory _name, string memory _symbol, uint8 decimals) public initializer { address _owner = _getOwnerAddressOnInitialize(); address _endpoint = _getEndpointAddressOnInitialize(); resourceId = _getResourceIdOnInitialize(); // ERC20 initizalization tokenName = _name; tokenSymbol = _symbol; decimals = decimals; // RaylsApp Initialization _transferOwnership(_owner); endpoint = IRaylsEndpoint(_endpoint); } ``` -------------------------------- ### Initiate Token Registration Request Source: https://docs.rayls.com/docs/registering-token-in-subnet Use the Hardhat CLI to submit a token registration request to the Private Network Operator. ```bash npx hardhat deployToken --pl --symbol ``` -------------------------------- ### Get Wallet By Id Source: https://docs.rayls.com/reference/get_api-wallet-id Retrieves wallet details using its unique identifier. ```APIDOC ## GET /api/wallet/{id} ### Description Retrieves wallet details by its unique identifier. ### Method GET ### Endpoint /api/wallet/{id} ### Parameters #### Path Parameters - **id** (string) - Required - The unique identifier of the wallet. ### Response #### Success Response (200) - **id** (string) - The unique identifier of the wallet. - **type** (WalletType) - The type of the wallet (e.g., KEYSTORE_V3, AWS_KMS). - **address** (string) - The wallet address. - **public_key** (string) - The public key associated with the wallet. #### Response Example ```json { "id": "a1b2c3d4-e5f6-7890-1234-567890abcdef", "type": "KEYSTORE_V3", "address": "0x1234567890abcdef1234567890abcdef12345678", "public_key": "0x04..." } ``` #### Error Response (400, 404, 500) - **message** (string) - Error message. - **detail** (string) - Detailed error information. - **timestamp** (string) - Timestamp of the error. - **path** (string) - Path of the request that caused the error. - **errorCode** (string) - Specific error code. - **errors** (array of strings) - List of specific errors. #### Error Response Example ```json { "message": "Invalid wallet ID format.", "detail": "The provided ID does not conform to the expected format.", "timestamp": "2023-10-27T10:00:00Z", "path": "/api/wallet/invalid-id", "errorCode": "INVALID_INPUT", "errors": [] } ``` ``` -------------------------------- ### GET /api/wallet/address/{address} Source: https://docs.rayls.com/reference/get_api-wallet-address-address Retrieves wallet information associated with a specific blockchain address. ```APIDOC ## GET /api/wallet/address/{address} ### Description Retrieves wallet information by providing a blockchain address. ### Method GET ### Endpoint /api/wallet/address/{address} #### Path Parameters - **address** (string) - Required - The blockchain address to query for wallet information. ### Request Example (No request body for GET requests) ### Response #### Success Response (200) - **id** (string) - The unique identifier of the wallet. - **type** (WalletType) - The type of the wallet (e.g., KEYSTORE_V3, AWS_KMS). - **address** (string) - The blockchain address associated with the wallet. - **public_key** (string) - The public key of the wallet. #### Response Example ```json { "id": "wallet-12345", "type": "KEYSTORE_V3", "address": "0x123...abc", "public_key": "0xabc...123" } ``` #### Error Response (400, 404, 500) - **message** (string) - A message describing the error. - **detail** (string) - Detailed information about the error. - **timestamp** (string) - The timestamp when the error occurred. - **path** (string) - The path that caused the error. - **errorCode** (string) - A specific error code. - **errors** (array of strings) - A list of specific errors. #### Error Response Example ```json { "message": "Invalid address format", "detail": "The provided address is not a valid Ethereum address.", "timestamp": "2023-10-27T10:00:00Z", "path": "/api/wallet/address/invalid_address", "errorCode": "INVALID_ADDRESS", "errors": [] } ``` ``` -------------------------------- ### GET /api/token/{id} Source: https://docs.rayls.com/reference/get_api-token-id Retrieves the details of a specific token using its unique ID. ```APIDOC ## GET /api/token/{id} ### Description Retrieves the details of a specific token using its unique ID. ### Method GET ### Endpoint /api/token/{id} ### Parameters #### Path Parameters - **id** (string) - Required - The unique identifier of the token. ### Response #### Success Response (200) - **id** (string) - The token ID. - **address** (string) - The token contract address. - **decimals** (integer) - The number of decimals for the token. - **name** (string) - The name of the token. - **symbol** (string) - The symbol of the token. #### Response Example { "id": "string", "address": "string", "decimals": 0, "name": "string", "symbol": "string" } ``` -------------------------------- ### Generate Token Initialization Parameters Source: https://docs.rayls.com/docs/raylserc1155handler Generates the parameters required for initializing the token, specifically for the 'initialize(string,string)' function signature, using the token's URI and name. ```Solidity function _generateInitializerParams() internal virtual view returns (bytes memory) { return abi.encodeWithSignature("initialize(string,string)", _uri, name); } ``` -------------------------------- ### Deploying with Hardhat Source: https://docs.rayls.com/docs/public-chain-reference Execute the deployment script using the configured rayls network. ```bash npx hardhat run scripts/deploy.js --network rayls ``` -------------------------------- ### Send Teleport Function Source: https://docs.rayls.com/docs/raylserc20handler Initiates a teleportation of ERC20 tokens. Requires setup with BridgedTransferMetadata. ```Solidity BridgedTransferMetadata memory transferMetadata = BridgedTransferMetadata({ assetType: RaylsBridgeableERC.ERC20, id: 0, from: from, to: to, amount: value }); sendTeleport( chainId, abi.encodeWithSignature("receiveTeleport(address,uint256)", to, value), bytes(""), bytes(""), bytes(""), transferMetadata ); return true; } ``` -------------------------------- ### Run Privacy Ledger in Background Source: https://docs.rayls.com/docs/rayls-privacy-ledger-installation-v1-7 Starts the container in detached mode using the -d flag. ```shell sudo docker run -v ~/rayls/data:/app/data -d --env MONGODB_CONN=$MONGODB_CONN --env MONGODB_DATABASE=$MONGODB_DATABASE -p 8545:8545 -p 8660:8660 registry.parfin.io/rayls-privacy-ledger:1.7.1 ``` -------------------------------- ### Generate Initializer Parameters Source: https://docs.rayls.com/docs/raylserc721handler Encodes initialization parameters for token deployment. ```solidity function _generateInitializerParams() internal view virtual returns (bytes memory) { return abi.encodeWithSignature("initialize(string,string,string)", _uri, _name, _symbol); } ``` -------------------------------- ### Generate Initializer Params Function Source: https://docs.rayls.com/docs/raylserc20handler Generates the initializer parameters for token creation, including name, symbol, and decimals. ```Solidity function _generateInitializerParams() internal view returns (bytes memory) { return abi.encodeWithSignature("initialize(string,string,uint8)", tokenName, tokenSymbol, decimals()); } ``` -------------------------------- ### Token Registration CLI Responses Source: https://docs.rayls.com/docs/registering-token-in-subnet Expected output when deploying a token or checking its registration status. ```text Deploying token on ... Token Deployed At Address Token Registration Submitted, wait until relayer retrieves the generated resource To check if it's registered, please use the following command: npx hardhat checkTokenResourceId --pl --token-address ``` ```text # IF TOKEN APPROVED Resource id is: # IF TOKEN APPROVAL PENDING No resource id generated! Wait until VEN Operator approves the token. ``` -------------------------------- ### GET getAddressByResourceId Source: https://docs.rayls.com/docs/raylsapp Retrieves the contract address associated with a specific resource ID from the Rayls endpoint. ```APIDOC ## GET getAddressByResourceId ### Description Retrieves the address of the implementation of the resource associated with the provided resourceId. ### Method GET ### Parameters #### Path Parameters - **_resourceId** (bytes32) - Required - The resourceId of the RaylsApp. ### Response #### Success Response (200) - **address** (address) - The address associated with the resourceId. ``` -------------------------------- ### Configure Environment Variables for Participant Addition Source: https://docs.rayls.com/docs/adding-new-participants Set the environment variables required for adding a new participant to the Rayls Private Network. Ensure all placeholder values are replaced with actual network and participant information. ```bash # Private Network Hub Info export PRIVATE_KEY_SYSTEM= export PARTICIPANT_STORAGE_ADDRESS= # Participant PL Info export PARTICIPANT_CHAIN_ID= export PARTICIPANT_NAME="Provided Participant Name" export PARTICIPANT_ROLE= ``` -------------------------------- ### Define RaylsErc20Handler Constructor Source: https://docs.rayls.com/docs/raylserc20handler Initializes the contract with token metadata, Rayls endpoint, and ownership settings. ```solidity abstract contract RaylsErc20Handler is RaylsApp, ERC20, Initializable, Ownable { string tokenName; string tokenSymbol; mapping(address => uint256) lockedAmount; /** * @dev Constructor to initialize the RaylsCore with the provided endpoint and owner. * @param _endpoint The address of the Rayls endpoint. * @param _owner The address of the owner of the RaylsCore. */ constructor(string memory _name, string memory _symbol, address _endpoint, address _owner) ERC20(_name, _symbol) RaylsApp(_endpoint) Ownable(_owner) { tokenName = _name; tokenSymbol = _symbol; _disableInitializers(); } // ... } ``` -------------------------------- ### RaylsErc721Handler Initialize Method Source: https://docs.rayls.com/docs/raylserc721handler Initializes the contract's ERC721 and RaylsApp properties. This method is used instead of the constructor for proxy contracts to ensure state is updated correctly. ```Solidity function initialize(string memory uri, string memory name_, string memory symbol_) public virtual initializer { address _owner = _getOwnerAddressOnInitialize(); address _endpoint = _getEndpointAddressOnInitialize(); resourceId = _getResourceIdOnInitialize(); // ERC721 initizalization _name = name_; _symbol = symbol_; _uri = uri; // RaylsApp Initialization _transferOwnership(_owner); endpoint = IRaylsEndpoint(_endpoint); } ``` -------------------------------- ### Last Token Approval Success Message Source: https://docs.rayls.com/docs/approving-new-tokens Example success message for approving the last pending token. ```bash ✅ The token "TokenName" (TokenSymbol) got approved! ``` -------------------------------- ### Create Data Directory Source: https://docs.rayls.com/docs/rayls-privacy-ledger-installation-v1-7 Creates a local directory to be used as a volume for container data persistence. ```shell mkdir -p ~/rayls/data ``` -------------------------------- ### OpenAPI definition for Transaction Receipt Source: https://docs.rayls.com/reference/get_api-transaction-receipt-hash Defines the GET /api/transaction/receipt/{hash} endpoint and associated data models. ```json { "openapi": "3.0.1", "info": { "title": "Parfin Custody HSM API", "description": "Responsible to create wallets, transactions and setup their configuration.", "version": "v1", "x-logo": { "url": "https://app.parfin.io/assets/images/icons/parfin-logo.svg", "altText": "Parfin API Logo" } }, "paths": { "/api/transaction/receipt/{hash}": { "get": { "tags": [ "Transaction" ], "summary": "Get Transaction Receipt By Id", "description": "", "parameters": [ { "name": "hash", "in": "path", "description": "", "required": true, "schema": { "type": "string" } } ], "responses": { "200": { "description": "OK", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/WalletResponse" } } } }, "400": { "description": "Bad Request", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ApiError" } } } }, "404": { "description": "Not Found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ApiError" } } } }, "500": { "description": "Server Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ApiError" } } } } } } } }, "components": { "schemas": { "ApiError": { "type": "object", "properties": { "message": { "type": "string", "nullable": true }, "detail": { "type": "string", "nullable": true }, "timestamp": { "type": "string", "format": "date-time" }, "path": { "type": "string", "nullable": true }, "errorCode": { "type": "string", "nullable": true }, "errors": { "type": "array", "items": { "type": "string" }, "nullable": true } }, "additionalProperties": false }, "WalletResponse": { "type": "object", "properties": { "id": { "title": "Id", "type": "string", "description": "", "nullable": true }, "type": { "$ref": "#/components/schemas/WalletType" }, "address": { "title": "Address", "type": "string", "description": "", "nullable": true }, "public_key": { "title": "PublicKey", "type": "string", "description": "", "nullable": true } }, "additionalProperties": false }, "WalletType": { "enum": [ "KEYSTORE_V3", "AWS_KMS" ], "type": "string" } }, "securitySchemes": { "Bearer": { "type": "apiKey", "description": "JWT Authorization header using the Bearer scheme. \\r\\n\\r\\n \n Enter 'Bearer' [space] and then your token in the text input below.\n \\r\\n\\r\\nExample: 'Bearer 12345abcdef'", "name": "Authorization", "in": "header" } } }, "security": [ { "Bearer": [] } ], "x-readme": { "explorer-enabled": true, "proxy-enabled": true } } ``` -------------------------------- ### List All Tokens and Statuses Source: https://docs.rayls.com/docs/approving-new-tokens Use this command to retrieve all tokens registered in the TokenRegistry and check their current statuses. Note their `resourceId` for pending tokens. ```bash npx hardhat getAllTokens --rpc-url --contract-address ``` -------------------------------- ### RaylsErc1155Handler Initialize Source: https://docs.rayls.com/docs/raylserc1155handler Initializes the contract state, typically used for proxy contracts. ```APIDOC ## Initialize RaylsErc1155Handler ### Description Initializes the contract state, including URI and name, and sets up the RaylsApp endpoint. This method is designed for use with proxy contracts. ### Method `initialize` ### Endpoint N/A (Internal function for proxy initialization) ### Parameters - **uri** (string) - The URI for the ERC1155 token. - **_name** (string) - The name of the ERC1155 token. ### Request Example ```solidity function initialize( string memory uri, string memory _name ) public virtual initializer ``` ### Response Example N/A (Initializes state) ``` -------------------------------- ### Get Wallet List Source: https://docs.rayls.com/reference/get_api-wallet Retrieves a list of wallets associated with the user's account. Supports pagination. ```APIDOC ## GET /api/wallet ### Description Retrieves a list of wallets. Supports pagination with `page_number` and `page_size` query parameters. ### Method GET ### Endpoint /api/wallet ### Parameters #### Query Parameters - **page_number** (integer) - Optional - The page number to retrieve. Defaults to 1. - **page_size** (integer) - Optional - The number of items per page. Defaults to 100. ### Response #### Success Response (200) - **item1** (array) - A list of WalletResponse objects. - **id** (string) - The unique identifier of the wallet. - **type** (WalletType) - The type of the wallet (e.g., KEYSTORE_V3, AWS_KMS). - **address** (string) - The wallet address. - **public_key** (string) - The public key associated with the wallet. - **item2** (integer) - The total count of wallets. #### Error Response (400, 404, 500) - **message** (string) - Error message. - **detail** (string) - Detailed error information. - **timestamp** (string) - Timestamp of the error. - **path** (string) - The endpoint path where the error occurred. - **errorCode** (string) - Specific error code. - **errors** (array) - A list of specific errors. ### Response Example ```json { "item1": [ { "id": "some-wallet-id", "type": "KEYSTORE_V3", "address": "0x123...", "public_key": "0xabc..." } ], "item2": 10 } ``` ``` -------------------------------- ### GET /api/token/{id}/balance/{walletId} Source: https://docs.rayls.com/reference/get_api-token-id-balance-walletid Retrieves the balance information for a specific token associated with a wallet. ```APIDOC ## GET /api/token/{id}/balance/{walletId} ### Description Retrieves the balance of a specific token identified by {id} for the wallet identified by {walletId}. ### Method GET ### Endpoint /api/token/{id}/balance/{walletId} ### Parameters #### Path Parameters - **id** (string) - Required - The unique identifier of the token. - **walletId** (string) - Required - The unique identifier of the wallet. ### Response #### Success Response (200) - **item1** (array) - A list of TokenResponse objects. - **item2** (integer) - An integer value representing the balance or related count. #### Error Responses - **400** (Bad Request) - Returned when the request parameters are invalid. - **404** (Not Found) - Returned when the token or wallet does not exist. - **500** (Server Error) - Returned when an internal server error occurs. ``` -------------------------------- ### Implement RaylsApp Contract Source: https://docs.rayls.com/docs/cross-chain-transactions Basic implementation of a contract inheriting from RaylsApp. Requires the endpoint address during deployment. ```solidity // SPDX-License-Identifier: MIT pragma solidity ^0.8.20; import {RaylsApp} from "@rayls/contracts/RaylsApp.sol"; contract HelloWorldContract is RaylsApp { constructor( address _endpoint ) RaylsApp(_endpoint, msg.sender) {} } ``` -------------------------------- ### Initialize Rayls Privacy Ledger Source: https://docs.rayls.com/docs/rayls-privacy-ledger-installation-v1-7 Initializes the ledger data directory using the specified genesis file and MongoDB connection settings. ```bash #!/bin/bash /app/rayls-privacy-ledger init --datadir /app/data --db.engine mongodb --db.engine.host $MONGODB_CONN --db.engine.name=$MONGODB_DATABASE /app/var/genesis.json ``` -------------------------------- ### OpenAPI Definition for Get Token By Id Source: https://docs.rayls.com/reference/get_api-token-id This OpenAPI 3.0.1 definition describes the 'Get Token By Id' endpoint. It specifies the request parameters, including the token ID, and the possible responses, such as a successful token retrieval (200 OK) or various error codes (400, 404, 500). It also defines the schemas for the token response and API errors, and outlines the security scheme using Bearer token authentication. ```json { "openapi": "3.0.1", "info": { "title": "Parfin Custody HSM API", "description": "Responsible to create wallets, transactions and setup their configuration.", "version": "v1", "x-logo": { "url": "https://app.parfin.io/assets/images/icons/parfin-logo.svg", "altText": "Parfin API Logo" } }, "paths": { "/api/token/{id}": { "get": { "tags": [ "Token" ], "summary": "Get Token By Id", "description": "", "parameters": [ { "name": "id", "in": "path", "description": "", "required": true, "schema": { "type": "string" } } ], "responses": { "200": { "description": "OK", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/TokenResponse" } } } }, "400": { "description": "Bad Request", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ApiError" } } } }, "404": { "description": "Not Found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ApiError" } } } }, "500": { "description": "Server Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ApiError" } } } } } } } }, "components": { "schemas": { "ApiError": { "type": "object", "properties": { "message": { "type": "string", "nullable": true }, "detail": { "type": "string", "nullable": true }, "timestamp": { "type": "string", "format": "date-time" }, "path": { "type": "string", "nullable": true }, "errorCode": { "type": "string", "nullable": true }, "errors": { "type": "array", "items": { "type": "string" }, "nullable": true } }, "additionalProperties": false }, "TokenResponse": { "type": "object", "properties": { "id": { "title": "Id", "type": "string", "description": "", "nullable": true }, "address": { "title": "Address", "type": "string", "description": "", "nullable": true }, "decimals": { "title": "Decimals", "type": "integer", "description": "", "format": "int32", "nullable": true }, "name": { "title": "Name", "type": "string", "description": "", "nullable": true }, "symbol": { "title": "Symbol", "type": "string", "description": "", "nullable": true } }, "additionalProperties": false } }, "securitySchemes": { "Bearer": { "type": "apiKey", "description": "JWT Authorization header using the Bearer scheme. \r\n\r\n Enter 'Bearer' [space] and then your token in the text input below. \r\n\r\nExample: 'Bearer 12345abcdef'", "name": "Authorization", "in": "header" } } }, "security": [ { "Bearer": [] } ], "x-readme": { "explorer-enabled": true, "proxy-enabled": true } } ``` -------------------------------- ### Transfer Token via Rayls Custody API Source: https://docs.rayls.com/docs/sending-internal-transactions Example request and response for transferring tokens using the Rayls Custody Light API. ```http POST Content-Type: application/json Authorization: Bearer { "from": "", "to": "", "token": "", "value": "1000000000000000000" } ``` ```json { "transactionHash": "", "status": "pending" } ```