11import { SiweMessage } from 'siwe' ;
22
3- import {
4- CapacityDelegationFields ,
5- CapacityDelegationRequest ,
6- ILitNodeClient ,
7- LitResourceAbilityRequest ,
8- } from '@lit-protocol/types' ;
3+ import { ILitNodeClient , LitResourceAbilityRequest } from '@lit-protocol/types' ;
94
105/**
116 * Sanitizes a SIWE message by unescaping double-escaped newlines and replacing escaped double quotes with single quotes.
@@ -21,27 +16,6 @@ export function sanitizeSiweMessage(message: string): string {
2116 return sanitizedMessage ;
2217}
2318
24- /**
25- * Creates the resource data for a capacity delegation request.
26- * @param params - The capacity delegation fields.
27- * @returns The capacity delegation request object.
28- */
29- export const createCapacityCreditsResourceData = (
30- params : CapacityDelegationFields
31- ) : CapacityDelegationRequest => {
32- return {
33- ...( params . capacityTokenId ? { nft_id : [ params . capacityTokenId ] } : { } ) , // Conditionally include nft_id
34- ...( params . delegateeAddresses
35- ? {
36- delegate_to : params . delegateeAddresses . map ( ( address ) =>
37- address . startsWith ( '0x' ) ? address . slice ( 2 ) : address
38- ) ,
39- }
40- : { } ) ,
41- ...( params . uses !== undefined ? { uses : params . uses . toString ( ) } : { } ) ,
42- } ;
43- } ;
44-
4519/**
4620 * Adds recap capabilities to a SiweMessage.
4721 * @param siweMessage - The SiweMessage to add recap capabilities to.
0 commit comments