TypeScript
Description
Only registered partners can use this feature. Anyone who have not yet registered can test on the testnet using the private key provided in the sample code.
This functionality is used to provide points. First, deposit more than 100,000 tokens through the app. Then, contact the system operations team to register as a partner. You must register within your app first. Also, if you register the agent's address, you do not need to provide the private key of the wallet holding the assets.
Development and Operation
Follow the steps below to proceed:
Development and Testing:
Install the user app and set the network to TestNet. Select "Import Wallet" and use the following wallet's private key: 0x70438bc3ed02b5e4b76d496625cb7c06d6b7bf4362295b16fdfe91a046d4586c
Review the test code and implement the necessary functions. When creating a ProviderClient for the property owner, use the private key from step 1.
When creating a ProviderClient for your agent, use this wallet's private key: 0x44868157d6d3524eb64c6ae41ee6c879d03c19a357ddb038fea30e23cbab
For the point recipient's wallet address, use: 0xB6f69F0e9e70034ba0578C542476c13eF739269 If you have installed another user app, you can test using the wallet address from that app and your phone number.
Note: The store ID on TestNet starts with "0x0001".
Switching to Mainnet
The property owner's account is managed by the company's representative or accounting team.
The agent's account is managed by the development team.
The property owner will install the app for you; please select MainNet for the network.
The address of the wallet created by the property owner in step 1 should be forwarded to the KIOS Operations Team.
The development team provides the agent's wallet address to the asset owner. The development team may use a wallet address generated by MetaMask as the agent's wallet address.
The property owner registers the agent's wallet address in the user app.
Asset owners can deposit and withdraw funds.
Agents handle only tasks related to point payments, and the history of point payments is provided to the property owner's app.
Caution
Both testnet and mainnet are always active, so ensure the system can handle both networks in the future.
If the store ID of the POS or KIOSK starts with "0x0003", use testnet information for ProviderClient. If the store ID starts with "0x0004", use mainnet information.
SMS functionality is available only in Korea.
SDK
Sample Code
https://github.com/kios-coin/kios-service-sdk/blob/v0.x.x/typescript/tests/ProviderClient.test.ts
1. Create Client for provide without agent
If the agent is not used, the private key of the provider in which the asset is stored should be provided to the development team
const providerClient = new ProviderClient(
NetWorkType.kios_testnet
"0x70438bc3ed02b5e4b76d496625cb7c06d6b7bf4362295b16fdfe91a046d4586c" // address: 0x64D111eA9763c93a003cef491941A011B8df5a49
);
2. Provide to wallet address without agent
If the user's wallet address is known, points are paid to the account mapped to the wallet address.
const receiver = "0xB6f69F0e9e70034ba0578C542476cC13eF739269";
const amount = BOACoin.make(100).value;
await providerClient.provideToAddress(providerClient.address, receiver, amount);
3. Provide to phone number hash without agent
If you know the user's phone number, points are given to the account mapped to the hash in the phone number.
const phoneNumber = "+82 10-9000-5000";
const amount = BOACoin.make(100).value;
await providerClient.provideToPhone(providerClient.address, phoneNumber, amount);
4. Create Client for provide with agent
With agent, you only need to provide the address of the provider to the development team.
const providerAddress = "0x64D111eA9763c93a003cef491941A011B8df5a49";
const agentClient = new ProviderClient(
NetWorkType.kios_testnet,
"0x44868157d6d3524beb64c6ae41ee6c879d03c19a357dadb038fefea30e23cbab" // address: 0x3FE8D00143bd0eAd2397D48ba0E31E5E1268dBfb
);
5. Provide to wallet address with agent
const providerAddress = "0x64D111eA9763c93a003cef491941A011B8df5a49";
const receiver = "0xB6f69F0e9e70034ba0578C542476cC13eF739269";
const amount = BOACoin.make(100).value;
await agentClient.provideToAddress(providerAddress, receiver, amount);
6. Provide to phone number hash with agent
const providerAddress = "0x64D111eA9763c93a003cef491941A011B8df5a49";
const phoneNumber = "+82 10-9000-5000";
const amount = BOACoin.make(100).value;
await agentClient.provideToPhone(prviderAddress, phoneNumber, amount);
Last updated