@otim/sdk-core 0.0.4 → 0.0.6
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.
- package/dist/.tsbuildinfo +1 -1
- package/dist/authorization-6anhDdQX.d.cts.map +1 -1
- package/dist/clients/index.cjs +2 -2
- package/dist/clients/index.d.cts +2 -2
- package/dist/clients/index.d.mts +2 -2
- package/dist/clients/index.mjs +2 -2
- package/dist/{clients-Bn4BUElo.mjs → clients-I_vhy7eF.mjs} +52 -63
- package/dist/clients-I_vhy7eF.mjs.map +1 -0
- package/dist/{clients-BCyzdTLc.cjs → clients-xn1jUwXu.cjs} +51 -62
- package/dist/clients-xn1jUwXu.cjs.map +1 -0
- package/dist/{index-Ce_qYSJj.d.cts → index-CBQ5I-Uz.d.cts} +27 -14
- package/dist/index-CBQ5I-Uz.d.cts.map +1 -0
- package/dist/{index-CiyyA-wd.d.mts → index-D8OoAxEI.d.mts} +26 -13
- package/dist/index-D8OoAxEI.d.mts.map +1 -0
- package/dist/index.cjs +2 -2
- package/dist/index.d.cts +2 -2
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +2 -2
- package/dist/rpc-BDoNl1Sp.d.cts.map +1 -1
- package/dist/rpc-CygBD_f7.d.mts.map +1 -1
- package/package.json +3 -3
- package/dist/clients-BCyzdTLc.cjs.map +0 -1
- package/dist/clients-Bn4BUElo.mjs.map +0 -1
- package/dist/index-Ce_qYSJj.d.cts.map +0 -1
- package/dist/index-CiyyA-wd.d.mts.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authorization-6anhDdQX.d.cts","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,YAqC8BP,CAAAA,CAAAA,EAAAA,CAAAA,CAAAA,GArCTQ,OAqCSR,CAAAA,CArCAA,CAqCAA,SArCUC,CAqCVD,GAAAA,IAAAA,GAAAA,KAAAA,CAAAA,GAAAA,CArC+BC,CAqC/BD,SArCyCA,CAqCzCA,GAAAA,KAAAA,GAAAA,IAAAA,CAAAA,CAAAA,SAAAA,IAAAA,GAAAA,KAAAA,GAAAA,IAAAA;;;AAW1C;;;;;AAAqG,KAxCzFQ,OAwCyF,CAAA,CAAA,CAAA,GAAA,CAxC3ER,CAwC2E,CAAA,SAAA,CAAA,KAAA,CAAA,GA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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-6anhDdQX.d.cts","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,GASjL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EfzJ6E,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"}
|
package/dist/clients/index.cjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
const require_clients = require('../clients-
|
|
1
|
+
const require_clients = require('../clients-xn1jUwXu.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.
|
|
8
|
+
exports.prepareSettlement = require_clients.prepareSettlement;
|
package/dist/clients/index.d.cts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import "../abi-OUq-mx1W.cjs";
|
|
2
|
-
import { a as
|
|
3
|
-
export { ActivityClient, AuthClient, ConfigClient,
|
|
2
|
+
import { a as PreparedSettlement, c as ConfigClient, d as ActivityClient, i as PrepareSettlementParams, l as AuthClient, n as CreateSettlementResponse, o as prepareSettlement, r as OrchestrationClient, s as DelegationClient, t as CreateRawConfig, u as LoginOptions } from "../index-CBQ5I-Uz.cjs";
|
|
3
|
+
export { ActivityClient, AuthClient, ConfigClient, CreateRawConfig, CreateSettlementResponse, DelegationClient, LoginOptions, OrchestrationClient, PrepareSettlementParams, PreparedSettlement, prepareSettlement };
|
package/dist/clients/index.d.mts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import "../abi-DW6AS0eM.mjs";
|
|
2
|
-
import { a as
|
|
3
|
-
export { ActivityClient, AuthClient, ConfigClient,
|
|
2
|
+
import { a as PreparedSettlement, c as ConfigClient, d as ActivityClient, i as PrepareSettlementParams, l as AuthClient, n as CreateSettlementResponse, o as prepareSettlement, r as OrchestrationClient, s as DelegationClient, t as CreateRawConfig, u as LoginOptions } from "../index-D8OoAxEI.mjs";
|
|
3
|
+
export { ActivityClient, AuthClient, ConfigClient, CreateRawConfig, CreateSettlementResponse, DelegationClient, LoginOptions, OrchestrationClient, PrepareSettlementParams, PreparedSettlement, prepareSettlement };
|
package/dist/clients/index.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { a as AuthClient, i as ConfigClient, n as OrchestrationClient, o as ActivityClient, r as DelegationClient, t as
|
|
1
|
+
import { a as AuthClient, i as ConfigClient, n as OrchestrationClient, o as ActivityClient, r as DelegationClient, t as prepareSettlement } from "../clients-I_vhy7eF.mjs";
|
|
2
2
|
|
|
3
|
-
export { ActivityClient, AuthClient, ConfigClient, DelegationClient, OrchestrationClient,
|
|
3
|
+
export { ActivityClient, AuthClient, ConfigClient, DelegationClient, OrchestrationClient, prepareSettlement };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { parseSignatureToVRS, validateIso8601Date } from "@otim/utils/helpers";
|
|
2
2
|
import { createLoginSiweMessage } from "@otim/sdk-core/config";
|
|
3
3
|
import { assertRequiresAuth, assertServerContext } from "@otim/sdk-core/context";
|
|
4
|
-
import { getChainById
|
|
5
|
-
import { addActionNamesToInstructions, buildPaymentMetadata,
|
|
4
|
+
import { getChainById } from "@otim/utils/chains";
|
|
5
|
+
import { addActionNamesToInstructions, buildPaymentMetadata, extractActionNamesMap } from "@otim/utils/payments";
|
|
6
6
|
import { hexStringSchema } from "@otim/utils/schemas";
|
|
7
7
|
import { createPublicClient, createWalletClient, http } from "viem";
|
|
8
8
|
import { ApiKeyClientSigningService, ServerWalletSigningService, UnifiedPaymentSigner } from "@otim/turnkey/signing";
|
|
@@ -73,8 +73,8 @@ var DelegationClient = class {
|
|
|
73
73
|
};
|
|
74
74
|
|
|
75
75
|
//#endregion
|
|
76
|
-
//#region src/clients/helpers/
|
|
77
|
-
async function
|
|
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,11 +102,21 @@ var OrchestrationClient = class {
|
|
|
102
102
|
this.account = account;
|
|
103
103
|
this.context = context;
|
|
104
104
|
}
|
|
105
|
-
async create(
|
|
105
|
+
async create(preparedSettlement) {
|
|
106
106
|
assertServerContext(this.context);
|
|
107
|
-
const
|
|
108
|
-
|
|
109
|
-
|
|
107
|
+
const buildResponse = (await this.apiClient.payments.buildSettlementOrchestration(preparedSettlement)).data;
|
|
108
|
+
await this.activate(buildResponse, preparedSettlement.settlementChain);
|
|
109
|
+
return {
|
|
110
|
+
requestId: buildResponse.requestId,
|
|
111
|
+
ephemeralWalletAddress: buildResponse.ephemeralWalletAddress
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
async createRaw(payload, config) {
|
|
115
|
+
assertServerContext(this.context);
|
|
116
|
+
const { settlementChainId, activate = true } = config;
|
|
117
|
+
const buildResponse = await this.buildAndEnhanceSettlement(payload);
|
|
118
|
+
if (!activate) return buildResponse;
|
|
119
|
+
await this.activate(buildResponse, settlementChainId);
|
|
110
120
|
return {
|
|
111
121
|
requestId: buildResponse.requestId,
|
|
112
122
|
ephemeralWalletAddress: buildResponse.ephemeralWalletAddress
|
|
@@ -122,7 +132,7 @@ var OrchestrationClient = class {
|
|
|
122
132
|
const publicClient = this.createPublicClient(settlementChainId);
|
|
123
133
|
const instructions = [...buildResponse.completionInstructions, ...buildResponse.instructions];
|
|
124
134
|
const delegateAddressMap = await this.fetchDelegateAddresses(instructions);
|
|
125
|
-
const { signedAuthorization, completionInstructions, instructions: signedInstructions } = await
|
|
135
|
+
const { signedAuthorization, completionInstructions, instructions: signedInstructions } = await createSettlementSigner({
|
|
126
136
|
context: this.context,
|
|
127
137
|
buildResponse,
|
|
128
138
|
publicClient,
|
|
@@ -135,7 +145,7 @@ var OrchestrationClient = class {
|
|
|
135
145
|
instructions: signedInstructions
|
|
136
146
|
});
|
|
137
147
|
}
|
|
138
|
-
async
|
|
148
|
+
async buildAndEnhanceSettlement(payload) {
|
|
139
149
|
const actionNames = extractActionNamesMap(payload.completionInstructions, payload.instructions);
|
|
140
150
|
return addActionNamesToInstructions((await this.apiClient.payments.buildPaymentRequest(payload)).data, actionNames);
|
|
141
151
|
}
|
|
@@ -158,68 +168,47 @@ var OrchestrationClient = class {
|
|
|
158
168
|
};
|
|
159
169
|
|
|
160
170
|
//#endregion
|
|
161
|
-
//#region src/clients/helpers/prepare-
|
|
162
|
-
function validateAndGetTokenAddress(chainId, token) {
|
|
163
|
-
const tokenAddress = getTokenAddress(chainId, token);
|
|
164
|
-
if (!tokenAddress) throw new Error(`Token ${token} not supported on chain ${chainId}`);
|
|
165
|
-
if (!getTokenMetadata(token)) throw new Error(`Token ${token} metadata not found`);
|
|
166
|
-
return hexStringSchema.parse(tokenAddress);
|
|
167
|
-
}
|
|
171
|
+
//#region src/clients/helpers/prepare-settlement.ts
|
|
168
172
|
function buildMetadataFromParams(params) {
|
|
169
|
-
const {
|
|
170
|
-
const
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
173
|
+
const { amount, recipient, token, note, dueDate, customMetadata } = params;
|
|
174
|
+
const metadataWithToken = {
|
|
175
|
+
...buildPaymentMetadata({
|
|
176
|
+
tokenSymbol: "",
|
|
177
|
+
amountInUSD: amount,
|
|
178
|
+
fromAccountAddress: recipient,
|
|
179
|
+
note,
|
|
180
|
+
dueDate,
|
|
181
|
+
hasInvoiceMetadata: false
|
|
182
|
+
}),
|
|
183
|
+
token
|
|
184
|
+
};
|
|
178
185
|
return customMetadata ? {
|
|
179
|
-
...
|
|
186
|
+
...metadataWithToken,
|
|
180
187
|
...customMetadata
|
|
181
|
-
} :
|
|
182
|
-
}
|
|
183
|
-
function createPayload(params) {
|
|
184
|
-
const { chainId, recipient, amount, payer, metadata, feeTokenAddress, maxRuns } = params;
|
|
185
|
-
const chainTokenConfigs = createChainTokenConfigs(Object.values(supportedChains.mainnet).flatMap((chain) => getChainTokens(chain.id)));
|
|
186
|
-
return createComprehensivePaymentRequest({
|
|
187
|
-
settlementChainId: chainId,
|
|
188
|
-
recipient,
|
|
189
|
-
amount: amount.toString(),
|
|
190
|
-
ephemeralWalletAddress: recipient,
|
|
191
|
-
chainTokenConfigs,
|
|
192
|
-
payerAddress: payer ?? null,
|
|
193
|
-
metadata,
|
|
194
|
-
feeToken: feeTokenAddress,
|
|
195
|
-
maxRuns
|
|
196
|
-
});
|
|
188
|
+
} : metadataWithToken;
|
|
197
189
|
}
|
|
198
|
-
function
|
|
199
|
-
const { chainId, token
|
|
190
|
+
function prepareSettlement(params) {
|
|
191
|
+
const { chainId, token, acceptedTokens, recipient, amount, payer, note, dueDate, metadata: customMetadata, maxRuns } = params;
|
|
200
192
|
if (dueDate) validateIso8601Date(dueDate);
|
|
201
|
-
const feeTokenAddress = validateAndGetTokenAddress(chainId, token);
|
|
202
193
|
return {
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
194
|
+
acceptedTokens,
|
|
195
|
+
settlementChain: chainId,
|
|
196
|
+
settlementToken: token,
|
|
197
|
+
settlementAmount: amount,
|
|
198
|
+
recipientAddress: recipient,
|
|
199
|
+
metadata: buildMetadataFromParams({
|
|
206
200
|
amount,
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
note,
|
|
213
|
-
dueDate,
|
|
214
|
-
customMetadata
|
|
215
|
-
}),
|
|
216
|
-
feeTokenAddress,
|
|
217
|
-
maxRuns
|
|
201
|
+
recipient,
|
|
202
|
+
token,
|
|
203
|
+
note,
|
|
204
|
+
dueDate,
|
|
205
|
+
customMetadata
|
|
218
206
|
}),
|
|
219
|
-
|
|
207
|
+
payerAddress: payer ?? null,
|
|
208
|
+
maxRuns
|
|
220
209
|
};
|
|
221
210
|
}
|
|
222
211
|
|
|
223
212
|
//#endregion
|
|
224
|
-
export { AuthClient as a, ConfigClient as i, OrchestrationClient as n, ActivityClient as o, DelegationClient as r,
|
|
225
|
-
//# sourceMappingURL=clients-
|
|
213
|
+
export { AuthClient as a, ConfigClient as i, OrchestrationClient as n, ActivityClient as o, DelegationClient as r, prepareSettlement as t };
|
|
214
|
+
//# sourceMappingURL=clients-I_vhy7eF.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clients-I_vhy7eF.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 { PreparedSettlement } from \"./helpers/prepare-settlement\";\nimport 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\";\n\nexport type { PreparedSettlement } from \"./helpers/prepare-settlement\";\n\nexport interface CreateSettlementResponse {\n requestId: string;\n ephemeralWalletAddress: Address;\n}\n\nexport interface CreateRawConfig {\n settlementChainId: number;\n activate?: boolean;\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 response =\n await this.apiClient.payments.buildSettlementOrchestration(\n preparedSettlement,\n );\n const buildResponse = response.data;\n\n await this.activate(buildResponse, preparedSettlement.settlementChain);\n\n return {\n requestId: buildResponse.requestId,\n ephemeralWalletAddress: buildResponse.ephemeralWalletAddress,\n };\n }\n\n async createRaw(\n payload: PaymentRequestBuildRequest,\n config: CreateRawConfig,\n ): Promise<CreateSettlementResponse | PaymentResponseWithActionNames> {\n assertServerContext(this.context);\n\n const { settlementChainId, activate = true } = config;\n const buildResponse = await this.buildAndEnhanceSettlement(payload);\n\n if (!activate) {\n return buildResponse;\n }\n\n await this.activate(buildResponse, settlementChainId);\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 { 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 { validateIso8601Date } from \"@otim/utils/helpers\";\nimport { buildPaymentMetadata } from \"@otim/utils/payments\";\n\nexport interface PrepareSettlementParams {\n amount: number;\n chainId: SupportedChainId;\n recipient: Address;\n token: Address;\n acceptedTokens: Record<number, Address[]>;\n payer?: Nullable<Address>;\n dueDate?: string;\n metadata?: PaymentRequestMetadata;\n note?: string;\n maxRuns?: number;\n}\n\nexport interface PreparedSettlement {\n acceptedTokens: Record<number, Address[]>;\n settlementChain: number;\n settlementToken: Address;\n settlementAmount: number;\n recipientAddress: Address;\n metadata: Record<string, unknown>;\n payerAddress?: Address | null;\n dueDate?: string;\n maxRuns?: number;\n}\n\nfunction buildMetadataFromParams(params: {\n amount: number;\n recipient: Address;\n token: Address;\n note?: string;\n dueDate?: string;\n customMetadata?: PaymentRequestMetadata;\n}): PaymentRequestMetadata {\n const { amount, recipient, token, note, dueDate, customMetadata } = params;\n\n const baseMetadata = buildPaymentMetadata({\n tokenSymbol: \"\",\n amountInUSD: amount,\n fromAccountAddress: recipient,\n note,\n dueDate,\n hasInvoiceMetadata: false,\n });\n\n const metadataWithToken = { ...baseMetadata, token };\n\n return customMetadata\n ? { ...metadataWithToken, ...customMetadata }\n : metadataWithToken;\n}\n\nexport function prepareSettlement(\n params: PrepareSettlementParams,\n): PreparedSettlement {\n const {\n chainId,\n token,\n acceptedTokens,\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 metadata = buildMetadataFromParams({\n amount,\n recipient,\n token,\n note,\n dueDate,\n customMetadata,\n });\n\n return {\n acceptedTokens,\n settlementChain: chainId,\n settlementToken: token,\n settlementAmount: amount,\n recipientAddress: recipient,\n metadata,\n payerAddress: payer ?? null,\n maxRuns,\n };\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,MAAwB;CACtB,YACE,AAAiBC,WACjB,AAAiBC,SACjB,AAAiBC,SACjB;EAHiB;EACA;EACA;;CAGnB,MAAM,MAAM,EAAE,WAAqD;AACjE,qBAAmB,KAAK,QAAQ;EAEhC,MAAM,UAAU,uBAAuB,SAAS,KAAK,KAAK,CAAC,UAAU,CAAC;EAEtE,MAAM,qBAAqB,oBADT,MAAM,KAAK,QAAQ,YAAY,EAAE,SAAS,CAAC,CACJ;AAOzD,UALiB,MAAM,KAAK,UAAU,KAAK,MAAM;GAC/C,MAAM;GACN,WAAW;GACZ,CAAC,EAEc;;CAGlB,MAAM,iBAAsC;AAE1C,UADiB,MAAM,KAAK,UAAU,KAAK,IAAI,EAC/B;;;;;;AChCpB,IAAa,eAAb,MAA0B;CACxB,YAAY,AAAiBC,WAAsB;EAAtB;;CAE7B,MAAM,0BAA0B,EAC9B,WAC2F;AAI3F,UAFE,MAAM,KAAK,UAAU,OAAO,gCAAgC,EAAE,SAAS,CAAC,EAE1D;;;;;;ACNpB,IAAa,mBAAb,MAA8B;CAC5B,YAAY,AAAiBC,WAAsB;EAAtB;;CAE7B,M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,CAAC,SAHQ,gBAAgB,MAC9B,SAAS,KAAK,oBACf,CACwB;IACzB,CACH;AAED,SAAO,IAAI,IAAI,UAAU;;;;;;AC/I7B,SAAS,wBAAwB,QAON;CACzB,MAAM,EAAE,QAAQ,WAAW,OAAO,MAAM,SAAS,mBAAmB;CAWpE,MAAM,oBAAoB;EAAE,GATP,qBAAqB;GACxC,aAAa;GACb,aAAa;GACb,oBAAoB;GACpB;GACA;GACA,oBAAoB;GACrB,CAAC;EAE2C;EAAO;AAEpD,QAAO,iBACH;EAAE,GAAG;EAAmB,GAAG;EAAgB,GAC3C;;AAGN,SAAgB,kBACd,QACoB;CACpB,MAAM,EACJ,SACA,OACA,gBACA,WACA,QACA,OACA,MACA,SACA,UAAU,gBACV,YACE;AAEJ,KAAI,QACF,qBAAoB,QAAQ;AAY9B,QAAO;EACL;EACA,iBAAiB;EACjB,iBAAiB;EACjB,kBAAkB;EAClB,kBAAkB;EAClB,UAfe,wBAAwB;GACvC;GACA;GACA;GACA;GACA;GACA;GACD,CAAC;EASA,cAAc,SAAS;EACvB;EACD"}
|
|
@@ -73,8 +73,8 @@ var DelegationClient = class {
|
|
|
73
73
|
};
|
|
74
74
|
|
|
75
75
|
//#endregion
|
|
76
|
-
//#region src/clients/helpers/
|
|
77
|
-
async function
|
|
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,11 +102,21 @@ var OrchestrationClient = class {
|
|
|
102
102
|
this.account = account;
|
|
103
103
|
this.context = context;
|
|
104
104
|
}
|
|
105
|
-
async create(
|
|
105
|
+
async create(preparedSettlement) {
|
|
106
106
|
(0, __otim_sdk_core_context.assertServerContext)(this.context);
|
|
107
|
-
const
|
|
108
|
-
|
|
109
|
-
|
|
107
|
+
const buildResponse = (await this.apiClient.payments.buildSettlementOrchestration(preparedSettlement)).data;
|
|
108
|
+
await this.activate(buildResponse, preparedSettlement.settlementChain);
|
|
109
|
+
return {
|
|
110
|
+
requestId: buildResponse.requestId,
|
|
111
|
+
ephemeralWalletAddress: buildResponse.ephemeralWalletAddress
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
async createRaw(payload, config) {
|
|
115
|
+
(0, __otim_sdk_core_context.assertServerContext)(this.context);
|
|
116
|
+
const { settlementChainId, activate = true } = config;
|
|
117
|
+
const buildResponse = await this.buildAndEnhanceSettlement(payload);
|
|
118
|
+
if (!activate) return buildResponse;
|
|
119
|
+
await this.activate(buildResponse, settlementChainId);
|
|
110
120
|
return {
|
|
111
121
|
requestId: buildResponse.requestId,
|
|
112
122
|
ephemeralWalletAddress: buildResponse.ephemeralWalletAddress
|
|
@@ -122,7 +132,7 @@ var OrchestrationClient = class {
|
|
|
122
132
|
const publicClient = this.createPublicClient(settlementChainId);
|
|
123
133
|
const instructions = [...buildResponse.completionInstructions, ...buildResponse.instructions];
|
|
124
134
|
const delegateAddressMap = await this.fetchDelegateAddresses(instructions);
|
|
125
|
-
const { signedAuthorization, completionInstructions, instructions: signedInstructions } = await
|
|
135
|
+
const { signedAuthorization, completionInstructions, instructions: signedInstructions } = await createSettlementSigner({
|
|
126
136
|
context: this.context,
|
|
127
137
|
buildResponse,
|
|
128
138
|
publicClient,
|
|
@@ -135,7 +145,7 @@ var OrchestrationClient = class {
|
|
|
135
145
|
instructions: signedInstructions
|
|
136
146
|
});
|
|
137
147
|
}
|
|
138
|
-
async
|
|
148
|
+
async buildAndEnhanceSettlement(payload) {
|
|
139
149
|
const actionNames = (0, __otim_utils_payments.extractActionNamesMap)(payload.completionInstructions, payload.instructions);
|
|
140
150
|
return (0, __otim_utils_payments.addActionNamesToInstructions)((await this.apiClient.payments.buildPaymentRequest(payload)).data, actionNames);
|
|
141
151
|
}
|
|
@@ -158,65 +168,44 @@ var OrchestrationClient = class {
|
|
|
158
168
|
};
|
|
159
169
|
|
|
160
170
|
//#endregion
|
|
161
|
-
//#region src/clients/helpers/prepare-
|
|
162
|
-
function validateAndGetTokenAddress(chainId, token) {
|
|
163
|
-
const tokenAddress = (0, __otim_utils_chains.getTokenAddress)(chainId, token);
|
|
164
|
-
if (!tokenAddress) throw new Error(`Token ${token} not supported on chain ${chainId}`);
|
|
165
|
-
if (!(0, __otim_utils_chains.getTokenMetadata)(token)) throw new Error(`Token ${token} metadata not found`);
|
|
166
|
-
return __otim_utils_schemas.hexStringSchema.parse(tokenAddress);
|
|
167
|
-
}
|
|
171
|
+
//#region src/clients/helpers/prepare-settlement.ts
|
|
168
172
|
function buildMetadataFromParams(params) {
|
|
169
|
-
const {
|
|
170
|
-
const
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
173
|
+
const { amount, recipient, token, note, dueDate, customMetadata } = params;
|
|
174
|
+
const metadataWithToken = {
|
|
175
|
+
...(0, __otim_utils_payments.buildPaymentMetadata)({
|
|
176
|
+
tokenSymbol: "",
|
|
177
|
+
amountInUSD: amount,
|
|
178
|
+
fromAccountAddress: recipient,
|
|
179
|
+
note,
|
|
180
|
+
dueDate,
|
|
181
|
+
hasInvoiceMetadata: false
|
|
182
|
+
}),
|
|
183
|
+
token
|
|
184
|
+
};
|
|
178
185
|
return customMetadata ? {
|
|
179
|
-
...
|
|
186
|
+
...metadataWithToken,
|
|
180
187
|
...customMetadata
|
|
181
|
-
} :
|
|
182
|
-
}
|
|
183
|
-
function createPayload(params) {
|
|
184
|
-
const { chainId, recipient, amount, payer, metadata, feeTokenAddress, maxRuns } = params;
|
|
185
|
-
const chainTokenConfigs = (0, __otim_utils_payments.createChainTokenConfigs)(Object.values(__otim_utils_chains.supportedChains.mainnet).flatMap((chain) => (0, __otim_utils_chains.getChainTokens)(chain.id)));
|
|
186
|
-
return (0, __otim_utils_payments.createComprehensivePaymentRequest)({
|
|
187
|
-
settlementChainId: chainId,
|
|
188
|
-
recipient,
|
|
189
|
-
amount: amount.toString(),
|
|
190
|
-
ephemeralWalletAddress: recipient,
|
|
191
|
-
chainTokenConfigs,
|
|
192
|
-
payerAddress: payer ?? null,
|
|
193
|
-
metadata,
|
|
194
|
-
feeToken: feeTokenAddress,
|
|
195
|
-
maxRuns
|
|
196
|
-
});
|
|
188
|
+
} : metadataWithToken;
|
|
197
189
|
}
|
|
198
|
-
function
|
|
199
|
-
const { chainId, token
|
|
190
|
+
function prepareSettlement(params) {
|
|
191
|
+
const { chainId, token, acceptedTokens, recipient, amount, payer, note, dueDate, metadata: customMetadata, maxRuns } = params;
|
|
200
192
|
if (dueDate) (0, __otim_utils_helpers.validateIso8601Date)(dueDate);
|
|
201
|
-
const feeTokenAddress = validateAndGetTokenAddress(chainId, token);
|
|
202
193
|
return {
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
194
|
+
acceptedTokens,
|
|
195
|
+
settlementChain: chainId,
|
|
196
|
+
settlementToken: token,
|
|
197
|
+
settlementAmount: amount,
|
|
198
|
+
recipientAddress: recipient,
|
|
199
|
+
metadata: buildMetadataFromParams({
|
|
206
200
|
amount,
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
note,
|
|
213
|
-
dueDate,
|
|
214
|
-
customMetadata
|
|
215
|
-
}),
|
|
216
|
-
feeTokenAddress,
|
|
217
|
-
maxRuns
|
|
201
|
+
recipient,
|
|
202
|
+
token,
|
|
203
|
+
note,
|
|
204
|
+
dueDate,
|
|
205
|
+
customMetadata
|
|
218
206
|
}),
|
|
219
|
-
|
|
207
|
+
payerAddress: payer ?? null,
|
|
208
|
+
maxRuns
|
|
220
209
|
};
|
|
221
210
|
}
|
|
222
211
|
|
|
@@ -251,10 +240,10 @@ Object.defineProperty(exports, 'OrchestrationClient', {
|
|
|
251
240
|
return OrchestrationClient;
|
|
252
241
|
}
|
|
253
242
|
});
|
|
254
|
-
Object.defineProperty(exports, '
|
|
243
|
+
Object.defineProperty(exports, 'prepareSettlement', {
|
|
255
244
|
enumerable: true,
|
|
256
245
|
get: function () {
|
|
257
|
-
return
|
|
246
|
+
return prepareSettlement;
|
|
258
247
|
}
|
|
259
248
|
});
|
|
260
|
-
//# sourceMappingURL=clients-
|
|
249
|
+
//# sourceMappingURL=clients-xn1jUwXu.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clients-xn1jUwXu.cjs","names":["apiClient: APIClient","apiClient: APIClient","account: OtimAccount","context: OtimClientContext","apiClient: APIClient","apiClient: APIClient","UnifiedPaymentSigner","ApiKeyClientSigningService","ServerWalletSigningService","apiClient: APIClient","account: OtimAccount","context: OtimServerClientContext","hexStringSchema"],"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 { PreparedSettlement } from \"./helpers/prepare-settlement\";\nimport 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\";\n\nexport type { PreparedSettlement } from \"./helpers/prepare-settlement\";\n\nexport interface CreateSettlementResponse {\n requestId: string;\n ephemeralWalletAddress: Address;\n}\n\nexport interface CreateRawConfig {\n settlementChainId: number;\n activate?: boolean;\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 response =\n await this.apiClient.payments.buildSettlementOrchestration(\n preparedSettlement,\n );\n const buildResponse = response.data;\n\n await this.activate(buildResponse, preparedSettlement.settlementChain);\n\n return {\n requestId: buildResponse.requestId,\n ephemeralWalletAddress: buildResponse.ephemeralWalletAddress,\n };\n }\n\n async createRaw(\n payload: PaymentRequestBuildRequest,\n config: CreateRawConfig,\n ): Promise<CreateSettlementResponse | PaymentResponseWithActionNames> {\n assertServerContext(this.context);\n\n const { settlementChainId, activate = true } = config;\n const buildResponse = await this.buildAndEnhanceSettlement(payload);\n\n if (!activate) {\n return buildResponse;\n }\n\n await this.activate(buildResponse, settlementChainId);\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 { 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 { validateIso8601Date } from \"@otim/utils/helpers\";\nimport { buildPaymentMetadata } from \"@otim/utils/payments\";\n\nexport interface PrepareSettlementParams {\n amount: number;\n chainId: SupportedChainId;\n recipient: Address;\n token: Address;\n acceptedTokens: Record<number, Address[]>;\n payer?: Nullable<Address>;\n dueDate?: string;\n metadata?: PaymentRequestMetadata;\n note?: string;\n maxRuns?: number;\n}\n\nexport interface PreparedSettlement {\n acceptedTokens: Record<number, Address[]>;\n settlementChain: number;\n settlementToken: Address;\n settlementAmount: number;\n recipientAddress: Address;\n metadata: Record<string, unknown>;\n payerAddress?: Address | null;\n dueDate?: string;\n maxRuns?: number;\n}\n\nfunction buildMetadataFromParams(params: {\n amount: number;\n recipient: Address;\n token: Address;\n note?: string;\n dueDate?: string;\n customMetadata?: PaymentRequestMetadata;\n}): PaymentRequestMetadata {\n const { amount, recipient, token, note, dueDate, customMetadata } = params;\n\n const baseMetadata = buildPaymentMetadata({\n tokenSymbol: \"\",\n amountInUSD: amount,\n fromAccountAddress: recipient,\n note,\n dueDate,\n hasInvoiceMetadata: false,\n });\n\n const metadataWithToken = { ...baseMetadata, token };\n\n return customMetadata\n ? { ...metadataWithToken, ...customMetadata }\n : metadataWithToken;\n}\n\nexport function prepareSettlement(\n params: PrepareSettlementParams,\n): PreparedSettlement {\n const {\n chainId,\n token,\n acceptedTokens,\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 metadata = buildMetadataFromParams({\n amount,\n recipient,\n token,\n note,\n dueDate,\n customMetadata,\n });\n\n return {\n acceptedTokens,\n settlementChain: chainId,\n settlementToken: token,\n settlementAmount: amount,\n recipientAddress: recipient,\n metadata,\n payerAddress: payer ?? null,\n maxRuns,\n };\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,IA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