Skip to content

Commit

Permalink
fix: typo of Autherize (#224)
Browse files Browse the repository at this point in the history
fix enableAutherize to enableAuthorize
fix Autherizeable to Authorizable
  • Loading branch information
stanleyyconsensys authored Mar 28, 2024
1 parent 168484d commit cc635ea
Show file tree
Hide file tree
Showing 11 changed files with 44 additions and 44 deletions.
2 changes: 1 addition & 1 deletion packages/starknet-snap/src/signDeclareTransaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export async function signDeclareTransaction(params: ApiParams): Promise<Signatu

const snapComponents = getSignTxnTxt(signerAddress, network, requestParamsObj.transaction);

if (requestParamsObj.enableAutherize === true) {
if (requestParamsObj.enableAuthorize === true) {
const response = await wallet.request({
method: 'snap_dialog',
params: {
Expand Down
2 changes: 1 addition & 1 deletion packages/starknet-snap/src/signDeployAccountTransaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export async function signDeployAccountTransaction(params: ApiParams): Promise<S

const snapComponents = getSignTxnTxt(signerAddress, network, requestParamsObj.transaction);

if (requestParamsObj.enableAutherize === true) {
if (requestParamsObj.enableAuthorize === true) {
const response = await wallet.request({
method: 'snap_dialog',
params: {
Expand Down
2 changes: 1 addition & 1 deletion packages/starknet-snap/src/signMessage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export async function signMessage(params: ApiParams) {
addDialogTxt(components, 'Message', toJson(typedDataMessage));
addDialogTxt(components, 'Signer Address', signerAddress);

if (requestParamsObj.enableAutherize === true) {
if (requestParamsObj.enableAuthorize === true) {
const response = await wallet.request({
method: 'snap_dialog',
params: {
Expand Down
2 changes: 1 addition & 1 deletion packages/starknet-snap/src/signTransaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export async function signTransaction(params: ApiParams): Promise<Signature | bo

const snapComponents = getSignTxnTxt(signerAddress, network, requestParamsObj.transactions);

if (requestParamsObj.enableAutherize === true) {
if (requestParamsObj.enableAuthorize === true) {
const response = await wallet.request({
method: 'snap_dialog',
params: {
Expand Down
2 changes: 1 addition & 1 deletion packages/starknet-snap/src/switchNetwork.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export async function switchNetwork(params: ApiParams) {
}
const components = getNetworkTxt(network);

if (requestParamsObj.enableAutherize === true) {
if (requestParamsObj.enableAuthorize === true) {
const response = await wallet.request({
method: 'snap_dialog',
params: {
Expand Down
14 changes: 7 additions & 7 deletions packages/starknet-snap/src/types/snapApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export interface ExtractPublicKeyRequestParams extends BaseRequestParams {
userAddress: string;
}

export interface SignMessageRequestParams extends Autherizeable, SignRequestParams, BaseRequestParams {
export interface SignMessageRequestParams extends Authorizable, SignRequestParams, BaseRequestParams {
typedDataMessage: typedData.TypedData;
}

Expand Down Expand Up @@ -181,29 +181,29 @@ export interface RpcV4GetTransactionReceiptResponse {
finality_status?: string;
}

export interface Autherizeable {
enableAutherize?: boolean;
export interface Authorizable {
enableAuthorize?: boolean;
}

export interface SignRequestParams {
signerAddress: string;
}

export interface SignTransactionRequestParams extends Autherizeable, SignRequestParams, BaseRequestParams {
export interface SignTransactionRequestParams extends Authorizable, SignRequestParams, BaseRequestParams {
transactions: Call[];
transactionsDetail: InvocationsSignerDetails;
abis?: Abi[];
}

export interface SignDeployAccountTransactionRequestParams extends Autherizeable, SignRequestParams, BaseRequestParams {
export interface SignDeployAccountTransactionRequestParams extends Authorizable, SignRequestParams, BaseRequestParams {
transaction: DeployAccountSignerDetails;
}

export interface SignDeclareTransactionRequestParams extends Autherizeable, SignRequestParams, BaseRequestParams {
export interface SignDeclareTransactionRequestParams extends Authorizable, SignRequestParams, BaseRequestParams {
transaction: DeclareSignerDetails;
}

export interface SwitchNetworkRequestParams extends Autherizeable, BaseRequestParams {
export interface SwitchNetworkRequestParams extends Authorizable, BaseRequestParams {
chainId: string;
}

Expand Down
14 changes: 7 additions & 7 deletions packages/starknet-snap/test/src/signDeclareTransaction.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ describe('Test function: signDeclareTransaction', function () {
version: '0x0',
maxFee: 100,
},
enableAutherize: true,
enableAuthorize: true,
};

beforeEach(async function () {
Expand Down Expand Up @@ -90,23 +90,23 @@ describe('Test function: signDeclareTransaction', function () {
expect(result).to.be.eql(false);
});

it('should skip dialog if enableAutherize is false', async function () {
it('should skip dialog if enableAuthorize is false', async function () {
sandbox.stub(utils, 'signDeclareTransaction').resolves(signature3);
const paramsObject = apiParams.requestParams as SignDeclareTransactionRequestParams;
paramsObject.enableAutherize = false;
paramsObject.enableAuthorize = false;
const result = await signDeclareTransaction(apiParams);
expect(walletStub.rpcStubs.snap_dialog).to.have.been.callCount(0);
expect(result).to.be.eql(signature3);
paramsObject.enableAutherize = true;
paramsObject.enableAuthorize = true;
});

it('should skip dialog if enableAutherize is omit', async function () {
it('should skip dialog if enableAuthorize is omit', async function () {
sandbox.stub(utils, 'signDeclareTransaction').resolves(signature3);
const paramsObject = apiParams.requestParams as SignDeclareTransactionRequestParams;
paramsObject.enableAutherize = undefined;
paramsObject.enableAuthorize = undefined;
const result = await signDeclareTransaction(apiParams);
expect(walletStub.rpcStubs.snap_dialog).to.have.been.callCount(0);
expect(result).to.be.eql(signature3);
paramsObject.enableAutherize = true;
paramsObject.enableAuthorize = true;
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ describe('Test function: signDeployAccountTransaction', function () {
version: '0x0',
maxFee: 100,
},
enableAutherize: true,
enableAuthorize: true,
};

beforeEach(async function () {
Expand Down Expand Up @@ -92,23 +92,23 @@ describe('Test function: signDeployAccountTransaction', function () {
expect(result).to.be.eql(false);
});

it('should skip dialog if enableAutherize is false', async function () {
it('should skip dialog if enableAuthorize is false', async function () {
sandbox.stub(utils, 'signDeployAccountTransaction').resolves(signature3);
const paramsObject = apiParams.requestParams as SignDeployAccountTransactionRequestParams;
paramsObject.enableAutherize = false;
paramsObject.enableAuthorize = false;
const result = await signDeployAccountTransaction(apiParams);
expect(walletStub.rpcStubs.snap_dialog).to.have.been.callCount(0);
expect(result).to.be.eql(signature3);
paramsObject.enableAutherize = true;
paramsObject.enableAuthorize = true;
});

it('should skip dialog if enableAutherize is omit', async function () {
it('should skip dialog if enableAuthorize is omit', async function () {
sandbox.stub(utils, 'signDeployAccountTransaction').resolves(signature3);
const paramsObject = apiParams.requestParams as SignDeployAccountTransactionRequestParams;
paramsObject.enableAutherize = undefined;
paramsObject.enableAuthorize = undefined;
const result = await signDeployAccountTransaction(apiParams);
expect(walletStub.rpcStubs.snap_dialog).to.have.been.callCount(0);
expect(result).to.be.eql(signature3);
paramsObject.enableAutherize = true;
paramsObject.enableAuthorize = true;
});
});
14 changes: 7 additions & 7 deletions packages/starknet-snap/test/src/signMessage.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ describe('Test function: signMessage', function () {
chainId: STARKNET_SEPOLIA_TESTNET_NETWORK.chainId,
signerAddress: account1.address,
typedDataMessage: typedDataExample,
enableAutherize: true,
enableAuthorize: true,
};

beforeEach(async function () {
Expand Down Expand Up @@ -157,21 +157,21 @@ describe('Test function: signMessage', function () {
}
});

it('should skip dialog if enableAutherize is false', async function () {
it('should skip dialog if enableAuthorize is false', async function () {
const paramsObject = apiParams.requestParams as SignMessageRequestParams;
paramsObject.enableAutherize = false;
paramsObject.enableAuthorize = false;
const result = await signMessage(apiParams);
expect(walletStub.rpcStubs.snap_dialog).to.have.been.callCount(0);
expect(result).to.be.eql(signature4SignMessage);
paramsObject.enableAutherize = true;
paramsObject.enableAuthorize = true;
});

it('should skip dialog if enableAutherize is omit', async function () {
it('should skip dialog if enableAuthorize is omit', async function () {
const paramsObject = apiParams.requestParams as SignMessageRequestParams;
paramsObject.enableAutherize = undefined;
paramsObject.enableAuthorize = undefined;
const result = await signMessage(apiParams);
expect(walletStub.rpcStubs.snap_dialog).to.have.been.callCount(0);
expect(result).to.be.eql(signature4SignMessage);
paramsObject.enableAutherize = true;
paramsObject.enableAuthorize = true;
});
});
14 changes: 7 additions & 7 deletions packages/starknet-snap/test/src/signTransaction.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ describe('Test function: signMessage', function () {
version: '0x0',
maxFee: 100,
},
enableAutherize: true,
enableAuthorize: true,
};

beforeEach(async function () {
Expand Down Expand Up @@ -101,21 +101,21 @@ describe('Test function: signMessage', function () {
expect(result).to.be.eql(false);
});

it('should skip dialog if enableAutherize is false', async function () {
it('should skip dialog if enableAuthorize is false', async function () {
const paramsObject = apiParams.requestParams as SignTransactionRequestParams;
paramsObject.enableAutherize = false;
paramsObject.enableAuthorize = false;
const result = await signTransaction(apiParams);
expect(walletStub.rpcStubs.snap_dialog).to.have.been.callCount(0);
expect(result).to.be.eql(signature3);
paramsObject.enableAutherize = true;
paramsObject.enableAuthorize = true;
});

it('should skip dialog if enableAutherize is omit', async function () {
it('should skip dialog if enableAuthorize is omit', async function () {
const paramsObject = apiParams.requestParams as SignTransactionRequestParams;
paramsObject.enableAutherize = undefined;
paramsObject.enableAuthorize = undefined;
const result = await signTransaction(apiParams);
expect(walletStub.rpcStubs.snap_dialog).to.have.been.callCount(0);
expect(result).to.be.eql(signature3);
paramsObject.enableAutherize = true;
paramsObject.enableAuthorize = true;
});
});
8 changes: 4 additions & 4 deletions packages/starknet-snap/test/src/switchNetwork.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ describe('Test function: switchNetwork', function () {
it('should switch the network correctly', async function () {
const requestObject: SwitchNetworkRequestParams = {
chainId: STARKNET_MAINNET_NETWORK.chainId,
enableAutherize: true,
enableAuthorize: true,
};
apiParams.requestParams = requestObject;
const result = await switchNetwork(apiParams);
Expand All @@ -54,7 +54,7 @@ describe('Test function: switchNetwork', function () {
expect(state.currentNetwork).to.be.eql(STARKNET_MAINNET_NETWORK);
});

it('should skip autherize when enableAutherize is false or omit', async function () {
it('should skip autherize when enableAuthorize is false or omit', async function () {
const requestObject: SwitchNetworkRequestParams = {
chainId: STARKNET_MAINNET_NETWORK.chainId,
};
Expand All @@ -69,7 +69,7 @@ describe('Test function: switchNetwork', function () {
it('should throw an error if network not found', async function () {
const requestObject: SwitchNetworkRequestParams = {
chainId: '123',
enableAutherize: true,
enableAuthorize: true,
};
apiParams.requestParams = requestObject;
let result;
Expand All @@ -89,7 +89,7 @@ describe('Test function: switchNetwork', function () {
sandbox.stub(snapUtils, 'setCurrentNetwork').throws(new Error());
const requestObject: SwitchNetworkRequestParams = {
chainId: STARKNET_SEPOLIA_TESTNET_NETWORK.chainId,
enableAutherize: true,
enableAuthorize: true,
};
apiParams.requestParams = requestObject;
let result;
Expand Down

0 comments on commit cc635ea

Please sign in to comment.