Skip to content

Commit d89cfc6

Browse files
Fix InsumerAPI response shapes, chain count, and add XRPL support
- Base URL: Cloud Functions → api.insumermodel.com - Attestation: allMet→pass, conditions→results, add missing fields (condition, type, evaluatedCondition, conditionHash, passCount, failCount) - Test fixture: ATT-→ATST- ID format, allMet→pass, conditions→results - Chain count: 31→32 (30 EVM + Solana + XRPL) - Schemas: add xrplWallet param to verify/trust/batch, add format:"jwt" to verify - Types: add jwt field, ledgerIndex, evaluatedCondition to AttestationData Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 9071688 commit d89cfc6

6 files changed

Lines changed: 49 additions & 24 deletions

File tree

typescript/agentkit/src/action-providers/insumer/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Insumer Action Provider
22

3-
This directory contains the InsumerAPI action provider implementation, which provides actions for privacy-preserving on-chain wallet verification, trust profiling, and discount code validation across 31 EVM chains and Solana.
3+
This directory contains the InsumerAPI action provider implementation, which provides actions for privacy-preserving on-chain wallet verification, trust profiling, and discount code validation across 32 chains (30 EVM + Solana + XRPL).
44

55
## Directory Structure
66

@@ -62,7 +62,7 @@ const provider = insumerActionProvider({ apiKey: "insr_live_..." });
6262

6363
## Supported Chains
6464

65-
31 EVM chains: Ethereum, BNB Chain, Base, Avalanche, Polygon, Arbitrum, Optimism, Chiliz, Soneium, Plume, World Chain, Sonic, Gnosis, Mantle, Scroll, Linea, zkSync Era, Blast, Taiko, Ronin, Celo, Moonbeam, Moonriver, Viction, opBNB, Unichain, Ink, Sei, Berachain, ApeChain, and Solana.
65+
30 EVM chains: Ethereum, BNB Chain, Base, Avalanche, Polygon, Arbitrum, Optimism, Chiliz, Soneium, Plume, World Chain, Sonic, Gnosis, Mantle, Scroll, Linea, zkSync Era, Blast, Taiko, Ronin, Celo, Moonbeam, Moonriver, Viction, opBNB, Unichain, Ink, Sei, Berachain, ApeChain. Plus Solana and XRPL (32 total).
6666

6767
## Pricing
6868

typescript/agentkit/src/action-providers/insumer/constants.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
/**
22
* Base URL for the InsumerAPI
33
*/
4-
export const INSUMER_API_BASE_URL =
5-
"https://us-central1-insumer-merchant.cloudfunctions.net/insumerApi";
4+
export const INSUMER_API_BASE_URL = "https://api.insumermodel.com";
65

