@otim/sdk-core 0.0.4 → 0.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"authorization-DnNpWjxB.d.mts","names":["symbol","Branded","T","U","Filter","P","Acc","F","Rest","IsNarrowable","IsNever","Mutable","type","key","Or","Head","Tail","IsUndefined","MaybePromise","Promise","MaybeRequired","required","ExactRequired","Assign","Assign_","K","NoInfer","NoUndefined","Omit","keys","Exclude","Pick","PartialBy","ExactPartial","Prettify","Evaluate","RequiredBy","Some","array","value","rest","ValueOf","UnionToTuple","union","last","LastInUnion","UnionToIntersection","l","i","IsUnion","union2","MaybePartial","enabled","OneOf","fallback","KeyofUnion","item","LooseOmit","UnionEvaluate","UnionLooseOmit","UnionOmit","UnionPick","UnionPartialBy","UnionRequiredBy","OneOf","ByteArray","Uint8Array","Hex","Hash","LogTopic","SignableMessage","SignatureLegacy","bigintType","Signature","numberType","CompactSignature","Address","Hex","Signature","ExactPartial","OneOf","Authorization","uint32","signed","AuthorizationList","AuthorizationRequest","SignedAuthorization","SignedAuthorizationList","SerializedAuthorization","SerializedAuthorizationList"],"sources":["../../../node_modules/.pnpm/viem@2.39.3_bufferutil@4.0.9_typescript@5.9.3_utf-8-validate@5.0.10_zod@4.1.12/node_modules/viem/_types/types/utils.d.ts","../../../node_modules/.pnpm/viem@2.39.3_bufferutil@4.0.9_typescript@5.9.3_utf-8-validate@5.0.10_zod@4.1.12/node_modules/viem/_types/types/misc.d.ts","../../../node_modules/.pnpm/viem@2.39.3_bufferutil@4.0.9_typescript@5.9.3_utf-8-validate@5.0.10_zod@4.1.12/node_modules/viem/_types/types/authorization.d.ts"],"sourcesContent":["declare const symbol: unique symbol;\n/**\n * Creates a branded type of {@link T} with the brand {@link U}.\n *\n * @param T - Type to brand\n * @param U - Label\n * @returns Branded type\n *\n * @example\n * type Result = Branded<string, 'foo'>\n * // ^? type Result = string & { [symbol]: 'foo' }\n */\nexport type Branded<T, U> = T & {\n [symbol]: U;\n};\n/**\n * Filters out all members of {@link T} that are not {@link P}\n *\n * @param T - Items to filter\n * @param P - Type to filter out\n * @returns Filtered items\n *\n * @example\n * type Result = Filter<['a', 'b', 'c'], 'b'>\n * // ^? type Result = ['a', 'c']\n */\nexport type Filter<T extends readonly unknown[], P, Acc extends readonly unknown[] = []> = T extends readonly [infer F, ...infer Rest extends readonly unknown[]] ? [F] extends [P] ? Filter<Rest, P, [...Acc, F]> : Filter<Rest, P, Acc> : readonly [...Acc];\n/**\n * @description Checks if {@link T} can be narrowed further than {@link U}\n * @param T - Type to check\n * @param U - Type to against\n * @example\n * type Result = IsNarrowable<'foo', string>\n * // ^? true\n */\nexport type IsNarrowable<T, U> = IsNever<(T extends U ? true : false) & (U extends T ? false : true)> extends true ? false : true;\n/**\n * @description Checks if {@link T} is `never`\n * @param T - Type to check\n * @example\n * type Result = IsNever<never>\n * // ^? type Result = true\n */\nexport type IsNever<T> = [T] extends [never] ? true : false;\n/** Removes `readonly` from all properties of an object. */\nexport type Mutable<type extends object> = {\n -readonly [key in keyof type]: type[key];\n};\n/**\n * @description Evaluates boolean \"or\" condition for {@link T} properties.\n * @param T - Type to check\n *\n * * @example\n * type Result = Or<[false, true, false]>\n * // ^? type Result = true\n *\n * @example\n * type Result = Or<[false, false, false]>\n * // ^? type Result = false\n */\nexport type Or<T extends readonly unknown[]> = T extends readonly [\n infer Head,\n ...infer Tail\n] ? Head extends true ? true : Or<Tail> : false;\n/**\n * @description Checks if {@link T} is `undefined`\n * @param T - Type to check\n * @example\n * type Result = IsUndefined<undefined>\n * // ^? type Result = true\n */\nexport type IsUndefined<T> = [undefined] extends [T] ? true : false;\nexport type MaybePromise<T> = T | Promise<T>;\n/**\n * @description Makes attributes on the type T required if required is true.\n *\n * @example\n * MaybeRequired<{ a: string, b?: number }, true>\n * => { a: string, b: number }\n *\n * MaybeRequired<{ a: string, b?: number }, false>\n * => { a: string, b?: number }\n */\nexport type MaybeRequired<T, required extends boolean> = required extends true ? ExactRequired<T> : T;\n/**\n * @description Assigns the properties of U onto T.\n *\n * @example\n * Assign<{ a: string, b: number }, { a: undefined, c: boolean }>\n * => { a: undefined, b: number, c: boolean }\n */\nexport type Assign<T, U> = Assign_<T, U> & U;\ntype Assign_<T, U> = {\n [K in keyof T as K extends keyof U ? U[K] extends void ? never : K : K]: K extends keyof U ? U[K] : T[K];\n};\nexport type NoInfer<type> = [type][type extends any ? 0 : never];\n/**\n * @description Constructs a type by excluding `undefined` from `T`.\n *\n * @example\n * NoUndefined<string | undefined>\n * => string\n *\n * @internal\n */\nexport type NoUndefined<T> = T extends undefined ? never : T;\n/** Strict version of built-in Omit type */\nexport type Omit<type, keys extends keyof type> = Pick<type, Exclude<keyof type, keys>>;\n/**\n * @description Creates a type that is a partial of T, but with the required keys K.\n *\n * @example\n * PartialBy<{ a: string, b: number }, 'a'>\n * => { a?: string, b: number }\n */\nexport type PartialBy<T, K extends keyof T> = Omit<T, K> & ExactPartial<Pick<T, K>>;\n/**\n * @description Combines members of an intersection into a readable type.\n *\n * @see {@link https://twitter.com/mattpocockuk/status/1622730173446557697?s=20&t=NdpAcmEFXY01xkqU3KO0Mg}\n * @example\n * Prettify<{ a: string } & { b: string } & { c: number, d: bigint }>\n * => { a: string, b: string, c: number, d: bigint }\n */\nexport type Prettify<T> = {\n [K in keyof T]: T[K];\n} & {};\n/** @internal */\nexport type Evaluate<type> = {\n [key in keyof type]: type[key];\n} & {};\n/**\n * @description Creates a type that is T with the required keys K.\n *\n * @example\n * RequiredBy<{ a?: string, b: number }, 'a'>\n * => { a: string, b: number }\n */\nexport type RequiredBy<T, K extends keyof T> = Omit<T, K> & ExactRequired<Pick<T, K>>;\n/**\n * @description Returns truthy if `array` contains `value`.\n *\n * @example\n * Some<[1, 2, 3], 2>\n * => true\n */\nexport type Some<array extends readonly unknown[], value> = array extends readonly [value, ...unknown[]] ? true : array extends readonly [unknown, ...infer rest] ? Some<rest, value> : false;\n/**\n * @description Creates a type that extracts the values of T.\n *\n * @example\n * ValueOf<{ a: string, b: number }>\n * => string | number\n *\n * @internal\n */\nexport type ValueOf<T> = T[keyof T];\nexport type UnionToTuple<union, last = LastInUnion<union>> = [union] extends [never] ? [] : [...UnionToTuple<Exclude<union, last>>, last];\ntype LastInUnion<U> = UnionToIntersection<U extends unknown ? (x: U) => 0 : never> extends (x: infer l) => 0 ? l : never;\ntype UnionToIntersection<union> = (union extends unknown ? (arg: union) => 0 : never) extends (arg: infer i) => 0 ? i : never;\nexport type IsUnion<union, union2 = union> = union extends union2 ? ([union2] extends [union] ? false : true) : never;\nexport type MaybePartial<type, enabled extends boolean | undefined> = enabled extends true ? Prettify<ExactPartial<type>> : type;\nexport type ExactPartial<type> = {\n [key in keyof type]?: type[key] | undefined;\n};\nexport type ExactRequired<type> = {\n [P in keyof type]-?: Exclude<type[P], undefined>;\n};\nexport type OneOf<union extends object, fallback extends object | undefined = undefined, keys extends KeyofUnion<union> = KeyofUnion<union>> = union extends infer item ? Prettify<item & {\n [key in Exclude<keys, keyof item>]?: fallback extends object ? key extends keyof fallback ? fallback[key] : undefined : undefined;\n}> : never;\ntype KeyofUnion<type> = type extends type ? keyof type : never;\n/**\n * Loose version of {@link Omit}\n * @internal\n */\nexport type LooseOmit<type, keys extends string> = Pick<type, Exclude<keyof type, keys>>;\nexport type UnionEvaluate<type> = type extends object ? Prettify<type> : type;\nexport type UnionLooseOmit<type, keys extends string> = type extends any ? LooseOmit<type, keys> : never;\n/**\n * @description Construct a type with the properties of union type T except for those in type K.\n * @example\n * type Result = UnionOmit<{ a: string, b: number } | { a: string, b: undefined, c: number }, 'a'>\n * => { b: number } | { b: undefined, c: number }\n */\nexport type UnionOmit<type, keys extends keyof type> = type extends any ? Omit<type, keys> : never;\n/**\n * @description Construct a type with the properties of union type T except for those in type K.\n * @example\n * type Result = UnionOmit<{ a: string, b: number } | { a: string, b: undefined, c: number }, 'a'>\n * => { b: number } | { b: undefined, c: number }\n */\nexport type UnionPick<type, keys extends keyof type> = type extends any ? Pick<type, keys> : never;\n/**\n * @description Creates a type that is a partial of T, but with the required keys K.\n *\n * @example\n * PartialBy<{ a: string, b: number } | { a: string, b: undefined, c: number }, 'a'>\n * => { a?: string, b: number } | { a?: string, b: undefined, c: number }\n */\nexport type UnionPartialBy<T, K extends keyof T> = T extends any ? PartialBy<T, K> : never;\n/**\n * @description Creates a type that is T with the required keys K.\n *\n * @example\n * RequiredBy<{ a?: string, b: number } | { a?: string, c?: number }, 'a'>\n * => { a: string, b: number } | { a: string, c?: number }\n */\nexport type UnionRequiredBy<T, K extends keyof T> = T extends any ? RequiredBy<T, K> : never;\nexport {};\n//# sourceMappingURL=utils.d.ts.map","import type { OneOf } from './utils.js';\nexport type ByteArray = Uint8Array;\nexport type Hex = `0x${string}`;\nexport type Hash = `0x${string}`;\nexport type LogTopic = Hex | Hex[] | null;\nexport type SignableMessage = string | {\n /** Raw data representation of the message. */\n raw: Hex | ByteArray;\n};\nexport type SignatureLegacy<bigintType = bigint> = {\n r: Hex;\n s: Hex;\n v: bigintType;\n};\nexport type Signature<numberType = number, bigintType = bigint> = OneOf<SignatureLegacy | {\n r: Hex;\n s: Hex;\n /** @deprecated use `yParity`. */\n v: bigintType;\n yParity?: numberType | undefined;\n} | {\n r: Hex;\n s: Hex;\n /** @deprecated use `yParity`. */\n v?: bigintType | undefined;\n yParity: numberType;\n}>;\nexport type CompactSignature = {\n r: Hex;\n yParityAndS: Hex;\n};\n//# sourceMappingURL=misc.d.ts.map","import type { Address } from 'abitype';\nimport type { Hex, Signature } from './misc.js';\nimport type { ExactPartial, OneOf } from './utils.js';\nexport type Authorization<uint32 = number, signed extends boolean = false> = {\n /** Address of the contract to delegate to. */\n address: Address;\n /** Chain ID. */\n chainId: uint32;\n /** Nonce of the EOA to delegate to. */\n nonce: uint32;\n} & (signed extends true ? Signature<uint32> : ExactPartial<Signature<uint32>>);\nexport type AuthorizationList<uint32 = number, signed extends boolean = false> = readonly Authorization<uint32, signed>[];\nexport type AuthorizationRequest<uint32 = number> = OneOf<{\n /** Address of the contract to delegate to. */\n address: Address;\n} | {\n /**\n * Address of the contract to delegate to.\n * @alias `address`\n */\n contractAddress: Address;\n}> & {\n /** Chain ID. */\n chainId: uint32;\n /** Nonce of the EOA to delegate to. */\n nonce: uint32;\n};\nexport type SignedAuthorization<uint32 = number> = Authorization<uint32, true>;\nexport type SignedAuthorizationList<uint32 = number> = readonly SignedAuthorization<uint32>[];\nexport type SerializedAuthorization = readonly [\n chainId: Hex,\n address: Hex,\n nonce: Hex,\n yParity: Hex,\n r: Hex,\n s: Hex\n];\nexport type SerializedAuthorizationList = readonly SerializedAuthorization[];\n//# sourceMappingURL=authorization.d.ts.map"],"x_google_ignoreList":[0,1,2],"mappings":";;;cAAcA;;;;AAYd;;;;;AAcA;;;AAAiLK,KAdrKJ,OAcqKI,CAAAA,CAAAA,EAAAA,CAAAA,CAAAA,GAdrJH,CAcqJG,GAAAA;EAAYG,CAbxLR,MAAAA,CAawLQ,EAb/KL,CAa+KK;CAAMH;;;;;;;;;;AASnM;;AAAoDF,KATxCC,MASwCD,CAAAA,UAAAA,SAAAA,OAAAA,EAAAA,EAAAA,GAAAA,EAAAA,YAAAA,SAAAA,OAAAA,EAAAA,GAAAA,EAAAA,CAAAA,GATuCD,CASvCC,SAAAA,SAAAA,CAAAA,KAAAA,EAAAA,EAAAA,GAAAA,KAAAA,cAAAA,SAAAA,OAAAA,EAAAA,CAAAA,GAAAA,CATiHI,CASjHJ,CAAAA,SAAAA,CAT6HE,GAS7HF,CAAAA,GATkIC,MASlID,CATyIK,IASzIL,EAT+IE,GAS/IF,EAAAA,CAAAA,GATsJG,GAStJH,EAT2JI,CAS3JJ,CAAAA,CAAAA,GATiKC,MASjKD,CATwKK,IASxKL,EAT8KE,GAS9KF,EATiLG,GASjLH,CAAAA,GAAAA,SAAAA,CAAAA,GATqMG,GASrMH,CAAAA;;;;;AAQpD;AA4BA;AACA;;AAA0CD,KArC9BO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Ef3E0E,aFe2E1E,CEf7D2E,MFe6D3E,EEfrD4E,MFeqD5E,CAAAA,EAAAA;AAAYF,KEdrKgF,oBFcqKhF,CAAAA,SAAAA,MAAAA,CAAAA,GEd7H2E,KFc6H3E,CAAAA;EAAYG;EAAMH,OAAAA,EEZtLuE,OFYsLvE;CAAOC,GAAAA;EAAKC;;;;EAAsBD,eAAAA,EENhNsE,OFMgNtE;CAAhBF,CAAAA,GAAAA;EAAoCE;EAAG,OAAA,EEH/O4E,MFG+O;EAShPzE;EAA8BP,KAAAA,EEV/BgF,MFU+BhF;CAAUC;AAAqBA,KER7DmF,mBFQ6DnF,CAAAA,SAAAA,MAAAA,CAAAA,GERtB8E,aFQsB9E,CERR+E,MFQQ/E,EAAAA,IAAAA,CAAAA;AAAUD,KEPvEqF,uBFOuErF,CAAAA,SAAAA,MAAAA,CAAAA,GAAAA,SEPnBoF,mBFOmBpF,CEPCgF,MFODhF,CAAAA,EAAAA"}
1
+ {"version":3,"file":"authorization-DnNpWjxB.d.mts","names":["symbol","Branded","T","U","Filter","P","Acc","F","Rest","IsNarrowable","IsNever","Mutable","type","key","Or","Head","Tail","IsUndefined","MaybePromise","Promise","MaybeRequired","required","ExactRequired","Assign","Assign_","K","NoInfer","NoUndefined","Omit","keys","Exclude","Pick","PartialBy","ExactPartial","Prettify","Evaluate","RequiredBy","Some","array","value","rest","ValueOf","UnionToTuple","union","last","LastInUnion","UnionToIntersection","l","i","IsUnion","union2","MaybePartial","enabled","OneOf","fallback","KeyofUnion","item","LooseOmit","UnionEvaluate","UnionLooseOmit","UnionOmit","UnionPick","UnionPartialBy","UnionRequiredBy","OneOf","ByteArray","Uint8Array","Hex","Hash","LogTopic","SignableMessage","SignatureLegacy","bigintType","Signature","numberType","CompactSignature","Address","Hex","Signature","ExactPartial","OneOf","Authorization","uint32","signed","AuthorizationList","AuthorizationRequest","SignedAuthorization","SignedAuthorizationList","SerializedAuthorization","SerializedAuthorizationList"],"sources":["../../../node_modules/.pnpm/viem@2.39.3_bufferutil@4.0.9_typescript@5.9.3_utf-8-validate@5.0.10_zod@4.1.12/node_modules/viem/_types/types/utils.d.ts","../../../node_modules/.pnpm/viem@2.39.3_bufferutil@4.0.9_typescript@5.9.3_utf-8-validate@5.0.10_zod@4.1.12/node_modules/viem/_types/types/misc.d.ts","../../../node_modules/.pnpm/viem@2.39.3_bufferutil@4.0.9_typescript@5.9.3_utf-8-validate@5.0.10_zod@4.1.12/node_modules/viem/_types/types/authorization.d.ts"],"sourcesContent":["declare const symbol: unique symbol;\n/**\n * Creates a branded type of {@link T} with the brand {@link U}.\n *\n * @param T - Type to brand\n * @param U - Label\n * @returns Branded type\n *\n * @example\n * type Result = Branded<string, 'foo'>\n * // ^? type Result = string & { [symbol]: 'foo' }\n */\nexport type Branded<T, U> = T & {\n [symbol]: U;\n};\n/**\n * Filters out all members of {@link T} that are not {@link P}\n *\n * @param T - Items to filter\n * @param P - Type to filter out\n * @returns Filtered items\n *\n * @example\n * type Result = Filter<['a', 'b', 'c'], 'b'>\n * // ^? type Result = ['a', 'c']\n */\nexport type Filter<T extends readonly unknown[], P, Acc extends readonly unknown[] = []> = T extends readonly [infer F, ...infer Rest extends readonly unknown[]] ? [F] extends [P] ? Filter<Rest, P, [...Acc, F]> : Filter<Rest, P, Acc> : readonly [...Acc];\n/**\n * @description Checks if {@link T} can be narrowed further than {@link U}\n * @param T - Type to check\n * @param U - Type to against\n * @example\n * type Result = IsNarrowable<'foo', string>\n * // ^? true\n */\nexport type IsNarrowable<T, U> = IsNever<(T extends U ? true : false) & (U extends T ? false : true)> extends true ? false : true;\n/**\n * @description Checks if {@link T} is `never`\n * @param T - Type to check\n * @example\n * type Result = IsNever<never>\n * // ^? type Result = true\n */\nexport type IsNever<T> = [T] extends [never] ? true : false;\n/** Removes `readonly` from all properties of an object. */\nexport type Mutable<type extends object> = {\n -readonly [key in keyof type]: type[key];\n};\n/**\n * @description Evaluates boolean \"or\" condition for {@link T} properties.\n * @param T - Type to check\n *\n * * @example\n * type Result = Or<[false, true, false]>\n * // ^? type Result = true\n *\n * @example\n * type Result = Or<[false, false, false]>\n * // ^? type Result = false\n */\nexport type Or<T extends readonly unknown[]> = T extends readonly [\n infer Head,\n ...infer Tail\n] ? Head extends true ? true : Or<Tail> : false;\n/**\n * @description Checks if {@link T} is `undefined`\n * @param T - Type to check\n * @example\n * type Result = IsUndefined<undefined>\n * // ^? type Result = true\n */\nexport type IsUndefined<T> = [undefined] extends [T] ? true : false;\nexport type MaybePromise<T> = T | Promise<T>;\n/**\n * @description Makes attributes on the type T required if required is true.\n *\n * @example\n * MaybeRequired<{ a: string, b?: number }, true>\n * => { a: string, b: number }\n *\n * MaybeRequired<{ a: string, b?: number }, false>\n * => { a: string, b?: number }\n */\nexport type MaybeRequired<T, required extends boolean> = required extends true ? ExactRequired<T> : T;\n/**\n * @description Assigns the properties of U onto T.\n *\n * @example\n * Assign<{ a: string, b: number }, { a: undefined, c: boolean }>\n * => { a: undefined, b: number, c: boolean }\n */\nexport type Assign<T, U> = Assign_<T, U> & U;\ntype Assign_<T, U> = {\n [K in keyof T as K extends keyof U ? U[K] extends void ? never : K : K]: K extends keyof U ? U[K] : T[K];\n};\nexport type NoInfer<type> = [type][type extends any ? 0 : never];\n/**\n * @description Constructs a type by excluding `undefined` from `T`.\n *\n * @example\n * NoUndefined<string | undefined>\n * => string\n *\n * @internal\n */\nexport type NoUndefined<T> = T extends undefined ? never : T;\n/** Strict version of built-in Omit type */\nexport type Omit<type, keys extends keyof type> = Pick<type, Exclude<keyof type, keys>>;\n/**\n * @description Creates a type that is a partial of T, but with the required keys K.\n *\n * @example\n * PartialBy<{ a: string, b: number }, 'a'>\n * => { a?: string, b: number }\n */\nexport type PartialBy<T, K extends keyof T> = Omit<T, K> & ExactPartial<Pick<T, K>>;\n/**\n * @description Combines members of an intersection into a readable type.\n *\n * @see {@link https://twitter.com/mattpocockuk/status/1622730173446557697?s=20&t=NdpAcmEFXY01xkqU3KO0Mg}\n * @example\n * Prettify<{ a: string } & { b: string } & { c: number, d: bigint }>\n * => { a: string, b: string, c: number, d: bigint }\n */\nexport type Prettify<T> = {\n [K in keyof T]: T[K];\n} & {};\n/** @internal */\nexport type Evaluate<type> = {\n [key in keyof type]: type[key];\n} & {};\n/**\n * @description Creates a type that is T with the required keys K.\n *\n * @example\n * RequiredBy<{ a?: string, b: number }, 'a'>\n * => { a: string, b: number }\n */\nexport type RequiredBy<T, K extends keyof T> = Omit<T, K> & ExactRequired<Pick<T, K>>;\n/**\n * @description Returns truthy if `array` contains `value`.\n *\n * @example\n * Some<[1, 2, 3], 2>\n * => true\n */\nexport type Some<array extends readonly unknown[], value> = array extends readonly [value, ...unknown[]] ? true : array extends readonly [unknown, ...infer rest] ? Some<rest, value> : false;\n/**\n * @description Creates a type that extracts the values of T.\n *\n * @example\n * ValueOf<{ a: string, b: number }>\n * => string | number\n *\n * @internal\n */\nexport type ValueOf<T> = T[keyof T];\nexport type UnionToTuple<union, last = LastInUnion<union>> = [union] extends [never] ? [] : [...UnionToTuple<Exclude<union, last>>, last];\ntype LastInUnion<U> = UnionToIntersection<U extends unknown ? (x: U) => 0 : never> extends (x: infer l) => 0 ? l : never;\ntype UnionToIntersection<union> = (union extends unknown ? (arg: union) => 0 : never) extends (arg: infer i) => 0 ? i : never;\nexport type IsUnion<union, union2 = union> = union extends union2 ? ([union2] extends [union] ? false : true) : never;\nexport type MaybePartial<type, enabled extends boolean | undefined> = enabled extends true ? Prettify<ExactPartial<type>> : type;\nexport type ExactPartial<type> = {\n [key in keyof type]?: type[key] | undefined;\n};\nexport type ExactRequired<type> = {\n [P in keyof type]-?: Exclude<type[P], undefined>;\n};\nexport type OneOf<union extends object, fallback extends object | undefined = undefined, keys extends KeyofUnion<union> = KeyofUnion<union>> = union extends infer item ? Prettify<item & {\n [key in Exclude<keys, keyof item>]?: fallback extends object ? key extends keyof fallback ? fallback[key] : undefined : undefined;\n}> : never;\ntype KeyofUnion<type> = type extends type ? keyof type : never;\n/**\n * Loose version of {@link Omit}\n * @internal\n */\nexport type LooseOmit<type, keys extends string> = Pick<type, Exclude<keyof type, keys>>;\nexport type UnionEvaluate<type> = type extends object ? Prettify<type> : type;\nexport type UnionLooseOmit<type, keys extends string> = type extends any ? LooseOmit<type, keys> : never;\n/**\n * @description Construct a type with the properties of union type T except for those in type K.\n * @example\n * type Result = UnionOmit<{ a: string, b: number } | { a: string, b: undefined, c: number }, 'a'>\n * => { b: number } | { b: undefined, c: number }\n */\nexport type UnionOmit<type, keys extends keyof type> = type extends any ? Omit<type, keys> : never;\n/**\n * @description Construct a type with the properties of union type T except for those in type K.\n * @example\n * type Result = UnionOmit<{ a: string, b: number } | { a: string, b: undefined, c: number }, 'a'>\n * => { b: number } | { b: undefined, c: number }\n */\nexport type UnionPick<type, keys extends keyof type> = type extends any ? Pick<type, keys> : never;\n/**\n * @description Creates a type that is a partial of T, but with the required keys K.\n *\n * @example\n * PartialBy<{ a: string, b: number } | { a: string, b: undefined, c: number }, 'a'>\n * => { a?: string, b: number } | { a?: string, b: undefined, c: number }\n */\nexport type UnionPartialBy<T, K extends keyof T> = T extends any ? PartialBy<T, K> : never;\n/**\n * @description Creates a type that is T with the required keys K.\n *\n * @example\n * RequiredBy<{ a?: string, b: number } | { a?: string, c?: number }, 'a'>\n * => { a: string, b: number } | { a: string, c?: number }\n */\nexport type UnionRequiredBy<T, K extends keyof T> = T extends any ? RequiredBy<T, K> : never;\nexport {};\n//# sourceMappingURL=utils.d.ts.map","import type { OneOf } from './utils.js';\nexport type ByteArray = Uint8Array;\nexport type Hex = `0x${string}`;\nexport type Hash = `0x${string}`;\nexport type LogTopic = Hex | Hex[] | null;\nexport type SignableMessage = string | {\n /** Raw data representation of the message. */\n raw: Hex | ByteArray;\n};\nexport type SignatureLegacy<bigintType = bigint> = {\n r: Hex;\n s: Hex;\n v: bigintType;\n};\nexport type Signature<numberType = number, bigintType = bigint> = OneOf<SignatureLegacy | {\n r: Hex;\n s: Hex;\n /** @deprecated use `yParity`. */\n v: bigintType;\n yParity?: numberType | undefined;\n} | {\n r: Hex;\n s: Hex;\n /** @deprecated use `yParity`. */\n v?: bigintType | undefined;\n yParity: numberType;\n}>;\nexport type CompactSignature = {\n r: Hex;\n yParityAndS: Hex;\n};\n//# sourceMappingURL=misc.d.ts.map","import type { Address } from 'abitype';\nimport type { Hex, Signature } from './misc.js';\nimport type { ExactPartial, OneOf } from './utils.js';\nexport type Authorization<uint32 = number, signed extends boolean = false> = {\n /** Address of the contract to delegate to. */\n address: Address;\n /** Chain ID. */\n chainId: uint32;\n /** Nonce of the EOA to delegate to. */\n nonce: uint32;\n} & (signed extends true ? Signature<uint32> : ExactPartial<Signature<uint32>>);\nexport type AuthorizationList<uint32 = number, signed extends boolean = false> = readonly Authorization<uint32, signed>[];\nexport type AuthorizationRequest<uint32 = number> = OneOf<{\n /** Address of the contract to delegate to. */\n address: Address;\n} | {\n /**\n * Address of the contract to delegate to.\n * @alias `address`\n */\n contractAddress: Address;\n}> & {\n /** Chain ID. */\n chainId: uint32;\n /** Nonce of the EOA to delegate to. */\n nonce: uint32;\n};\nexport type SignedAuthorization<uint32 = number> = Authorization<uint32, true>;\nexport type SignedAuthorizationList<uint32 = number> = readonly SignedAuthorization<uint32>[];\nexport type SerializedAuthorization = readonly [\n chainId: Hex,\n address: Hex,\n nonce: Hex,\n yParity: Hex,\n r: Hex,\n s: Hex\n];\nexport type SerializedAuthorizationList = readonly SerializedAuthorization[];\n//# sourceMappingURL=authorization.d.ts.map"],"x_google_ignoreList":[0,1,2],"mappings":";;;cAAcA;;;;AAYd;;;;;AAcA;;;AAAiLK,KAdrKJ,OAcqKI,CAAAA,CAAAA,EAAAA,CAAAA,CAAAA,GAdrJH,CAcqJG,GAAAA;EAAYG,CAbxLR,MAAAA,CAawLQ,EAb/KL,CAa+KK;CAAMH;;;;;;;;;;AASnM;;AAAoDF,KATxCC,MASwCD,CAAAA,UAAAA,SAAAA,OAAAA,EAAAA,EAAAA,GAAAA,EAAAA,YAAAA,S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B,CAAA,SAAA,MAAA,EAAA,eAAA,OAAA,GAAA,KAAA,CAAA,GAAA;EAYvBhF;EAAgBC,OAAAA,EEPf0E,OFOe1E;EACdC;EAATH,OAAAA,EENQkF,MFMRlF;EAAM;EAaCI,KAAAA,EEjBD8E,MFiBO;CAAyEhF,GAAAA,CEhBtFiF,MFgBsFjF,SAAAA,IAAAA,GEhBhE4E,SFgBgE5E,CEhBtDgF,MFgBsDhF,CAAAA,GEhB5C6E,YFgB4C7E,CEhB/B4E,SFgB+B5E,CEhBrBgF,MFgBqBhF,CAAAA,CAAAA,CAAAA;AAA0EK,KEfzJ6E,iBFeyJ7E,CAAAA,SAAAA,MAAAA,EAAAA,eAAAA,OAAAA,GAAAA,KAAAA,CAAAA,GAAAA,SEf3E0E,aFe2E1E,CEf7D2E,MFe6D3E,EEfrD4E,MFeqD5E,CAAAA,EAAAA;AAAYF,KEdrKgF,oBFcqKhF,CAAAA,SAAAA,MAAAA,CAAAA,GEd7H2E,KFc6H3E,CAAAA;EAAYG;EAAMH,OAAAA,EEZtLuE,OFYsLvE;CAAOC,GAAAA;EAAKC;;;;EAAsBD,eAAAA,EENhNsE,OFMgNtE;CAAhBF,CAAAA,GAAAA;EAAoCE;EAAG,OAAA,EEH/O4E,MFG+O;EAShPzE;EAA8BP,KAAAA,EEV/BgF,MFU+BhF;CAAUC;AAAqBA,KER7DmF,mBFQ6DnF,CAAAA,SAAAA,MAAAA,CAAAA,GERtB8E,aFQsB9E,CERR+E,MFQQ/E,EAAAA,IAAAA,CAAAA;AAAUD,KEPvEqF,uBFOuErF,CAAAA,SAAAA,MAAAA,CAAAA,GAAAA,SEPnBoF,mBFOmBpF,CEPCgF,MFODhF,CAAAA,EAAAA"}
@@ -1,8 +1,8 @@
1
- const require_clients = require('../clients-BCyzdTLc.cjs');
1
+ const require_clients = require('../clients-CJQ7dmDL.cjs');
2
2
 
