Build Signature
Overview
This SDK method allows you to build a signature for either typed data or a message using a smart account. This is useful for creating a valid signature that can be used for authentication or transaction purposes.
Method
xellar.accountAbstraction.signature.buildSignature({
accountId: string,
signature: string,
typedData?: {
domain: {
name: string,
version: string,
chainId: number,
verifyingContract: string
},
types: {
[key: string]: Array<{
name: string,
type: string
}>
},
primaryType: string,
message: Record<string, any>
}
});
Parameters
accountId
(required): The unique identifier of the smart account.signature
(required): The initial signature to be used in the building process.typedData
(optional): The structured data to be signed, following the EIP-712 standard. If not provided, the signature will be built for a message.
Example Request
With Typed Data
const response = await xellar.accountAbstraction.signature.buildSignature({
accountId: "67b1f9310521667c3e94d625",
signature:
"0xd32432583645f69b7ef2f38dbfe6d9dc9a99fc0949222a8a6c37645bb5ae2eff646e193c6970ecab6b7e63e81fdc6546f146eda932b78d8f41b869524d4238ec00",
typedData: {
domain: {
name: "EIP712Domain",
version: "1",
chainId: 11155111,
verifyingContract: "0x5CCB14a189684CbFB2B0f41Ef5594ac7BC80796A",
},
types: {
Person: [
{
name: "name",
type: "string",
},
{
name: "wallet",
type: "address",
},
],
},
primaryType: "Person",
message: {
name: "John Doe",
wallet: "0x5FbDB2315678afecb367f032d93F642f64180aa3",
},
},
});
Without Typed Data (For Message)
const response = await xellar.accountAbstraction.signature.buildSignature({
accountId: "67b1f9310521667c3e94d625",
signature:
"0xd32432583645f69b7ef2f38dbfe6d9dc9a99fc0949222a8a6c37645bb5ae2eff646e193c6970ecab6b7e63e81fdc6546f146eda932b78d8f41b869524d4238ec00",
});
Response
The response will include a JSON object with the following properties:
status
(number): The HTTP status code of the response (e.g., 200 for success).message
(string): A message indicating the result of the operation.data
(object): An object containing the built signature.
Example Response
{
"status": 200,
"message": "success build signature",
"data": {
"signature": "0xaff553a9ed1fc3ec1806456474b7c480cf7fcbdc4c37eba6aee2704a663568a477feae8d22a259a03677196608eca6d6d4edea5e9b77da7f43ebc115dbd055551b"
}
}