import { describe, expect, test } from 'vitest' import * as Key from '../../viem/Key.js' import * as Call from './call.js' describe('authorize', () => { test('default', () => { const key = Key.fromP256({ privateKey: '0x59ff6b8de3b3b39e94b6f9fc0590cf4e3eaa9b6736e6a49c9a6b324c4f58cb9f', }) const call = Call.authorize({ key, }) expect(call).toMatchInlineSnapshot(` { "data": "0xcebfe336000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000040ec0effa5f2f378cbf7fd2fa7ca1e8dc51cf777c129fa1c00a0e9a9205f2e511ff3f20b34a4e0b50587d055c0e0fad33d32cf1147d3bb2538fbab0d15d8e65008", "to": "0x2323232323232323232323232323232323232323", } `) }) }) describe('setCanExecute', () => { test('default', () => { const call = Call.setCanExecute() expect(call).toMatchInlineSnapshot(` { "data": "0x136a12f73232323232323232323232323232323232323232323232323232323232323232000000000000000000000000323232323232323232323232323232323232323232323232000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001", "to": "0x2323232323232323232323232323232323232323", } `) }) test('args: enabled', () => { const call = Call.setCanExecute({ enabled: false }) expect(call).toMatchInlineSnapshot(` { "data": "0x136a12f73232323232323232323232323232323232323232323232323232323232323232000000000000000000000000323232323232323232323232323232323232323232323232000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", "to": "0x2323232323232323232323232323232323232323", } `) }) test('args: key', () => { const key = Key.fromP256({ privateKey: '0x59ff6b8de3b3b39e94b6f9fc0590cf4e3eaa9b6736e6a49c9a6b324c4f58cb9f', }) const call = Call.setCanExecute({ key }) expect(call).toMatchInlineSnapshot(` { "data": "0x136a12f7ed7ac7c7b35b77e97be67b84f5889e0ab3ecc69ab65d57db191e11f8811e9965000000000000000000000000323232323232323232323232323232323232323232323232000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001", "to": "0x2323232323232323232323232323232323232323", } `) }) test('args: to', () => { const key = Key.fromP256({ privateKey: '0x59ff6b8de3b3b39e94b6f9fc0590cf4e3eaa9b6736e6a49c9a6b324c4f58cb9f', }) const call = Call.setCanExecute({ key, to: '0x0000000000000000000000000000000000000000', }) expect(call).toMatchInlineSnapshot(` { "data": "0x136a12f7ed7ac7c7b35b77e97be67b84f5889e0ab3ecc69ab65d57db191e11f8811e9965000000000000000000000000000000000000000000000000000000000000000032323232000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001", "to": "0x2323232323232323232323232323232323232323", } `) }) test('args: selector', () => { const key = Key.fromP256({ privateKey: '0x59ff6b8de3b3b39e94b6f9fc0590cf4e3eaa9b6736e6a49c9a6b324c4f58cb9f', }) const call = Call.setCanExecute({ key, selector: '0xdeadbeef', }) expect(call).toMatchInlineSnapshot(` { "data": "0x136a12f7ed7ac7c7b35b77e97be67b84f5889e0ab3ecc69ab65d57db191e11f8811e99650000000000000000000000003232323232323232323232323232323232323232deadbeef000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001", "to": "0x2323232323232323232323232323232323232323", } `) }) }) describe('setLabel', () => { test('default', () => { const call = Call.setLabel({ label: 'test', }) expect(call).toMatchInlineSnapshot(` { "data": "0xbf530969000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000047465737400000000000000000000000000000000000000000000000000000000", "to": "0x2323232323232323232323232323232323232323", } `) }) })