3
3
  exports.ActivityClient = require_clients.ActivityClient;
4
4
  exports.AuthClient = require_clients.AuthClient;
5
5
  exports.ConfigClient = require_clients.ConfigClient;
6
6
  exports.DelegationClient = require_clients.DelegationClient;
7
7
  exports.OrchestrationClient = require_clients.OrchestrationClient;
8
- exports.preparePaymentRequest = require_clients.preparePaymentRequest;
8
+ exports.prepareSettlement = require_clients.prepareSettlement;
@@ -1,3 +1,3 @@
1
1
  import "../abi-OUq-mx1W.cjs";
2
- import { a as preparePaymentRequest, c as AuthClient, i as PreparedPaymentRequest, l as LoginOptions, n as OrchestrationClient, o as DelegationClient, r as PreparePaymentRequestParams, s as ConfigClient, t as CreatePaymentRequestResponse, u as ActivityClient } from "../index-Ce_qYSJj.cjs";
3
- export { ActivityClient, AuthClient, ConfigClient, CreatePaymentRequestResponse, DelegationClient, LoginOptions, OrchestrationClient, PreparePaymentRequestParams, PreparedPaymentRequest, preparePaymentRequest };
2
+ import { a as prepareSettlement, c as AuthClient, i as PreparedSettlement, l as LoginOptions, n as OrchestrationClient, o as DelegationClient, r as PrepareSettlementParams, s as ConfigClient, t as CreateSettlementResponse, u as ActivityClient } from "../index-CmU_0gN9.cjs";
3
+ export { ActivityClient, AuthClient, ConfigClient, CreateSettlementResponse, DelegationClient, LoginOptions, OrchestrationClient, PrepareSettlementParams, PreparedSettlement, prepareSettlement };
@@ -1,3 +1,3 @@
1
1
  import "../abi-DW6AS0eM.mjs";
