register
API details
Register a Hibit Chain identity for any wallet across chains. This API enables seamless integration with all-chain wallets supported by Hibit Chain.
Body
chainstringOptional
chainNetworkstring | nullableOptional
messagestring | nullableOptional
signaturestring | nullableOptional
Responses
200
OK
400
Bad Request
401
Unauthorized
403
Forbidden
404
Not Found
500
Internal Server Error
501
Not Implemented
post
POST /v1/wallet/register HTTP/1.1
Host: testnetopenapi.hibit.app
Content-Type: application/json
Accept: */*
Content-Length: 74
{
"chain": "text",
"chainNetwork": "text",
"message": "text",
"signature": "text"
}
{
"code": 1,
"message": "text",
"data": {}
}
Code example
import { hibitClient, Chain, WalletSignatureSchema, HibitNetwork, WalletRegisterInput } from '@delandlabs/hibit-sdk';
import { MyWalletApi } from './my-wallet-api'; // Your IWalletApi implementation
// Set client options
hibitClient.setOptions({
network: HibitNetwork.Testnet
});
// Set your wallet API implementation
// IWalletApi is required for signing messages with your source chain wallet
hibitClient.setWalletApi(new MyWalletApi());
// Prepare wallet registration input
const walletRegisterInput: WalletRegisterInput = {
chain: Chain.Ethereum,
publicKey: 'your wallet public key in hex',
signatureSchema: WalletSignatureSchema.EvmEcdsa
};
// Example wallet registration message generated by IWalletApi:
// subject: wallet registration
// chain: 0x3c
// sign_schema: 0x1
// pub_key: 0xyour_wallet_public_key_in_hex
await hibitClient.walletRegister(walletRegisterInput)
console.log('Wallet registered successfully');
SDK
Source code https://github.com/Deland-Labs/hibit-sdk
Example
https://hibit-sdk-example.hibit.app/
References
Last updated