After the withdrawal transaction, the create_tx
service is called. Then, information about this transaction is sent to the Defy interface. After reviewing this transaction, it is accepted or rejected. If rejected, the transaction ends here. If accepted, we handle all communication with the exchange to which the money was sent.
After all the transactions in between are completed, we specify that you start the on-chain transactions via the webhook you sent to us. You also send the transaction hash information with the send_tx
service. We also send this information to the other exchange. Thus, the travel rule actions where the money is sent are completed.
Create Transaction Service
Copy const axios = require ( 'axios' );
let data = JSON .stringify ({
"transaction_ref" : "a4de3f3f-668f-4844-995a-03ad1b73a54d" ,
"transaction_asset" : "ETH" ,
"transaction_amount" : "2000000000" ,
"transaction_asset_decimals" : "18" ,
"originator_vasp_id" : "adbacc97-6f65-49e8-b746-5699e1c3abd7" ,
"beneficiary_vasp_id" : "573f97ad-831d-4563-96a1-117256d3705d" ,
"originator" : {
"wallet_address" : "0x1d0d2d8c85441050abc9eb654399fa198fbd5722" ,
"persons" : [
{
"naturalPerson" : {
"name" : {
"nameIdentifier" : [
{
"primaryIdentifier" : "Post" ,
"secondaryIdentifier" : "Johnny" ,
"nameIdentifierType" : "LEGL"
}
]
} ,
"geographicAddress" : [
{
"addressType" : "GEOG" ,
"streetName" : "Potential Street" ,
"buildingNumber" : "123" ,
"buildingName" : "Cheese Hut" ,
"postCode" : "91361" ,
"townName" : "Thousand Oaks" ,
"countrySubDivision" : "California" ,
"country" : "US"
}
] ,
"customerIdentification" : "1002390"
}
}
]
} ,
"beneficiary" : {
"wallet_address" : "0x1d0d2d8c85441050abc9eb654399fa198fbd5722" ,
"persons" : [
{
"naturalPerson" : {
"name" : {
"nameIdentifier" : [
{
"primaryIdentifier" : "MachuPichu" ,
"secondaryIdentifier" : "Freddie" ,
"nameIdentifierType" : "LEGL"
}
]
}
}
}
]
}
});
let config = {
method : 'post' ,
maxBodyLength : Infinity ,
url : 'https://api.getdefy.co/v2/travelrule/create_tx' ,
headers : {
'Content-Type' : 'application/json' ,
'apikey' : 'demo'
} ,
data : data
};
axios .request (config)
.then ((response) => {
console .log ( JSON .stringify ( response .data));
})
.catch ((error) => {
console .log (error);
});
If everything is okay that service response will be like that.
Copy {
"code" : 0 ,
"message" : "OK" ,
"data" : "PENDING"
}
Send Transaction Hash
Copy const axios = require ( 'axios' );
let data = JSON .stringify ({
"transaction_ref" : "a4de3f3f-668f-4844-995a-03ad1b73a54d" ,
"transaction_hash" : "0xETH"
});
let config = {
method : 'post' ,
maxBodyLength : Infinity ,
url : 'https://test.getdefy.co/v2/travelrule/send_tx_hash' ,
headers : {
'Content-Type' : 'application/json' ,
'apikey' : '••••••'
} ,
data : data
};
axios .request (config)
.then ((response) => {
console .log ( JSON .stringify ( response .data));
})
.catch ((error) => {
console .log (error);
});
If everything is okay that service response will be like that.
Copy {
"code" : 0 ,
"message" : "OK" ,
"data" : null
}
List Available VASPs
Copy const axios = require ( 'axios' );
let config = {
method : 'get' ,
url : 'https://api.getdefy.co/v2/travelrule/list_vasps?page=1&limit=10' ,
headers : {
'apikey' : 'demo'
}
};
axios .request (config)
.then ((response) => {
console .log ( JSON .stringify ( response .data));
})
.catch ((error) => {
console .log (error);
});
If everything is okay that service response will be like that.
Copy {
"code" : 0 ,
"message" : "OK" ,
"data" : [
{
"id" : "3" ,
"uid" : "573f97ad-831d-4563-96a1-117256d3705d" ,
"legal_name" : "Vasp B" ,
"lei" : "654321" ,
"country" : "TR" ,
"url" : "https://vaspb.net" ,
"email" : "support@vaspb.net" ,
"tr_url" : "https://webhook.site/69a7d6e0-3af4-491d-b190-37e5fe370bc6" ,
"created_at" : "2025-01-16T10:10:34.780Z" ,
"updated_at" : "2025-01-16T10:10:34.780Z"
} ,
{
"id" : "2" ,
"uid" : "adbacc97-6f65-49e8-b746-5699e1c3abd7" ,
"legal_name" : "Vasp A" ,
"lei" : "123456" ,
"country" : "TR" ,
"url" : "https://vaspa.net" ,
"email" : "support@vaspa.net" ,
"tr_url" : "https://api.vaspa.net" ,
"created_at" : "2025-01-16T10:09:46.192Z" ,
"updated_at" : "2025-01-16T10:09:46.192Z"
}
] ,
"page_count" : 1
}