2
- import { a as preparePaymentRequest, c as AuthClient, i as PreparedPaymentRequest, l as LoginOptions, n as OrchestrationClient, o as DelegationClient, r as PreparePaymentRequestParams, s as ConfigClient, t as CreatePaymentRequestResponse, u as ActivityClient } from "../index-CiyyA-wd.mjs";
3
- export { ActivityClient, AuthClient, ConfigClient, CreatePaymentRequestResponse, DelegationClient, LoginOptions, OrchestrationClient, PreparePaymentRequestParams, PreparedPaymentRequest, preparePaymentRequest };
2
+ import { a as prepareSettlement, c as AuthClient, i as PreparedSettlement, l as LoginOptions, n as OrchestrationClient, o as DelegationClient, r as PrepareSettlementParams, s as ConfigClient, t as CreateSettlementResponse, u as ActivityClient } from "../index-RhE0Wp_f.mjs";
3
+ export { ActivityClient, AuthClient, ConfigClient, CreateSettlementResponse, DelegationClient, LoginOptions, OrchestrationClient, PrepareSettlementParams, PreparedSettlement, prepareSettlement };
@@ -1,3 +1,3 @@
1
- import { a as AuthClient, i as ConfigClient, n as OrchestrationClient, o as ActivityClient, r as DelegationClient, t as preparePaymentRequest } from "../clients-Bn4BUElo.mjs";
1
+ import { a as AuthClient, i as ConfigClient, n as OrchestrationClient, o as ActivityClient, r as DelegationClient, t as prepareSettlement } from "../clients-vDKBJkXx.mjs";
2
2
 
3
- export { ActivityClient, AuthClient, ConfigClient, DelegationClient, OrchestrationClient, preparePaymentRequest };
3
+ export { ActivityClient, AuthClient, ConfigClient, DelegationClient, OrchestrationClient, prepareSettlement };
@@ -73,8 +73,8 @@ var DelegationClient = class {
73
73
  };
