Virtual Currencies Use off-chain Virtual Currency to enable support for fiat and custom off-chain tokens.
Deploy new Virtual Currency
To deploy new Virtual Currency you need to define unique name, inital supply, base currency and rate.
cURL
Copy echo 'Issue new virtual currency named MY_USD'
curl --location --request POST 'https://api.orangepill.cloud/v1/currencies \
--header ' x-api-key: AXVubzpwQDU1dzByYM== ' \
--header ' idempotency-key: 27373fabc392933deffdb ' \
--header ' Content-Type: application/json ' \
--data-raw ' {
"name" : "MY_USD" ,
"supply" : "1000" ,
"base" : "USD" ,
"rate" : "1" ,
"currency" : "USD"
"symbol" : "$" ,
"symbol_url" : "https://my-cdn.com/my-dollar-sign.svg" ,
"sub_unit" : [ "cent" , "cents" ],
}'
In response you will receive new Virtual Currency with reference to newly created Account with supply issued.
Copy {
"id" : "63a52711fc21ce5d7b34d9f5" ,
"name" : "MY_USD" ,
"supply" : "1000" ,
"base" : "USD" ,
"rate" : 1 ,
"country" : "US" ,
"currency" : "USD" ,
"owner" : "639675ab191e9023f356dfa6" ,
"created_at" : 1671767825114 ,
"active" : true ,
"deleted" : false ,
"account" : "63a52711fc21ce5d7b34d9f6" ,
"symbol" : "$" ,
"symbol_url" : "https://my-cdn.com/my-dollar-sign.svg" ,
"sub_unit" : [ "cent" , "cents" ] ,
}
Issue new supply
New supply can be issued on account holding Virtual Currency.
cURL
Copy echo 'Issue new supply for virtual currency with id 63a52711fc21ce5d7b34d9f5'
curl --location --request POST 'https://api.orangepill.cloud/v1/currencies/63a52711fc21ce5d7b34d9f5/issue \
--header ' x-api-key: AXVubzpwQDU1dzByYM== ' \
--header ' idempotency-key: 27373fabc392933deffdb ' \
--header ' Content-Type: application/json ' \
--data-raw ' {
"account" : "63a633e84ab7d02420b732ae" ,
"amount" : "520.35"
}'
In response you will get Virttual Currency details with list of issue and destroy operations in object issuing
.
Copy {
"id" : "63a633e84ab7d02420b732ad" ,
"name" : "MY_USD" ,
"supply" : "1000" ,
"base" : "USD" ,
"rate" : 1 ,
"country" : "US" ,
"currency" : "USD" ,
"account" : "63a633e84ab7d02420b732ae" ,
"issuing" : [
{
"operation" : "issue" ,
"amount" : "520.35" ,
"account" : "63a633e84ab7d02420b732ae" ,
"reference" : "63a633e8210e23efb8e2837f"
}
] ,
"owner" : "639675ab191e9023f356dfa6" ,
"created_at" : 1671836648605 ,
"updated_at" : 1671836888327 ,
"active" : true ,
"deleted" : false
}
Destroy a supply
You can destroy total supply of Virtual Currency on Account.
cURL
Copy echo 'Destroy supply for virtual currency with id 63a52711fc21ce5d7b34d9f5'
curl --location --request POST 'https://api.orangepill.cloud/v1/currencies/63a52711fc21ce5d7b34d9f5/destroy \
--header ' x-api-key: AXVubzpwQDU1dzByYM== ' \
--header ' idempotency-key: 27373fabc392933deffdb ' \
--header ' Content-Type: application/json ' \
--data-raw ' {
"account" : "63a633e84ab7d02420b732ae" ,
"amount" : "100"
}'
In response you will get Virtual Currency details with list of issue and destroy operations in object issuing
.
Copy {
"id" : "63a633e84ab7d02420b732ad" ,
"name" : "MY_USD" ,
"supply" : "1000" ,
"base" : "USD" ,
"rate" : 1 ,
"country" : "US" ,
"currency" : "USD" ,
"account" : "63a633e84ab7d02420b732ae" ,
"issuing" : [
{
"operation" : "issue" ,
"amount" : "520.35" ,
"account" : "63a633e84ab7d02420b732ae" ,
"reference" : "63a633e8210e23efb8e2837f"
} ,
{
"operation" : "destroy" ,
"amount" : "100" ,
"account" : "63a633e84ab7d02420b732ae" ,
"reference" : "6461b9d5-a813-4b90-93b2-f5ad510a9eb5"
}
] ,
"owner" : "639675ab191e9023f356dfa6" ,
"created_at" : 1671836648605 ,
"updated_at" : 1671836888327 ,
"active" : true ,
"deleted" : false
}
Last updated 3 months ago