76
/**
87
* Default error message when API key is missing

typescript/agentkit/src/action-providers/insumer/insumerActionProvider.test.ts

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,14 @@ const MOCK_ATTEST_RESPONSE = {
77
ok: true,
88
data: {
99
attestation: {
10-
id: "ATT-A1B2C",
11-
wallet: "0x1234567890abcdef1234567890abcdef12345678",
12-
conditions: [
13-
{ label: "USDC >= 1000", met: true, chainId: 1 },
14-
{ label: "Bored Ape holder", met: false, chainId: 1 },
10+
id: "ATST-A1B2C",
11+
pass: false,
12+
results: [
13+
{ condition: 0, label: "USDC >= 1000", type: "token_balance", met: true, chainId: 1 },
14+
{ condition: 1, label: "Bored Ape holder", type: "nft_ownership", met: false, chainId: 1 },
1515
],
16-
allMet: false,
16+
passCount: 1,
17+
failCount: 1,
1718
attestedAt: "2026-02-28T12:00:00.000Z",
1819
expiresAt: "2026-02-28T12:30:00.000Z",
1920
},
@@ -207,7 +208,7 @@ describe("InsumerActionProvider", () => {
207208
expect((options as RequestInit).headers).toEqual(
208209
expect.objectContaining({ "X-API-Key": MOCK_API_KEY }),
209210
);
210-
expect(response).toContain("ATT-A1B2C");
211+
expect(response).toContain("ATST-A1B2C");
211212
expect(response).toContain("SOME CONDITIONS FAILED");
212213
expect(response).toContain("USDC >= 1000: PASS");
213214
expect(response).toContain("Bored Ape holder: FAIL");

typescript/agentkit/src/action-providers/insumer/insumerActionProvider.ts

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import {
2323
/**
2424
* InsumerActionProvider is an action provider for InsumerAPI interactions.
2525
* It enables AI agents to verify on-chain wallet conditions, generate trust profiles,
26-
* and validate discount codes across 31 EVM chains and Solana.
26+
* and validate discount codes across 32 chains (30 EVM + Solana + XRPL).
2727
*
2828
* @augments ActionProvider
2929
*/
@@ -50,7 +50,7 @@ export class InsumerActionProvider extends ActionProvider {
5050
/**
5151
* Verifies on-chain wallet conditions. Returns ECDSA-signed boolean attestations
5252
* for token balances, NFT ownership, EAS attestations, and Farcaster IDs
53-
* across 31 EVM chains and Solana. Never exposes raw wallet balances.
53+
* across 32 chains (30 EVM + Solana + XRPL). Never exposes raw wallet balances.
5454
*
5555
* @param args - The verification parameters
5656
* @returns A formatted string with verification results
@@ -66,7 +66,7 @@ It takes the following inputs:
6666
6767
Important notes:
6868
- Returns ECDSA-signed boolean results, never raw balances
69-
- Supports 31 EVM chains and Solana
69+
- Supports 32 chains (30 EVM + Solana + XRPL)
7070
- Each condition specifies its own chainId
7171
- Use compliance templates (e.g. coinbase_verified_account) for EAS attestations
7272
- Costs 1 credit per call (2 with proof="merkle")
@@ -80,20 +80,22 @@ Important notes:
8080
conditions: args.conditions,
8181
...(args.proof ? { proof: args.proof } : {}),
8282
...(args.solanaWallet ? { solanaWallet: args.solanaWallet } : {}),
83+
...(args.xrplWallet ? { xrplWallet: args.xrplWallet } : {}),
84+
...(args.format ? { format: args.format } : {}),
8385
});
8486

8587
if (!result.ok) {
8688
return `InsumerAPI error: ${result.error.message}`;
8789
}
8890

8991
const { attestation, sig } = result.data;
90-
const conditionResults = attestation.conditions
91-
.map(c => ` - ${c.label || "condition"}: ${c.met ? "PASS" : "FAIL"}`)
92+
const conditionResults = attestation.results
93+
.map(r => ` - ${r.label || "condition"}: ${r.met ? "PASS" : "FAIL"}`)
9294
.join("\n");
9395

9496
return [
9597
`Wallet Verification Result (${attestation.id}):`,
96-
`Overall: ${attestation.allMet ? "ALL CONDITIONS MET" : "SOME CONDITIONS FAILED"}`,
98+
`Overall: ${attestation.pass ? "ALL CONDITIONS MET" : "SOME CONDITIONS FAILED"}`,
9799
`Conditions:`,
98100
conditionResults,
99101
`Signature: ${sig.substring(0, 20)}...`,
@@ -137,6 +139,7 @@ Important notes:
137139
const result = await this.apiRequest<TrustProfileData>("POST", "/v1/trust", {
138140
wallet: args.wallet,
139141
...(args.solanaWallet ? { solanaWallet: args.solanaWallet } : {}),
142+
...(args.xrplWallet ? { xrplWallet: args.xrplWallet } : {}),
140143
...(args.proof ? { proof: args.proof } : {}),
141144
});
142145

@@ -336,7 +339,7 @@ Important notes:
336339

337340
/**
338341
* Checks if the InsumerAPI action provider supports the given network.
339-
* InsumerAPI is multi-chain (31 EVM chains + Solana), so this always returns true.
342+
* InsumerAPI is multi-chain (30 EVM + Solana + XRPL = 32 chains), so this always returns true.
340343
*
341344
* @param _ - The network to check
342345
* @returns Always returns true as InsumerAPI supports all networks

typescript/agentkit/src/action-providers/insumer/schemas.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,14 @@ export const VerifyWalletSchema = z
6464
.string()
6565
.optional()
6666
.describe("Solana wallet address (base58). Required for Solana conditions"),
67+
xrplWallet: z
68+
.string()
69+
.optional()
70+
.describe("XRPL wallet address (r...). Required for XRPL conditions"),
71+
format: z
72+
.enum(["jwt"])
73+
.optional()
74+
.describe("Set to 'jwt' to include an ES256-signed JWT (Wallet Auth) in the response"),
6775
})
6876
.strict();
6977

@@ -81,6 +89,10 @@ export const GetWalletTrustProfileSchema = z
8189
.string()
8290
.optional()
8391
.describe("Optional Solana wallet address to include Solana USDC check"),
92+
xrplWallet: z
93+
.string()
94+
.optional()
95+
.describe("Optional XRPL wallet address (r...) to include XRPL stablecoin checks"),
8496
proof: z
8597
.enum(["merkle"])
8698
.optional()
@@ -102,6 +114,10 @@ export const GetBatchWalletTrustProfilesSchema = z
102114
.string()
103115
.optional()
104116
.describe("Optional Solana wallet address for this wallet"),
117+
xrplWallet: z
118+
.string()
119+
.optional()
120+
.describe("Optional XRPL wallet address (r...) for this wallet"),
105121
})
106122
.strict(),
107123
)

typescript/agentkit/src/action-providers/insumer/types.ts

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,21 +45,27 @@ export type InsumerResponse<T> = InsumerSuccessResponse<T> | InsumerErrorRespons
4545
export interface AttestationData {
4646
attestation: {
4747
id: string;
48-
wallet?: string;
49-
solanaWallet?: string;
50-
conditions: Array<{
51-
label: string;
52-
met: boolean;
48+
pass: boolean;
49+
results: Array<{
50+
condition: number;
51+
label?: string;
52+
type: string;
5353
chainId?: number | string;
54+
met: boolean;
55+
evaluatedCondition?: Record<string, unknown>;
56+
conditionHash?: string;
5457
blockNumber?: string;
5558
blockTimestamp?: string;
59+
ledgerIndex?: number;
5660
}>;
57-
allMet: boolean;
61+
passCount: number;
62+
failCount: number;
5863
attestedAt: string;
5964
expiresAt: string;
6065
};
6166
sig: string;
6267
kid: string;
68+
jwt?: string;
6369
}
6470

6571
/**

0 commit comments

Comments
 (0)