74
74
 
75
75
  //#endregion
76
- //#region src/clients/helpers/payment-signer.ts
77
- async function createPaymentSigner(params) {
76
+ //#region src/clients/helpers/settlement-signer.ts
77
+ async function createSettlementSigner(params) {
78
78
  const { context, buildResponse, publicClient, delegateAddressMap } = params;
79
79
  if ((0, __otim_sdk_core_account.isApiAccountConfig)(context.config)) return new __otim_turnkey_signing.UnifiedPaymentSigner({
80
80
  buildResponse,
@@ -102,10 +102,10 @@ var OrchestrationClient = class {
102
102
  this.account = account;
103
103
  this.context = context;
104
104
  }
105
- async create(preparedRequest) {
105
+ async create(preparedSettlement) {
106
106
  (0, __otim_sdk_core_context.assertServerContext)(this.context);
107
- const { payload, chainId } = preparedRequest;
108
- const buildResponse = await this.buildAndEnhancePaymentRequest(payload);
107
+ const { payload, chainId } = preparedSettlement;
108
+ const buildResponse = await this.buildAndEnhanceSettlement(payload);
109
109
  await this.activate(buildResponse, chainId);
110
110
  return {
111
111
  requestId: buildResponse.requestId,
@@ -122,7 +122,7 @@ var OrchestrationClient = class {
122
122
  const publicClient = this.createPublicClient(settlementChainId);
123
123
  const instructions = [...buildResponse.completionInstructions, ...buildResponse.instructions];
124
124
  const delegateAddressMap = await this.fetchDelegateAddresses(instructions);
125
- const { signedAuthorization, completionInstructions, instructions: signedInstructions } = await createPaymentSigner({
125
+ const { signedAuthorization, completionInstructions, instructions: signedInstructions } = await createSettlementSigner({
126
126
  context: this.context,
127
127
  buildResponse,
128
128
  publicClient,
@@ -135,7 +135,7 @@ var OrchestrationClient = class {
135
135
  instructions: signedInstructions
136
136
  });
137
137
  }
138
- async buildAndEnhancePaymentRequest(payload) {
138
+ async buildAndEnhanceSettlement(payload) {
139
139
  const actionNames = (0, __otim_utils_payments.extractActionNamesMap)(payload.completionInstructions, payload.instructions);
140
140
  return (0, __otim_utils_payments.addActionNamesToInstructions)((await this.apiClient.payments.buildPaymentRequest(payload)).data, actionNames);
141
141
  }
@@ -158,7 +158,7 @@ var OrchestrationClient = class {
158
158
  };
159
159
 
160
160
  //#endregion
161
- //#region src/clients/helpers/prepare-payment-request.ts
161
+ //#region src/clients/helpers/prepare-settlement.ts
162
162
  function validateAndGetTokenAddress(chainId, token) {
163
163
  const tokenAddress = (0, __otim_utils_chains.getTokenAddress)(chainId, token);
164
164
  if (!tokenAddress) throw new Error(`Token ${token} not supported on chain ${chainId}`);
@@ -195,7 +195,7 @@ function createPayload(params) {
195
195
  maxRuns
196
196
  });
197
197
  }
198
- function preparePaymentRequest(params) {
198
+ function prepareSettlement(params) {
199
199
  const { chainId, token = "USDC", recipient, amount, payer, note, dueDate, metadata: customMetadata, maxRuns } = params;
200
200
  if (dueDate) (0, __otim_utils_helpers.validateIso8601Date)(dueDate);
201
201
  const feeTokenAddress = validateAndGetTokenAddress(chainId, token);
@@ -251,10 +251,10 @@ Object.defineProperty(exports, 'OrchestrationClient', {
251
251
  return OrchestrationClient;
252
252
  }
253
253
  });
254
- Object.defineProperty(exports, 'preparePaymentRequest', {
254
+ Object.defineProperty(exports, 'prepareSettlement', {
255
255
  enumerable: true,
256
256
  get: function () {
257
- return preparePaymentRequest;
257
+ return prepareSettlement;
258
258
  }
259
259
  });
260
- //# sourceMappingURL=clients-BCyzdTLc.cjs.map
260
+ //# sourceMappingURL=clients-CJQ7dmDL.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"clients-CJQ7dmDL.cjs","names":["apiClient: APIClient","apiClient: APIClient","account: OtimAccount","context: OtimClientContext","apiClient: APIClient","apiClient: APIClient","UnifiedPaymentSigner","ApiKeyClientSigningService","ServerWalletSigningService","apiClient: APIClient","account: OtimAccount","context: OtimServerClientContext","hexStringSchema","hexStringSchema","supportedChains"],"sources":["../src/clients/activity.ts","../src/clients/auth.ts","../src/clients/config.ts","../src/clients/delegation.ts","../src/clients/helpers/settlement-signer.ts","../src/clients/orchestration.ts","../src/clients/helpers/prepare-settlement.ts"],"sourcesContent":["import type {\n APIClient,\n GetInstructionActivityRequest,\n GetInstructionActivityResponse,\n} from \"@otim/utils/api\";\n\nexport class ActivityClient {\n constructor(private readonly apiClient: APIClient) {}\n\n async getInstructionActivity(\n request: GetInstructionActivityRequest,\n ): Promise<GetInstructionActivityResponse> {\n const response =\n await this.apiClient.activity.getInstructionActivity(request);\n\n return response.data;\n }\n}\n","import type { OtimAccount } from \"@otim/sdk-core/account\";\nimport type { OtimClientContext } from \"@otim/sdk-core/context\";\nimport type { APIClient, AuthLoginResponse, MeResponse } from \"@otim/utils/api\";\nimport type { Address } from \"viem\";\n\nimport { parseSignatureToVRS } from \"@otim/utils/helpers\";\n\nimport { createLoginSiweMessage } from \"@otim/sdk-core/config\";\nimport { assertRequiresAuth } from \"@otim/sdk-core/context\";\n\nexport interface LoginOptions {\n address: Address;\n}\n\nexport class AuthClient {\n constructor(\n private readonly apiClient: APIClient,\n private readonly account: OtimAccount,\n private readonly context: OtimClientContext,\n ) {}\n\n async login({ address }: LoginOptions): Promise<AuthLoginResponse> {\n assertRequiresAuth(this.context);\n\n const message = createLoginSiweMessage(address, Date.now().toString());\n const signature = await this.account.signMessage({ message });\n const vrsParsedSignature = parseSignatureToVRS(signature);\n\n const response = await this.apiClient.auth.login({\n siwe: message,\n signature: vrsParsedSignature,\n });\n\n return response.data;\n }\n\n async getCurrentUser(): Promise<MeResponse> {\n const response = await this.apiClient.auth.me();\n return response.data;\n }\n}\n","import type {\n APIClient,\n GetMaxPriorityFeePerGasEstimateRequest,\n GetMaxPriorityFeePerGasEstimateResponse,\n} from \"@otim/utils/api\";\n\nexport class ConfigClient {\n constructor(private readonly apiClient: APIClient) {}\n\n async getMaxPriorityFeeEstimate({\n chainId,\n }: GetMaxPriorityFeePerGasEstimateRequest): Promise<GetMaxPriorityFeePerGasEstimateResponse> {\n const response =\n await this.apiClient.config.getMaxPriorityFeePerGasEstimate({ chainId });\n\n return response.data;\n }\n}\n","import type {\n APIClient,\n DelegationCreateRequest,\n DelegationStatusRequest,\n DelegationStatusResponse,\n GetDelegateAddressRequest,\n GetDelegateAddressResponse,\n} from \"@otim/utils/api\";\n\nexport class DelegationClient {\n constructor(private readonly apiClient: APIClient) {}\n\n async getDelegateAddress({\n chainId,\n }: GetDelegateAddressRequest): Promise<GetDelegateAddressResponse> {\n const response = await this.apiClient.config.getDelegateAddress({\n chainId,\n });\n\n return response.data;\n }\n\n async getDelegationStatus(\n options: DelegationStatusRequest,\n ): Promise<DelegationStatusResponse> {\n const response = await this.apiClient.account.getDelegationStatus({\n address: options.address,\n chainId: options.chainId,\n });\n\n return response.data;\n }\n\n async createDelegation(\n delegationRequest: DelegationCreateRequest,\n ): Promise<void> {\n await this.apiClient.account.createDelegation(delegationRequest);\n }\n}\n","import type { OtimServerClientContext } from \"@otim/sdk-core/context\";\nimport type { PaymentResponseWithActionNames } from \"@otim/utils/payments\";\nimport type { Address } from \"@otim/utils/schemas\";\nimport type { PublicClient } from \"viem\";\n\nimport {\n ApiKeyClientSigningService,\n ServerWalletSigningService,\n UnifiedPaymentSigner,\n} from \"@otim/turnkey/signing\";\nimport { createWalletClient, http } from \"viem\";\nimport { privateKeyToAccount } from \"viem/accounts\";\n\nimport { isApiAccountConfig } from \"@otim/sdk-core/account\";\n\nexport interface CreateSettlementSignerParams {\n context: OtimServerClientContext;\n buildResponse: PaymentResponseWithActionNames;\n publicClient: PublicClient;\n delegateAddressMap: Map<number, Address>;\n}\n\ntype CreateSettlementSignerResult = Awaited<\n ReturnType<UnifiedPaymentSigner[\"signAll\"]>\n>;\n\nexport async function createSettlementSigner(\n params: CreateSettlementSignerParams,\n): Promise<CreateSettlementSignerResult> {\n const { context, buildResponse, publicClient, delegateAddressMap } = params;\n\n if (isApiAccountConfig(context.config)) {\n const signingService = new ApiKeyClientSigningService(\n context.config.publicKey,\n context.config.privateKey,\n );\n\n const signer = new UnifiedPaymentSigner({\n buildResponse,\n signingService,\n publicClient,\n delegateAddressMap,\n });\n\n return signer.signAll();\n }\n\n const account = privateKeyToAccount(context.config.privateKey);\n const walletClient = createWalletClient({\n account,\n transport: http(),\n });\n\n const signingService =\n ServerWalletSigningService.fromViemWallet(walletClient);\n\n const signer = new UnifiedPaymentSigner({\n buildResponse,\n signingService,\n publicClient,\n delegateAddressMap,\n });\n\n return signer.signAll();\n}\n","import type { OtimAccount } from \"@otim/sdk-core/account\";\nimport type { OtimServerClientContext } from \"@otim/sdk-core/context\";\nimport type {\n APIClient,\n GetPaymentRequestsRequest,\n GetPaymentRequestsResponse,\n PaginatedServiceResponse,\n PaymentRequestBuildRequest,\n PaymentRequestDetailsRequest,\n PaymentRequestDetailsResponse,\n ServiceResponse,\n} from \"@otim/utils/api\";\nimport type { PaymentResponseWithActionNames } from \"@otim/utils/payments\";\nimport type { Address } from \"@otim/utils/schemas\";\nimport type { PublicClient } from \"viem\";\n\nimport { getChainById } from \"@otim/utils/chains\";\nimport {\n addActionNamesToInstructions,\n extractActionNamesMap,\n} from \"@otim/utils/payments\";\nimport { hexStringSchema } from \"@otim/utils/schemas\";\nimport { createPublicClient, http } from \"viem\";\n\nimport { assertServerContext } from \"@otim/sdk-core/context\";\n\nimport { createSettlementSigner } from \"./helpers/settlement-signer\";\nimport type { PreparedSettlement } from \"./helpers/prepare-settlement\";\n\nexport type { PreparedSettlement } from \"./helpers/prepare-settlement\";\n\nexport interface CreateSettlementResponse {\n requestId: string;\n ephemeralWalletAddress: Address;\n}\n\ntype SettlementInstruction =\n PaymentResponseWithActionNames[\"completionInstructions\"][number];\n\nexport class OrchestrationClient {\n constructor(\n private readonly apiClient: APIClient,\n private readonly account: OtimAccount,\n private readonly context: OtimServerClientContext,\n ) {}\n\n async create(\n preparedSettlement: PreparedSettlement,\n ): Promise<CreateSettlementResponse> {\n assertServerContext(this.context);\n\n const { payload, chainId } = preparedSettlement;\n\n const buildResponse = await this.buildAndEnhanceSettlement(payload);\n await this.activate(buildResponse, chainId);\n\n return {\n requestId: buildResponse.requestId,\n ephemeralWalletAddress: buildResponse.ephemeralWalletAddress,\n };\n }\n\n async getDetails(\n request: PaymentRequestDetailsRequest,\n ): Promise<ServiceResponse<PaymentRequestDetailsResponse>> {\n return this.apiClient.payments.getPaymentRequestDetails(request);\n }\n\n async list(\n request: GetPaymentRequestsRequest,\n ): Promise<PaginatedServiceResponse<GetPaymentRequestsResponse>> {\n return this.apiClient.payments.getPaymentRequests(request);\n }\n\n private async activate(\n buildResponse: PaymentResponseWithActionNames,\n settlementChainId: number,\n ): Promise<void> {\n const publicClient = this.createPublicClient(settlementChainId);\n\n const instructions = [\n ...buildResponse.completionInstructions,\n ...buildResponse.instructions,\n ];\n\n const delegateAddressMap = await this.fetchDelegateAddresses(instructions);\n\n const {\n signedAuthorization,\n completionInstructions,\n instructions: signedInstructions,\n } = await createSettlementSigner({\n context: this.context,\n buildResponse,\n publicClient,\n delegateAddressMap,\n });\n\n await this.apiClient.payments.newPaymentRequest({\n requestId: buildResponse.requestId,\n signedAuthorization,\n completionInstructions,\n instructions: signedInstructions,\n });\n }\n\n private async buildAndEnhanceSettlement(\n payload: PaymentRequestBuildRequest,\n ): Promise<PaymentResponseWithActionNames> {\n const actionNames = extractActionNamesMap(\n payload.completionInstructions,\n payload.instructions,\n );\n\n const response = await this.apiClient.payments.buildPaymentRequest(payload);\n\n return addActionNamesToInstructions(response.data, actionNames);\n }\n\n private createPublicClient(chainId: number): PublicClient {\n const chain = getChainById(chainId);\n if (!chain) {\n throw new Error(`Chain with id ${chainId} not found`);\n }\n\n return createPublicClient({ chain, transport: http() });\n }\n\n private async fetchDelegateAddresses(\n instructions: SettlementInstruction[],\n ): Promise<Map<number, Address>> {\n const chainIds = Array.from(\n new Set(instructions.map((instruction) => instruction.chainId)),\n );\n\n const addresses = await Promise.all(\n chainIds.map(async (chainId) => {\n const response = await this.apiClient.config.getDelegateAddress({\n chainId,\n });\n const address = hexStringSchema.parse(\n response.data.otimDelegateAddress,\n );\n return [chainId, address] as const;\n }),\n );\n\n return new Map(addresses);\n }\n}\n","import type { PaymentRequestBuildRequest } from \"@otim/utils/api\";\nimport type { SupportedChainId } from \"@otim/utils/chains\";\nimport type { Nullable } from \"@otim/utils/helpers\";\nimport type { PaymentRequestMetadata } from \"@otim/utils/payments\";\nimport type { Address } from \"@otim/utils/schemas\";\n\nimport {\n getChainTokens,\n getTokenAddress,\n getTokenMetadata,\n supportedChains,\n} from \"@otim/utils/chains\";\nimport { validateIso8601Date } from \"@otim/utils/helpers\";\nimport {\n buildPaymentMetadata,\n createChainTokenConfigs,\n createComprehensivePaymentRequest,\n} from \"@otim/utils/payments\";\nimport { hexStringSchema } from \"@otim/utils/schemas\";\n\nexport interface PrepareSettlementParams {\n amount: number;\n chainId: SupportedChainId;\n recipient: Address;\n token?: \"USDC\" | \"USDT\";\n payer?: Nullable<Address>;\n dueDate?: string;\n metadata?: PaymentRequestMetadata;\n note?: string;\n maxRuns?: number;\n}\n\nexport interface PreparedSettlement {\n payload: PaymentRequestBuildRequest;\n chainId: number;\n}\n\nfunction validateAndGetTokenAddress(chainId: number, token: string): Address {\n const tokenAddress = getTokenAddress(chainId, token);\n if (!tokenAddress) {\n throw new Error(`Token ${token} not supported on chain ${chainId}`);\n }\n\n const tokenMetadata = getTokenMetadata(token);\n if (!tokenMetadata) {\n throw new Error(`Token ${token} metadata not found`);\n }\n\n return hexStringSchema.parse(tokenAddress);\n}\n\nfunction buildMetadataFromParams(params: {\n token: string;\n amount: number;\n recipient: Address;\n note?: string;\n dueDate?: string;\n customMetadata?: PaymentRequestMetadata;\n}): PaymentRequestMetadata {\n const { token, amount, recipient, note, dueDate, customMetadata } = params;\n\n const baseMetadata = buildPaymentMetadata({\n tokenSymbol: token,\n amountInUSD: amount,\n fromAccountAddress: recipient,\n note,\n dueDate,\n hasInvoiceMetadata: false,\n });\n\n return customMetadata ? { ...baseMetadata, ...customMetadata } : baseMetadata;\n}\n\nfunction createPayload(params: {\n chainId: number;\n recipient: Address;\n amount: number;\n payer?: Address | null;\n metadata: PaymentRequestMetadata;\n feeTokenAddress: Address;\n maxRuns?: number;\n}): PaymentRequestBuildRequest {\n const {\n chainId,\n recipient,\n amount,\n payer,\n metadata,\n feeTokenAddress,\n maxRuns,\n } = params;\n\n const tokens = Object.values(supportedChains.mainnet).flatMap((chain) =>\n getChainTokens(chain.id),\n );\n\n const chainTokenConfigs = createChainTokenConfigs(tokens);\n\n return createComprehensivePaymentRequest({\n settlementChainId: chainId,\n recipient,\n amount: amount.toString(),\n ephemeralWalletAddress: recipient,\n chainTokenConfigs,\n payerAddress: payer ?? null,\n metadata,\n feeToken: feeTokenAddress,\n maxRuns,\n });\n}\n\nexport function prepareSettlement(\n params: PrepareSettlementParams,\n): PreparedSettlement {\n const {\n chainId,\n token = \"USDC\",\n recipient,\n amount,\n payer,\n note,\n dueDate,\n metadata: customMetadata,\n maxRuns,\n } = params;\n\n if (dueDate) {\n validateIso8601Date(dueDate);\n }\n\n const feeTokenAddress = validateAndGetTokenAddress(chainId, token);\n const metadata = buildMetadataFromParams({\n token,\n amount,\n recipient,\n note,\n dueDate,\n customMetadata,\n });\n\n const payload = createPayload({\n chainId,\n recipient,\n amount,\n payer,\n metadata,\n feeTokenAddress,\n maxRuns,\n });\n\n return { payload, chainId };\n}\n"],"mappings":";;;;;;;;;;;;AAMA,IAA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oCAAgB,QAAQ,CAAC,SAAS,kDAC9C,MAAM,GAAG,CACzB,CAEwD;AAEzD,qEAAyC;EACvC,mBAAmB;EACnB;EACA,QAAQ,OAAO,UAAU;EACzB,wBAAwB;EACxB;EACA,cAAc,SAAS;EACvB;EACA,UAAU;EACV;EACD,CAAC;;AAGJ,SAAgB,kBACd,QACoB;CACpB,MAAM,EACJ,SACA,QAAQ,QACR,WACA,QACA,OACA,MACA,SACA,UAAU,gBACV,YACE;AAEJ,KAAI,QACF,+CAAoB,QAAQ;CAG9B,MAAM,kBAAkB,2BAA2B,SAAS,MAAM;AAoBlE,QAAO;EAAE,SAVO,cAAc;GAC5B;GACA;GACA;GACA;GACA,UAde,wBAAwB;IACvC;IACA;IACA;IACA;IACA;IACA;IACD,CAAC;GAQA;GACA;GACD,CAAC;EAEgB;EAAS"}
@@ -73,8 +73,8 @@ var DelegationClient = class {
73
73
  };
74
74
 
75
75
  //#endregion
76
- //#region src/clients/helpers/payment-signer.ts
77
- async function createPaymentSigner(params) {
76
+ //#region src/clients/helpers/settlement-signer.ts
77
+ async function createSettlementSigner(params) {
78
78
  const { context, buildResponse, publicClient, delegateAddressMap } = params;
79
79
  if (isApiAccountConfig(context.config)) return new UnifiedPaymentSigner({
80
80
  buildResponse,
@@ -102,10 +102,10 @@ var OrchestrationClient = class {
102
102
  this.account = account;
103
103
  this.context = context;
104
104
  }
105
- async create(preparedRequest) {
105
+ async create(preparedSettlement) {
106
106
  assertServerContext(this.context);
107
- const { payload, chainId } = preparedRequest;
108
- const buildResponse = await this.buildAndEnhancePaymentRequest(payload);
107
+ const { payload, chainId } = preparedSettlement;
108
+ const buildResponse = await this.buildAndEnhanceSettlement(payload);
109
109
  await this.activate(buildResponse, chainId);
110
110
  return {
111
111
  requestId: buildResponse.requestId,
@@ -122,7 +122,7 @@ var OrchestrationClient = class {
122
122
  const publicClient = this.createPublicClient(settlementChainId);
123
123
  const instructions = [...buildResponse.completionInstructions, ...buildResponse.instructions];
124
124
  const delegateAddressMap = await this.fetchDelegateAddresses(instructions);
125
- const { signedAuthorization, completionInstructions, instructions: signedInstructions } = await createPaymentSigner({
125
+ const { signedAuthorization, completionInstructions, instructions: signedInstructions } = await createSettlementSigner({
126
126
  context: this.context,
127
127
  buildResponse,
128
128
  publicClient,
@@ -135,7 +135,7 @@ var OrchestrationClient = class {
135
135
  instructions: signedInstructions
136
136
  });
137
137
  }
138
- async buildAndEnhancePaymentRequest(payload) {
138
+ async buildAndEnhanceSettlement(payload) {
139
139
  const actionNames = extractActionNamesMap(payload.completionInstructions, payload.instructions);
140
140
  return addActionNamesToInstructions((await this.apiClient.payments.buildPaymentRequest(payload)).data, actionNames);
141
141
  }
@@ -158,7 +158,7 @@ var OrchestrationClient = class {
158
158
  };
159
159
 
160
160
  //#endregion
161
- //#region src/clients/helpers/prepare-payment-request.ts
161
+ //#region src/clients/helpers/prepare-settlement.ts
162
162
  function validateAndGetTokenAddress(chainId, token) {
163
163
  const tokenAddress = getTokenAddress(chainId, token);
164
164
  if (!tokenAddress) throw new Error(`Token ${token} not supported on chain ${chainId}`);
@@ -195,7 +195,7 @@ function createPayload(params) {
195
195
  maxRuns
196
196
  });
197
197
  }
198
- function preparePaymentRequest(params) {
198
+ function prepareSettlement(params) {
199
199
  const { chainId, token = "USDC", recipient, amount, payer, note, dueDate, metadata: customMetadata, maxRuns } = params;
200
200
  if (dueDate) validateIso8601Date(dueDate);
201
201
  const feeTokenAddress = validateAndGetTokenAddress(chainId, token);
@@ -221,5 +221,5 @@ function preparePaymentRequest(params) {
221
221
  }
222
222
 
223
223
  //#endregion
224
- export { AuthClient as a, ConfigClient as i, OrchestrationClient as n, ActivityClient as o, DelegationClient as r, preparePaymentRequest as t };
225
- //# sourceMappingURL=clients-Bn4BUElo.mjs.map
224
+ export { AuthClient as a, ConfigClient as i, OrchestrationClient as n, ActivityClient as o, DelegationClient as r, prepareSettlement as t };
225
+ //# sourceMappingURL=clients-vDKBJkXx.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"clients-vDKBJkXx.mjs","names":["apiClient: APIClient","apiClient: APIClient","account: OtimAccount","context: OtimClientContext","apiClient: APIClient","apiClient: APIClient","apiClient: APIClient","account: OtimAccount","context: OtimServerClientContext"],"sources":["../src/clients/activity.ts","../src/clients/auth.ts","../src/clients/config.ts","../src/clients/delegation.ts","../src/clients/helpers/settlement-signer.ts","../src/clients/orchestration.ts","../src/clients/helpers/prepare-settlement.ts"],"sourcesContent":["import type {\n APIClient,\n GetInstructionActivityRequest,\n GetInstructionActivityResponse,\n} from \"@otim/utils/api\";\n\nexport class ActivityClient {\n constructor(private readonly apiClient: APIClient) {}\n\n async getInstructionActivity(\n request: GetInstructionActivityRequest,\n ): Promise<GetInstructionActivityResponse> {\n const response =\n await this.apiClient.activity.getInstructionActivity(request);\n\n return response.data;\n }\n}\n","import type { OtimAccount } from \"@otim/sdk-core/account\";\nimport type { OtimClientContext } from \"@otim/sdk-core/context\";\nimport type { APIClient, AuthLoginResponse, MeResponse } from \"@otim/utils/api\";\nimport type { Address } from \"viem\";\n\nimport { parseSignatureToVRS } from \"@otim/utils/helpers\";\n\nimport { createLoginSiweMessage } from \"@otim/sdk-core/config\";\nimport { assertRequiresAuth } from \"@otim/sdk-core/context\";\n\nexport interface LoginOptions {\n address: Address;\n}\n\nexport class AuthClient {\n constructor(\n private readonly apiClient: APIClient,\n private readonly account: OtimAccount,\n private readonly context: OtimClientContext,\n ) {}\n\n async login({ address }: LoginOptions): Promise<AuthLoginResponse> {\n assertRequiresAuth(this.context);\n\n const message = createLoginSiweMessage(address, Date.now().toString());\n const signature = await this.account.signMessage({ message });\n const vrsParsedSignature = parseSignatureToVRS(signature);\n\n const response = await this.apiClient.auth.login({\n siwe: message,\n signature: vrsParsedSignature,\n });\n\n return response.data;\n }\n\n async getCurrentUser(): Promise<MeResponse> {\n const response = await this.apiClient.auth.me();\n return response.data;\n }\n}\n","import type {\n APIClient,\n GetMaxPriorityFeePerGasEstimateRequest,\n GetMaxPriorityFeePerGasEstimateResponse,\n} from \"@otim/utils/api\";\n\nexport class ConfigClient {\n constructor(private readonly apiClient: APIClient) {}\n\n async getMaxPriorityFeeEstimate({\n chainId,\n }: GetMaxPriorityFeePerGasEstimateRequest): Promise<GetMaxPriorityFeePerGasEstimateResponse> {\n const response =\n await this.apiClient.config.getMaxPriorityFeePerGasEstimate({ chainId });\n\n return response.data;\n }\n}\n","import type {\n APIClient,\n DelegationCreateRequest,\n DelegationStatusRequest,\n DelegationStatusResponse,\n GetDelegateAddressRequest,\n GetDelegateAddressResponse,\n} from \"@otim/utils/api\";\n\nexport class DelegationClient {\n constructor(private readonly apiClient: APIClient) {}\n\n async getDelegateAddress({\n chainId,\n }: GetDelegateAddressRequest): Promise<GetDelegateAddressResponse> {\n const response = await this.apiClient.config.getDelegateAddress({\n chainId,\n });\n\n return response.data;\n }\n\n async getDelegationStatus(\n options: DelegationStatusRequest,\n ): Promise<DelegationStatusResponse> {\n const response = await this.apiClient.account.getDelegationStatus({\n address: options.address,\n chainId: options.chainId,\n });\n\n return response.data;\n }\n\n async createDelegation(\n delegationRequest: DelegationCreateRequest,\n ): Promise<void> {\n await this.apiClient.account.createDelegation(delegationRequest);\n }\n}\n","import type { OtimServerClientContext } from \"@otim/sdk-core/context\";\nimport type { PaymentResponseWithActionNames } from \"@otim/utils/payments\";\nimport type { Address } from \"@otim/utils/schemas\";\nimport type { PublicClient } from \"viem\";\n\nimport {\n ApiKeyClientSigningService,\n ServerWalletSigningService,\n UnifiedPaymentSigner,\n} from \"@otim/turnkey/signing\";\nimport { createWalletClient, http } from \"viem\";\nimport { privateKeyToAccount } from \"viem/accounts\";\n\nimport { isApiAccountConfig } from \"@otim/sdk-core/account\";\n\nexport interface CreateSettlementSignerParams {\n context: OtimServerClientContext;\n buildResponse: PaymentResponseWithActionNames;\n publicClient: PublicClient;\n delegateAddressMap: Map<number, Address>;\n}\n\ntype CreateSettlementSignerResult = Awaited<\n ReturnType<UnifiedPaymentSigner[\"signAll\"]>\n>;\n\nexport async function createSettlementSigner(\n params: CreateSettlementSignerParams,\n): Promise<CreateSettlementSignerResult> {\n const { context, buildResponse, publicClient, delegateAddressMap } = params;\n\n if (isApiAccountConfig(context.config)) {\n const signingService = new ApiKeyClientSigningService(\n context.config.publicKey,\n context.config.privateKey,\n );\n\n const signer = new UnifiedPaymentSigner({\n buildResponse,\n signingService,\n publicClient,\n delegateAddressMap,\n });\n\n return signer.signAll();\n }\n\n const account = privateKeyToAccount(context.config.privateKey);\n const walletClient = createWalletClient({\n account,\n transport: http(),\n });\n\n const signingService =\n ServerWalletSigningService.fromViemWallet(walletClient);\n\n const signer = new UnifiedPaymentSigner({\n buildResponse,\n signingService,\n publicClient,\n delegateAddressMap,\n });\n\n return signer.signAll();\n}\n","import type { OtimAccount } from \"@otim/sdk-core/account\";\nimport type { OtimServerClientContext } from \"@otim/sdk-core/context\";\nimport type {\n APIClient,\n GetPaymentRequestsRequest,\n GetPaymentRequestsResponse,\n PaginatedServiceResponse,\n PaymentRequestBuildRequest,\n PaymentRequestDetailsRequest,\n PaymentRequestDetailsResponse,\n ServiceResponse,\n} from \"@otim/utils/api\";\nimport type { PaymentResponseWithActionNames } from \"@otim/utils/payments\";\nimport type { Address } from \"@otim/utils/schemas\";\nimport type { PublicClient } from \"viem\";\n\nimport { getChainById } from \"@otim/utils/chains\";\nimport {\n addActionNamesToInstructions,\n extractActionNamesMap,\n} from \"@otim/utils/payments\";\nimport { hexStringSchema } from \"@otim/utils/schemas\";\nimport { createPublicClient, http } from \"viem\";\n\nimport { assertServerContext } from \"@otim/sdk-core/context\";\n\nimport { createSettlementSigner } from \"./helpers/settlement-signer\";\nimport type { PreparedSettlement } from \"./helpers/prepare-settlement\";\n\nexport type { PreparedSettlement } from \"./helpers/prepare-settlement\";\n\nexport interface CreateSettlementResponse {\n requestId: string;\n ephemeralWalletAddress: Address;\n}\n\ntype SettlementInstruction =\n PaymentResponseWithActionNames[\"completionInstructions\"][number];\n\nexport class OrchestrationClient {\n constructor(\n private readonly apiClient: APIClient,\n private readonly account: OtimAccount,\n private readonly context: OtimServerClientContext,\n ) {}\n\n async create(\n preparedSettlement: PreparedSettlement,\n ): Promise<CreateSettlementResponse> {\n assertServerContext(this.context);\n\n const { payload, chainId } = preparedSettlement;\n\n const buildResponse = await this.buildAndEnhanceSettlement(payload);\n await this.activate(buildResponse, chainId);\n\n return {\n requestId: buildResponse.requestId,\n ephemeralWalletAddress: buildResponse.ephemeralWalletAddress,\n };\n }\n\n async getDetails(\n request: PaymentRequestDetailsRequest,\n ): Promise<ServiceResponse<PaymentRequestDetailsResponse>> {\n return this.apiClient.payments.getPaymentRequestDetails(request);\n }\n\n async list(\n request: GetPaymentRequestsRequest,\n ): Promise<PaginatedServiceResponse<GetPaymentRequestsResponse>> {\n return this.apiClient.payments.getPaymentRequests(request);\n }\n\n private async activate(\n buildResponse: PaymentResponseWithActionNames,\n settlementChainId: number,\n ): Promise<void> {\n const publicClient = this.createPublicClient(settlementChainId);\n\n const instructions = [\n ...buildResponse.completionInstructions,\n ...buildResponse.instructions,\n ];\n\n const delegateAddressMap = await this.fetchDelegateAddresses(instructions);\n\n const {\n signedAuthorization,\n completionInstructions,\n instructions: signedInstructions,\n } = await createSettlementSigner({\n context: this.context,\n buildResponse,\n publicClient,\n delegateAddressMap,\n });\n\n await this.apiClient.payments.newPaymentRequest({\n requestId: buildResponse.requestId,\n signedAuthorization,\n completionInstructions,\n instructions: signedInstructions,\n });\n }\n\n private async buildAndEnhanceSettlement(\n payload: PaymentRequestBuildRequest,\n ): Promise<PaymentResponseWithActionNames> {\n const actionNames = extractActionNamesMap(\n payload.completionInstructions,\n payload.instructions,\n );\n\n const response = await this.apiClient.payments.buildPaymentRequest(payload);\n\n return addActionNamesToInstructions(response.data, actionNames);\n }\n\n private createPublicClient(chainId: number): PublicClient {\n const chain = getChainById(chainId);\n if (!chain) {\n throw new Error(`Chain with id ${chainId} not found`);\n }\n\n return createPublicClient({ chain, transport: http() });\n }\n\n private async fetchDelegateAddresses(\n instructions: SettlementInstruction[],\n ): Promise<Map<number, Address>> {\n const chainIds = Array.from(\n new Set(instructions.map((instruction) => instruction.chainId)),\n );\n\n const addresses = await Promise.all(\n chainIds.map(async (chainId) => {\n const response = await this.apiClient.config.getDelegateAddress({\n chainId,\n });\n const address = hexStringSchema.parse(\n response.data.otimDelegateAddress,\n );\n return [chainId, address] as const;\n }),\n );\n\n return new Map(addresses);\n }\n}\n","import type { PaymentRequestBuildRequest } from \"@otim/utils/api\";\nimport type { SupportedChainId } from \"@otim/utils/chains\";\nimport type { Nullable } from \"@otim/utils/helpers\";\nimport type { PaymentRequestMetadata } from \"@otim/utils/payments\";\nimport type { Address } from \"@otim/utils/schemas\";\n\nimport {\n getChainTokens,\n getTokenAddress,\n getTokenMetadata,\n supportedChains,\n} from \"@otim/utils/chains\";\nimport { validateIso8601Date } from \"@otim/utils/helpers\";\nimport {\n buildPaymentMetadata,\n createChainTokenConfigs,\n createComprehensivePaymentRequest,\n} from \"@otim/utils/payments\";\nimport { hexStringSchema } from \"@otim/utils/schemas\";\n\nexport interface PrepareSettlementParams {\n amount: number;\n chainId: SupportedChainId;\n recipient: Address;\n token?: \"USDC\" | \"USDT\";\n payer?: Nullable<Address>;\n dueDate?: string;\n metadata?: PaymentRequestMetadata;\n note?: string;\n maxRuns?: number;\n}\n\nexport interface PreparedSettlement {\n payload: PaymentRequestBuildRequest;\n chainId: number;\n}\n\nfunction validateAndGetTokenAddress(chainId: number, token: string): Address {\n const tokenAddress = getTokenAddress(chainId, token);\n if (!tokenAddress) {\n throw new Error(`Token ${token} not supported on chain ${chainId}`);\n }\n\n const tokenMetadata = getTokenMetadata(token);\n if (!tokenMetadata) {\n throw new Error(`Token ${token} metadata not found`);\n }\n\n return hexStringSchema.parse(tokenAddress);\n}\n\nfunction buildMetadataFromParams(params: {\n token: string;\n amount: number;\n recipient: Address;\n note?: string;\n dueDate?: string;\n customMetadata?: PaymentRequestMetadata;\n}): PaymentRequestMetadata {\n const { token, amount, recipient, note, dueDate, customMetadata } = params;\n\n const baseMetadata = buildPaymentMetadata({\n tokenSymbol: token,\n amountInUSD: amount,\n fromAccountAddress: recipient,\n note,\n dueDate,\n hasInvoiceMetadata: false,\n });\n\n return customMetadata ? { ...baseMetadata, ...customMetadata } : baseMetadata;\n}\n\nfunction createPayload(params: {\n chainId: number;\n recipient: Address;\n amount: number;\n payer?: Address | null;\n metadata: PaymentRequestMetadata;\n feeTokenAddress: Address;\n maxRuns?: number;\n}): PaymentRequestBuildRequest {\n const {\n chainId,\n recipient,\n amount,\n payer,\n metadata,\n feeTokenAddress,\n maxRuns,\n } = params;\n\n const tokens = Object.values(supportedChains.mainnet).flatMap((chain) =>\n getChainTokens(chain.id),\n );\n\n const chainTokenConfigs = createChainTokenConfigs(tokens);\n\n return createComprehensivePaymentRequest({\n settlementChainId: chainId,\n recipient,\n amount: amount.toString(),\n ephemeralWalletAddress: recipient,\n chainTokenConfigs,\n payerAddress: payer ?? null,\n metadata,\n feeToken: feeTokenAddress,\n maxRuns,\n });\n}\n\nexport function prepareSettlement(\n params: PrepareSettlementParams,\n): PreparedSettlement {\n const {\n chainId,\n token = \"USDC\",\n recipient,\n amount,\n payer,\n note,\n dueDate,\n metadata: customMetadata,\n maxRuns,\n } = params;\n\n if (dueDate) {\n validateIso8601Date(dueDate);\n }\n\n const feeTokenAddress = validateAndGetTokenAddress(chainId, token);\n const metadata = buildMetadataFromParams({\n token,\n amount,\n recipient,\n note,\n dueDate,\n customMetadata,\n });\n\n const payload = createPayload({\n chainId,\n recipient,\n amount,\n payer,\n metadata,\n feeTokenAddress,\n maxRuns,\n });\n\n return { payload, chainId };\n}\n"],"mappings":";;;;;;;;;;;;AAMA,IAAa,iBAAb,MAA4B;CAC1B,YAAY,AAAiBA,WAAsB;EAAtB;;CAE7B,MAAM,uBACJ,SACyC;AAIzC,UAFE,MAAM,KAAK,UAAU,SAAS,uBAAuB,QAAQ,EAE/C;;;;;;ACDpB,IAAa,aAAb,M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kC;EACvC,mBAAmB;EACnB;EACA,QAAQ,OAAO,UAAU;EACzB,wBAAwB;EACxB;EACA,cAAc,SAAS;EACvB;EACA,UAAU;EACV;EACD,CAAC;;AAGJ,SAAgB,kBACd,QACoB;CACpB,MAAM,EACJ,SACA,QAAQ,QACR,WACA,QACA,OACA,MACA,SACA,UAAU,gBACV,YACE;AAEJ,KAAI,QACF,qBAAoB,QAAQ;CAG9B,MAAM,kBAAkB,2BAA2B,SAAS,MAAM;AAoBlE,QAAO;EAAE,SAVO,cAAc;GAC5B;GACA;GACA;GACA;GACA,UAde,wBAAwB;IACvC;IACA;IACA;IACA;IACA;IACA;IACD,CAAC;GAQA;GACA;GACD,CAAC;EAEgB;EAAS"}
@@ -49,8 +49,8 @@ declare class DelegationClient {
49
49
  createDelegation(delegationRequest: DelegationCreateRequest): Promise<void>;
50
50
  }
51
51
  //#endregion
52
- //#region src/clients/helpers/prepare-payment-request.d.ts
53
- interface PreparePaymentRequestParams {
52
+ //#region src/clients/helpers/prepare-settlement.d.ts
53
+ interface PrepareSettlementParams {
54
54
  amount: number;
55
55
  chainId: SupportedChainId;
56
56
  recipient: Address;
@@ -61,14 +61,14 @@ interface PreparePaymentRequestParams {
61
61
  note?: string;
62
62
  maxRuns?: number;
63
63
  }
64
- interface PreparedPaymentRequest {
64
+ interface PreparedSettlement {
65
65
  payload: PaymentRequestBuildRequest;
66
66
  chainId: number;
67
67
  }
68
- declare function preparePaymentRequest(params: PreparePaymentRequestParams): PreparedPaymentRequest;
68
+ declare function prepareSettlement(params: PrepareSettlementParams): PreparedSettlement;
69
69
  //#endregion
70
70
  //#region src/clients/orchestration.d.ts
71
- interface CreatePaymentRequestResponse {
71
+ interface CreateSettlementResponse {
72
72
  requestId: string;
73
73
  ephemeralWalletAddress: Address;
74
74
  }
@@ -77,14 +77,14 @@ declare class OrchestrationClient {
77
77
  private readonly account;
78
78
  private readonly context;
79
79
  constructor(apiClient: APIClient, account: OtimAccount, context: OtimServerClientContext);
80
- create(preparedRequest: PreparedPaymentRequest): Promise<CreatePaymentRequestResponse>;
80
+ create(preparedSettlement: PreparedSettlement): Promise<CreateSettlementResponse>;
81
81
  getDetails(request: PaymentRequestDetailsRequest): Promise<ServiceResponse<PaymentRequestDetailsResponse>>;
82
82
  list(request: GetPaymentRequestsRequest): Promise<PaginatedServiceResponse<GetPaymentRequestsResponse>>;
83
83
  private activate;
84
- private buildAndEnhancePaymentRequest;
84
+ private buildAndEnhanceSettlement;
85
85
  private createPublicClient;
86
86
  private fetchDelegateAddresses;
87
87
  }
88
88
  //#endregion
89
- export { preparePaymentRequest as a, AuthClient as c, PreparedPaymentRequest as i, LoginOptions as l, OrchestrationClient as n, DelegationClient as o, PreparePaymentRequestParams as r, ConfigClient as s, CreatePaymentRequestResponse as t, ActivityClient as u };
90
- //# sourceMappingURL=index-Ce_qYSJj.d.cts.map
89
+ export { prepareSettlement as a, AuthClient as c, PreparedSettlement as i, LoginOptions as l, OrchestrationClient as n, DelegationClient as o, PrepareSettlementParams as r, ConfigClient as s, CreateSettlementResponse as t, ActivityClient as u };
90
+ //# sourceMappingURL=index-CmU_0gN9.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-CmU_0gN9.d.cts","names":[],"sources":["../src/clients/activity.ts","../src/clients/auth.ts","../src/clients/config.ts","../src/clients/delegation.ts","../src/clients/helpers/prepare-settlement.ts","../src/clients/orchestration.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;cAMa,cAAA;;yBAC6B;kCAG7B,gCACR,QAAQ;;;;UCDI,YAAA;WACN;;cAGE,UAAA;;;EDRA,iBAAc,OAAA;EACe,WAAA,CAAA,SAAA,ECSV,SDTU,EAAA,OAAA,ECUZ,WDVY,EAAA,OAAA,ECWZ,iBDXY;EAG7B,KAAA,CAAA;IAAA;EAAA,CAAA,ECWc,YDXd,CAAA,ECW6B,ODX7B,CCWqC,iBDXrC,CAAA;EACA,cAAA,CAAA,CAAA,ECyBa,ODzBb,CCyBqB,UDzBrB,CAAA;;;;cELA,YAAA;;yBAC6B;;;KAIrC,yCAAyC,QAAQ;;;;cCFzC,gBAAA;;yBAC6B;;;KAIrC,4BAA4B,QAAQ;+BAS5B,0BACR,QAAQ;sCAUU,0BAClB;;;;UCfY,uBAAA;;WAEN;aACE;;EJjBA,KAAA,CAAA,EImBH,QJnBG,CImBM,OJnBQ,CAAA;EACe,OAAA,CAAA,EAAA,MAAA;EAG7B,QAAA,CAAA,EIiBA,sBJjBA;EACA,IAAA,CAAA,EAAA,MAAA;EAAR,OAAA,CAAA,EAAA,MAAA;;UIqBY,kBAAA;WACN;;AHvBX;AAIa,iBGiGG,iBAAA,CHjGO,MAAA,EGkGb,uBHlGa,CAAA,EGmGpB,kBHnGoB;;;UIiBN,wBAAA;;0BAES;;AL3Bb,cKiCA,mBAAA,CLjCc;EACe,iBAAA,SAAA;EAG7B,iBAAA,OAAA;EACA,iBAAA,OAAA;EAAR,WAAA,CAAA,SAAA,EK8B2B,SL9B3B,EAAA,OAAA,EK+ByB,WL/BzB,EAAA,OAAA,EKgCyB,uBLhCzB;EAAO,MAAA,CAAA,kBAAA,EKoCY,kBLpCZ,CAAA,EKqCP,OLrCO,CKqCC,wBLrCD,CAAA;sBKoDC,+BACR,QAAQ,gBAAgB;gBAKhB,4BACR,QAAQ,yBAAyB;;EJ5DrB,QAAA,yBACN;EAGE,QAAA,kBAAU;EAES,QAAA,sBAAA"}
@@ -49,8 +49,8 @@ declare class DelegationClient {
49
49
  createDelegation(delegationRequest: DelegationCreateRequest): Promise<void>;
50
50
  }
51
51
  //#endregion
52
- //#region src/clients/helpers/prepare-payment-request.d.ts
53
- interface PreparePaymentRequestParams {
52
+ //#region src/clients/helpers/prepare-settlement.d.ts
53
+ interface PrepareSettlementParams {
54
54
  amount: number;
55
55
  chainId: SupportedChainId;
56
56
  recipient: Address;
@@ -61,14 +61,14 @@ interface PreparePaymentRequestParams {
61
61
  note?: string;
62
62
  maxRuns?: number;
63
63
  }
64
- interface PreparedPaymentRequest {
64
+ interface PreparedSettlement {
65
65
  payload: PaymentRequestBuildRequest;
66
66
  chainId: number;
67
67
  }
68
- declare function preparePaymentRequest(params: PreparePaymentRequestParams): PreparedPaymentRequest;
68
+ declare function prepareSettlement(params: PrepareSettlementParams): PreparedSettlement;
69
69
  //#endregion
70
70
  //#region src/clients/orchestration.d.ts
71
- interface CreatePaymentRequestResponse {
71
+ interface CreateSettlementResponse {
72
72
  requestId: string;
73
73
  ephemeralWalletAddress: Address;
74
74
  }
@@ -77,14 +77,14 @@ declare class OrchestrationClient {
77
77
  private readonly account;
78
78
  private readonly context;
79
79
  constructor(apiClient: APIClient, account: OtimAccount, context: OtimServerClientContext);
80
- create(preparedRequest: PreparedPaymentRequest): Promise<CreatePaymentRequestResponse>;
80
+ create(preparedSettlement: PreparedSettlement): Promise<CreateSettlementResponse>;
81
81
  getDetails(request: PaymentRequestDetailsRequest): Promise<ServiceResponse<PaymentRequestDetailsResponse>>;
82
82
  list(request: GetPaymentRequestsRequest): Promise<PaginatedServiceResponse<GetPaymentRequestsResponse>>;
83
83
  private activate;
84
- private buildAndEnhancePaymentRequest;
84
+ private buildAndEnhanceSettlement;
85
85
  private createPublicClient;
86
86
  private fetchDelegateAddresses;
87
87
  }
88
88
  //#endregion
89
- export { preparePaymentRequest as a, AuthClient as c, PreparedPaymentRequest as i, LoginOptions as l, OrchestrationClient as n, DelegationClient as o, PreparePaymentRequestParams as r, ConfigClient as s, CreatePaymentRequestResponse as t, ActivityClient as u };
90
- //# sourceMappingURL=index-CiyyA-wd.d.mts.map
89
+ export { prepareSettlement as a, AuthClient as c, PreparedSettlement as i, LoginOptions as l, OrchestrationClient as n, DelegationClient as o, PrepareSettlementParams as r, ConfigClient as s, CreateSettlementResponse as t, ActivityClient as u };
90
+ //# sourceMappingURL=index-RhE0Wp_f.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-RhE0Wp_f.d.mts","names":[],"sources":["../src/clients/activity.ts","../src/clients/auth.ts","../src/cl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AAyB;;EJ5DrB,QAAA,yBACN;EAGE,QAAA,kBAAU;EAES,QAAA,sBAAA"}
package/dist/index.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  const require_account = require('./account-CRvC_dXT.cjs');
2
- const require_clients = require('./clients-BCyzdTLc.cjs');
2
+ const require_clients = require('./clients-CJQ7dmDL.cjs');
3
3
  const require_config = require('./config-CjGpscVk.cjs');
4
4
  const require_context = require('./context-B-Wcmhb3.cjs');
5
5
  const require_utils = require('./utils-CVQFvsfl.cjs');
@@ -29,4 +29,4 @@ exports.isPrivateKeyAccountConfig = require_account.isPrivateKeyAccountConfig;
29
29
  exports.isServerContext = require_context.isServerContext;
30
30
  exports.normalizeYParityValue = require_utils.normalizeYParityValue;
31
31
  exports.parseSignatureToVRS = require_utils.parseSignatureToVRS;
32
- exports.preparePaymentRequest = require_clients.preparePaymentRequest;
32
+ exports.prepareSettlement = require_clients.prepareSettlement;
package/dist/index.d.cts CHANGED
@@ -2,8 +2,8 @@ import "./abi-OUq-mx1W.cjs";
2
2
  import { t as Chain } from "./rpc-BDoNl1Sp.cjs";
3
3
  import "./authorization-6anhDdQX.cjs";
4
4
  import { a as AccountType, c as OtimAccountSignMessageArgs, d as ServerAccountType, i as AccountConfig, l as PrivateKeyAccountConfig, n as isApiAccountConfig, o as ApiAccountConfig, r as isPrivateKeyAccountConfig, s as OtimAccount, t as createClientContext, u as ServerAccountConfig } from "./index-C8H-BPGH.cjs";
5
- import { a as preparePaymentRequest, c as AuthClient, i as PreparedPaymentRequest, l as LoginOptions, n as OrchestrationClient, o as DelegationClient, r as PreparePaymentRequestParams, s as ConfigClient, t as CreatePaymentRequestResponse, u as ActivityClient } from "./index-Ce_qYSJj.cjs";
5
+ import { a as prepareSettlement, c as AuthClient, i as PreparedSettlement, l as LoginOptions, n as OrchestrationClient, o as DelegationClient, r as PrepareSettlementParams, s as ConfigClient, t as CreateSettlementResponse, u as ActivityClient } from "./index-CmU_0gN9.cjs";
6
6
  import { a as env, c as isEnvironment, i as Environment, n as SIWE_VERSION, o as getApiUrl, r as createLoginSiweMessage, s as getTurnkeyApiUrl, t as SIWE_CHAIN_ID } from "./index-lW-Oor1B.cjs";
7
7
  import { a as OtimReactClientContext, i as OtimClientContext, n as assertRequiresAuth, o as OtimServerClientContext, r as assertServerContext, t as isServerContext } from "./index-GSspyLr3.cjs";
8
8
  import { i as normalizeYParityValue, n as parseSignatureToVRS, r as createRlpEncodedAuthorization, t as createEIP2098Signature } from "./index-BQMXYh9N.cjs";
9
- export { AccountConfig, AccountType, ActivityClient, ApiAccountConfig, AuthClient, Chain, ConfigClient, CreatePaymentRequestResponse, DelegationClient, Environment, Environment as EnvironmentType, LoginOptions, OrchestrationClient, OtimAccount, OtimAccountSignMessageArgs, OtimClientContext, OtimReactClientContext, OtimServerClientContext, PreparePaymentRequestParams, PreparedPaymentRequest, PrivateKeyAccountConfig, SIWE_CHAIN_ID, SIWE_VERSION, ServerAccountConfig, ServerAccountType, assertRequiresAuth, assertServerContext, createClientContext, createEIP2098Signature, createLoginSiweMessage, createRlpEncodedAuthorization, env, getApiUrl, getTurnkeyApiUrl, isApiAccountConfig, isEnvironment, isPrivateKeyAccountConfig, isServerContext, normalizeYParityValue, parseSignatureToVRS, preparePaymentRequest };
9
+ export { AccountConfig, AccountType, ActivityClient, ApiAccountConfig, AuthClient, Chain, ConfigClient, CreateSettlementResponse, DelegationClient, Environment, Environment as EnvironmentType, LoginOptions, OrchestrationClient, OtimAccount, OtimAccountSignMessageArgs, OtimClientContext, OtimReactClientContext, OtimServerClientContext, PrepareSettlementParams, PreparedSettlement, PrivateKeyAccountConfig, SIWE_CHAIN_ID, SIWE_VERSION, ServerAccountConfig, ServerAccountType, assertRequiresAuth, assertServerContext, createClientContext, createEIP2098Signature, createLoginSiweMessage, createRlpEncodedAuthorization, env, getApiUrl, getTurnkeyApiUrl, isApiAccountConfig, isEnvironment, isPrivateKeyAccountConfig, isServerContext, normalizeYParityValue, parseSignatureToVRS, prepareSettlement };
package/dist/index.d.mts CHANGED
@@ -2,8 +2,8 @@ import "./abi-DW6AS0eM.mjs";
2
2
  import { t as Chain } from "./rpc-CygBD_f7.mjs";
3
3
  import "./authorization-DnNpWjxB.mjs";
4
4
  import { a as AccountType, c as OtimAccountSignMessageArgs, d as ServerAccountType, i as AccountConfig, l as PrivateKeyAccountConfig, n as isApiAccountConfig, o as ApiAccountConfig, r as isPrivateKeyAccountConfig, s as OtimAccount, t as createClientContext, u as ServerAccountConfig } from "./index-C5c51xs0.mjs";
5
- import { a as preparePaymentRequest, c as AuthClient, i as PreparedPaymentRequest, l as LoginOptions, n as OrchestrationClient, o as DelegationClient, r as PreparePaymentRequestParams, s as ConfigClient, t as CreatePaymentRequestResponse, u as ActivityClient } from "./index-CiyyA-wd.mjs";
5
+ import { a as prepareSettlement, c as AuthClient, i as PreparedSettlement, l as LoginOptions, n as OrchestrationClient, o as DelegationClient, r as PrepareSettlementParams, s as ConfigClient, t as CreateSettlementResponse, u as ActivityClient } from "./index-RhE0Wp_f.mjs";
6
6
  import { a as env, c as isEnvironment, i as Environment, n as SIWE_VERSION, o as getApiUrl, r as createLoginSiweMessage, s as getTurnkeyApiUrl, t as SIWE_CHAIN_ID } from "./index-D_7CTJDl.mjs";
7
7
  import { a as OtimReactClientContext, i as OtimClientContext, n as assertRequiresAuth, o as OtimServerClientContext, r as assertServerContext, t as isServerContext } from "./index-DWE1xfOE.mjs";
8
8
  import { i as normalizeYParityValue, n as parseSignatureToVRS, r as createRlpEncodedAuthorization, t as createEIP2098Signature } from "./index-CnjY7cyS.mjs";
9
- export { AccountConfig, AccountType, ActivityClient, ApiAccountConfig, AuthClient, Chain, ConfigClient, CreatePaymentRequestResponse, DelegationClient, Environment, Environment as EnvironmentType, LoginOptions, OrchestrationClient, OtimAccount, OtimAccountSignMessageArgs, OtimClientContext, OtimReactClientContext, OtimServerClientContext, PreparePaymentRequestParams, PreparedPaymentRequest, PrivateKeyAccountConfig, SIWE_CHAIN_ID, SIWE_VERSION, ServerAccountConfig, ServerAccountType, assertRequiresAuth, assertServerContext, createClientContext, createEIP2098Signature, createLoginSiweMessage, createRlpEncodedAuthorization, env, getApiUrl, getTurnkeyApiUrl, isApiAccountConfig, isEnvironment, isPrivateKeyAccountConfig, isServerContext, normalizeYParityValue, parseSignatureToVRS, preparePaymentRequest };
9
+ export { AccountConfig, AccountType, ActivityClient, ApiAccountConfig, AuthClient, Chain, ConfigClient, CreateSettlementResponse, DelegationClient, Environment, Environment as EnvironmentType, LoginOptions, OrchestrationClient, OtimAccount, OtimAccountSignMessageArgs, OtimClientContext, OtimReactClientContext, OtimServerClientContext, PrepareSettlementParams, PreparedSettlement, PrivateKeyAccountConfig, SIWE_CHAIN_ID, SIWE_VERSION, ServerAccountConfig, ServerAccountType, assertRequiresAuth, assertServerContext, createClientContext, createEIP2098Signature, createLoginSiweMessage, createRlpEncodedAuthorization, env, getApiUrl, getTurnkeyApiUrl, isApiAccountConfig, isEnvironment, isPrivateKeyAccountConfig, isServerContext, normalizeYParityValue, parseSignatureToVRS, prepareSettlement };
package/dist/index.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import { a as ServerAccountType, i as AccountType, n as isApiAccountConfig, r as isPrivateKeyAccountConfig, t as createClientContext } from "./account-D1NVta26.mjs";
2
- import { a as AuthClient, i as ConfigClient, n as OrchestrationClient, o as ActivityClient, r as DelegationClient, t as preparePaymentRequest } from "./clients-Bn4BUElo.mjs";
2
+ import { a as AuthClient, i as ConfigClient, n as OrchestrationClient, o as ActivityClient, r as DelegationClient, t as prepareSettlement } from "./clients-vDKBJkXx.mjs";
3
3
  import { a as env, c as isEnvironment, i as Environment, n as SIWE_VERSION, o as getApiUrl, r as createLoginSiweMessage, s as getTurnkeyApiUrl, t as SIWE_CHAIN_ID } from "./config-C_nc1DXn.mjs";
4
4
  import { n as assertRequiresAuth, r as assertServerContext, t as isServerContext } from "./context-uTye69B0.mjs";
5
5
  import { i as normalizeYParityValue, n as parseSignatureToVRS, r as createRlpEncodedAuthorization, t as createEIP2098Signature } from "./utils-DziAHBiz.mjs";
6
6
 
7
- export { AccountType, ActivityClient, AuthClient, ConfigClient, DelegationClient, Environment, OrchestrationClient, SIWE_CHAIN_ID, SIWE_VERSION, ServerAccountType, assertRequiresAuth, assertServerContext, createClientContext, createEIP2098Signature, createLoginSiweMessage, createRlpEncodedAuthorization, env, getApiUrl, getTurnkeyApiUrl, isApiAccountConfig, isEnvironment, isPrivateKeyAccountConfig, isServerContext, normalizeYParityValue, parseSignatureToVRS, preparePaymentRequest };
7
+ export { AccountType, ActivityClient, AuthClient, ConfigClient, DelegationClient, Environment, OrchestrationClient, SIWE_CHAIN_ID, SIWE_VERSION, ServerAccountType, assertRequiresAuth, assertServerContext, createClientContext, createEIP2098Signature, createLoginSiweMessage, createRlpEncodedAuthorization, env, getApiUrl, getTurnkeyApiUrl, isApiAccountConfig, isEnvironment, isPrivateKeyAccountConfig, isServerContext, normalizeYParityValue, parseSignatureToVRS, prepareSettlement };