@@ -16,11 +16,13 @@ export type ClaimCollection = {
1616 invalidated : number ;
1717 state : number ;
1818 payments : any ; // JSON
19+ escrowAccount ?: string ;
20+ intents ?: number ;
1921} ;
2022
2123const createClaimCollectionSql = `
22- INSERT INTO "public"."ClaimCollection" ( "id", "entity", "admin", "protocol", "startDate", "endDate", "quota", "count", "evaluated", "approved", "rejected", "disputed", "invalidated", "state", "payments")
23- VALUES ( $1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15 );
24+ INSERT INTO "public"."ClaimCollection" ( "id", "entity", "admin", "protocol", "startDate", "endDate", "quota", "count", "evaluated", "approved", "rejected", "disputed", "invalidated", "state", "payments", "escrowAccount", "intents" )
25+ VALUES ( $1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17 );
2426` ;
2527export const createClaimCollection = async (
2628 p : ClaimCollection
@@ -41,6 +43,8 @@ export const createClaimCollection = async (
4143 p . invalidated ,
4244 p . state ,
4345 JSON . stringify ( p . payments ) ,
46+ p . escrowAccount ,
47+ p . intents ,
4448 ] ) ;
4549} ;
4650
@@ -59,9 +63,11 @@ UPDATE "public"."ClaimCollection" SET
5963 "disputed" = $11,
6064 "invalidated" = $12,
6165 "state" = $13,
62- "payments" = $14
66+ "payments" = $14,
67+ "escrowAccount" = $15,
68+ "intents" = $16
6369WHERE
64- "id" = $15 ;
70+ "id" = $17 ;
6571` ;
6672export const updateClaimCollection = async (
6773 p : ClaimCollection
@@ -81,6 +87,8 @@ export const updateClaimCollection = async (
8187 p . invalidated ,
8288 p . state ,
8389 JSON . stringify ( p . payments ) ,
90+ p . escrowAccount ,
91+ p . intents ,
8492 p . id ,
8593 ] ) ;
8694} ;
@@ -94,11 +102,16 @@ export type Claim = {
94102 schemaType ?: string ;
95103 collectionId : string ;
96104 evaluation ?: Evaluation ;
105+ useIntent ?: boolean ;
106+ amount ?: any ; // JSON
107+ cw20Payment ?: any ; // JSON
108+ cw1155Payment ?: any ; // JSON
109+ cw1155IntentPayment ?: any ; // JSON
97110} ;
98111
99112const createClaimSql = `
100- INSERT INTO "public"."Claim" ( "claimId", "agentDid", "agentAddress", "submissionDate", "paymentsStatus", "schemaType", "collectionId")
101- VALUES ( $1, $2, $3, $4, $5, $6, $7 );
113+ INSERT INTO "public"."Claim" ( "claimId", "agentDid", "agentAddress", "submissionDate", "paymentsStatus", "schemaType", "collectionId", "useIntent", "amount", "cw20Payment", "cw1155Payment", "cw1155IntentPayment" )
114+ VALUES ( $1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12 );
102115` ;
103116export const createClaim = async ( p : Claim ) : Promise < void > => {
104117 await dbQuery ( createClaimSql , [
@@ -109,6 +122,11 @@ export const createClaim = async (p: Claim): Promise<void> => {
109122 JSON . stringify ( p . paymentsStatus ) ,
110123 p . schemaType ,
111124 p . collectionId ,
125+ p . useIntent ,
126+ p . amount ? JSON . stringify ( p . amount ) : null ,
127+ p . cw20Payment ? JSON . stringify ( p . cw20Payment ) : null ,
128+ p . cw1155Payment ? JSON . stringify ( p . cw1155Payment ) : null ,
129+ p . cw1155IntentPayment ? JSON . stringify ( p . cw1155IntentPayment ) : null ,
112130 ] ) ;
113131} ;
114132
@@ -119,9 +137,14 @@ UPDATE "public"."Claim" SET
119137 "submissionDate" = $3,
120138 "paymentsStatus" = $4,
121139 "schemaType" = $5,
122- "collectionId" = $6
140+ "collectionId" = $6,
141+ "useIntent" = $7,
142+ "amount" = $8,
143+ "cw20Payment" = $9,
144+ "cw1155Payment" = $10,
145+ "cw1155IntentPayment" = $11
123146WHERE
124- "claimId" = $7 ;
147+ "claimId" = $12 ;
125148` ;
126149export const updateClaim = async ( p : Claim ) : Promise < void > => {
127150 await dbQuery ( updateClaimSql , [
@@ -131,6 +154,11 @@ export const updateClaim = async (p: Claim): Promise<void> => {
131154 JSON . stringify ( p . paymentsStatus ) ,
132155 p . schemaType ,
133156 p . collectionId ,
157+ p . useIntent ,
158+ p . amount ? JSON . stringify ( p . amount ) : null ,
159+ p . cw20Payment ? JSON . stringify ( p . cw20Payment ) : null ,
160+ p . cw1155Payment ? JSON . stringify ( p . cw1155Payment ) : null ,
161+ p . cw1155IntentPayment ? JSON . stringify ( p . cw1155IntentPayment ) : null ,
134162 p . claimId ,
135163 ] ) ;
136164
@@ -146,6 +174,15 @@ export const updateClaim = async (p: Claim): Promise<void> => {
146174 JSON . stringify ( p . evaluation . amount ) ,
147175 p . evaluation . evaluationDate ,
148176 p . evaluation . claimId ,
177+ p . evaluation . cw20Payment
178+ ? JSON . stringify ( p . evaluation . cw20Payment )
179+ : null ,
180+ p . evaluation . cw1155Payment
181+ ? JSON . stringify ( p . evaluation . cw1155Payment )
182+ : null ,
183+ p . evaluation . cw1155IntentPayment
184+ ? JSON . stringify ( p . evaluation . cw1155IntentPayment )
185+ : null ,
149186 ] ) ;
150187 }
151188} ;
@@ -161,11 +198,14 @@ export type Evaluation = {
161198 amount : any ; // JSON
162199 evaluationDate : Date ;
163200 claimId : string ;
201+ cw20Payment ?: any ; // JSON
202+ cw1155Payment ?: any ; // JSON
203+ cw1155IntentPayment ?: any ; // JSON
164204} ;
165205
166206const upsertEvaluationSql = `
167- INSERT INTO "public"."Evaluation" ( "collectionId", "oracle", "agentDid", "agentAddress", "status", "reason", "verificationProof", "amount", "evaluationDate", "claimId")
168- VALUES ( $1, $2, $3, $4, $5, $6, $7, $8, $9, $10 )
207+ INSERT INTO "public"."Evaluation" ( "collectionId", "oracle", "agentDid", "agentAddress", "status", "reason", "verificationProof", "amount", "evaluationDate", "claimId", "cw20Payment", "cw1155Payment", "cw1155IntentPayment" )
208+ VALUES ( $1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13 )
169209ON CONFLICT("claimId") DO UPDATE SET
170210 "collectionId" = EXCLUDED."collectionId",
171211 "oracle" = EXCLUDED."oracle",
@@ -175,7 +215,10 @@ ON CONFLICT("claimId") DO UPDATE SET
175215 "reason" = EXCLUDED."reason",
176216 "verificationProof" = EXCLUDED."verificationProof",
177217 "amount" = EXCLUDED."amount",
178- "evaluationDate" = EXCLUDED."evaluationDate"
218+ "evaluationDate" = EXCLUDED."evaluationDate",
219+ "cw20Payment" = EXCLUDED."cw20Payment",
220+ "cw1155Payment" = EXCLUDED."cw1155Payment",
221+ "cw1155IntentPayment" = EXCLUDED."cw1155IntentPayment"
179222WHERE "Evaluation"."claimId" = EXCLUDED."claimId";
180223` ;
181224
0 commit comments