Skip to content

Commit

Permalink
chore: remove barrel file from types because of convention violation
Browse files Browse the repository at this point in the history
  • Loading branch information
kfastov committed Jun 22, 2024
1 parent 6113a63 commit 182519c
Show file tree
Hide file tree
Showing 7 changed files with 75 additions and 76 deletions.
3 changes: 2 additions & 1 deletion __tests__/account.outsideExecution.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
// import { Provider, Account, Contract, num, typedData } from '../src';
import { getStarkKey, utils } from '@scure/starknet';
import { Provider, Account, cairo } from '../src';
import { OutsideExecution, SNIP9_V1_INTERFACE_ID } from '../src/types/outsideExecution';
import { SNIP9_V1_INTERFACE_ID } from '../src/types/outsideExecution';
import { OutsideExecution } from '../src/utils/outsideExecution';
import { randomAddress } from '../src/utils/stark';
import {
compiledArgentAccount,
Expand Down
2 changes: 1 addition & 1 deletion __tests__/outsideExecution.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// outsideExecution.test.ts

import {
OutsideExecution,
EOutsideExecutionVersion,
OutsideExecutionTypesV1,
OutsideExecutionTypesV2,
} from '../src/types/outsideExecution';
import { OutsideExecution } from '../src/utils/outsideExecution';
import { Call } from '../src/types';
import { encodeShortString } from '../src/utils/shortString';

Expand Down
3 changes: 1 addition & 2 deletions src/account/default.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,18 +41,17 @@ import {
import { ETransactionVersion, ETransactionVersion3, ResourceBounds } from '../types/api';
import {
EOutsideExecutionVersion,
OutsideExecution,
SNIP9_V1_INTERFACE_ID,
SNIP9_V2_INTERFACE_ID,
} from '../types/outsideExecution';
import { OutsideExecution, buildExecuteFromOutsideCallData } from '../utils/outsideExecution';
import { CallData } from '../utils/calldata';
import { extractContractHashes, isSierra } from '../utils/contract';
import { parseUDCEvent } from '../utils/events';
import { calculateContractAddressFromHash } from '../utils/hash';
import { toBigInt, toCairoBool } from '../utils/num';
import { parseContract } from '../utils/provider';
import { isString } from '../utils/shortString';
import { buildExecuteFromOutsideCallData } from '../utils/outsideExecution';
import { supportsInterface } from '../utils/src5';
import {
estimateFeeToBounds,
Expand Down
3 changes: 2 additions & 1 deletion src/account/interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ import {
UniversalDeployerContractPayload,
UniversalDetails,
} from '../types';
import { EOutsideExecutionVersion, OutsideExecution } from '../types/outsideExecution';
import { EOutsideExecutionVersion } from '../types/outsideExecution';
import { OutsideExecution } from '../utils/outsideExecution';

export abstract class AccountInterface extends ProviderInterface {
public abstract address: string;
Expand Down
70 changes: 68 additions & 2 deletions src/types/outsideExecution.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,68 @@
export * from './outsideExecutionTypes';
export * from '../utils/outsideExecution';
import { BigNumberish, RawArgs } from './lib';

export interface OutsideExecutionOptions {
caller: string;
nonce: BigNumberish;
execute_after: BigNumberish;
execute_before: BigNumberish;
}

export interface OutsideCall {
to: string;
selector: BigNumberish;
calldata: RawArgs;
}

export const SNIP9_V1_INTERFACE_ID =
'0x68cfd18b92d1907b8ba3cc324900277f5a3622099431ea85dd8089255e4181';
export const SNIP9_V2_INTERFACE_ID =
'0x1d1144bb2138366ff28d8e9ab57456b1d332ac42196230c3a602003c89872';

export const OutsideExecutionTypesV1 = {
StarkNetDomain: [
{ name: 'name', type: 'felt' },
{ name: 'version', type: 'felt' },
{ name: 'chainId', type: 'felt' },
],
OutsideExecution: [
{ name: 'caller', type: 'felt' },
{ name: 'nonce', type: 'felt' },
{ name: 'execute_after', type: 'felt' },
{ name: 'execute_before', type: 'felt' },
{ name: 'calls_len', type: 'felt' },
{ name: 'calls', type: 'OutsideCall*' },
],
OutsideCall: [
{ name: 'to', type: 'felt' },
{ name: 'selector', type: 'felt' },
{ name: 'calldata_len', type: 'felt' },
{ name: 'calldata', type: 'felt*' },
],
};

export const OutsideExecutionTypesV2 = {
StarknetDomain: [
// SNIP-12 revision 1 is used, so should be "StarknetDomain", not "StarkNetDomain"
{ name: 'name', type: 'shortstring' },
{ name: 'version', type: 'shortstring' }, // set to 2 in v2
{ name: 'chainId', type: 'shortstring' },
{ name: 'revision', type: 'shortstring' },
],
OutsideExecution: [
{ name: 'Caller', type: 'ContractAddress' },
{ name: 'Nonce', type: 'felt' },
{ name: 'Execute After', type: 'u128' },
{ name: 'Execute Before', type: 'u128' },
{ name: 'Calls', type: 'Call*' },
],
Call: [
{ name: 'To', type: 'ContractAddress' },
{ name: 'Selector', type: 'selector' },
{ name: 'Calldata', type: 'felt*' },
],
};

export enum EOutsideExecutionVersion {
V1 = '1',
V2 = '2',
}
68 changes: 0 additions & 68 deletions src/types/outsideExecutionTypes.ts

This file was deleted.

2 changes: 1 addition & 1 deletion src/utils/outsideExecution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
EOutsideExecutionVersion,
OutsideExecutionTypesV1,
OutsideExecutionTypesV2,
} from '../types/outsideExecutionTypes';
} from '../types/outsideExecution';

export const OutsideExecutionCallerAny = encodeShortString('ANY_CALLER');

Expand Down

0 comments on commit 182519c

Please sign in to comment.