Skip to content
Alchemy Logo

stringToIndex

function stringToIndex(phrase): bigint;

Defined in: aa-sdk/core/src/utils/bigint.ts:117

Useful if you want to use a string, such as a user's email address, as salt to generate a unique SmartAccount per user.

example:

const salt = stringToIndex("alice@example.com");

export const account = new SimpleSmartContractAccount({
  index: salt,
  // other args omitted...
});

ParameterTypeDescription

phrase

string

any string value.

bigint

the bigint value of the hashed string

Was this page helpful?