TriaProvider

This class helps to use all the outside functions/actions for all chain interactions, adding all config at one place.

Create a instance

import { TriaProvider } from "@tria-sdk/connect";

export const triaProvider = new TriaProvider({
  authUrl: "https://auth.tria.so",
  environment: "mainnet",
  aa: {
    supportAa: true,
    pimlicoApiKey: <API_KEY>,
    accountType: "Kernel",
    isSponsored: true,
    sponsorshipPolicyIds: {
      FUSE: "sp_cheerful_thing",
      POLYGON: "sp_slim_namor",
    },
  },
} as TriaProviderParams);
export type TriaProviderParams = {
  authUrl?: string;
  dappDomain?: string;
  dappLogo?: string;
  aa?: AaDetails;
  environment?: ENV;
};
export type AaDetails = {
  supportAa: boolean;
  pimlicoApiKey?: string;
  isSponsored?: boolean;
  accountType?: AaAccountType;
  sponsorshipPolicyId?: string;
  sponsorshipPolicyIds?: ChainNameToPolicyId; // {FUSE: "sp_fuse_id", POLYGON: "sp_poly_id"}
};

export type AaAccountType = "Simple" | "Kernel" | "Safe" | "Biconomy";

Example

const { success, data: signature, message: errorMsg } = await triaProvider.signMessage({
    message: "Sign in with Tria",
    chainName: "FUSE",
});

Last updated