Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hotfix/v1.1.8 #95

Merged
merged 1 commit into from
Apr 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@
"prettier": "^3.0.3",
"prettier-plugin-import-sort": "^0.0.7",
"semantic-release": "^21.1.1",
"starknet-types": "^0.0.5",
"svelte": "^4.0.0",
"svelte-check": "^3.5.1",
"svelte-preprocess": "^5.0.4",
Expand All @@ -104,7 +105,7 @@
"zod": "^3.20.6"
},
"peerDependencies": {
"starknet": "^6.2.0"
"starknet": "^6.7.0"
},
"gitHead": "b16688a8638cc138938e74e1a39d004760165d75"
}
39 changes: 31 additions & 8 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/connectors/argentMobile/modal/starknet/signer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import type {
InvocationsSignerDetails,
Signature,
SignerInterface,
typedData,
} from "starknet"
import { TypedData } from "starknet-types"

import type { IStarknetRpc } from "./starknet.model"

Expand All @@ -19,7 +19,7 @@ export class StarknetRemoteSigner implements SignerInterface {
}

public async signMessage(
typedData: typedData.TypedData,
typedData: TypedData,
accountAddress: string,
): Promise<Signature> {
const { signature } = await this.wallet.starknet_signTypedData({
Expand Down
4 changes: 2 additions & 2 deletions src/connectors/argentMobile/modal/starknet/starknet.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ import type {
InvocationsDetails,
InvokeFunctionResponse,
Signature,
typedData,
} from "starknet"
import { TypedData } from "starknet-types"

// see https://github.com/WalletConnect/walletconnect-docs/pull/288/files
export interface IStarknetRpc {
starknet_signTypedData(params: {
accountAddress: string
typedData: typedData.TypedData
typedData: TypedData
}): Promise<{ signature: Signature }>
starknet_requestAddInvokeTransaction(params: {
accountAddress: string
Expand Down
27 changes: 14 additions & 13 deletions src/connectors/webwallet/starknetWindowObject/account.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@ import {
AccountInterface,
ProviderInterface,
SignerInterface,
typedData,
} from "starknet"
import type { TypedData } from "starknet-types"
import type { StarknetMethods } from "../../../types/window"

import { setPopupOptions, type AppRouter } from "../helpers/trpc"
import {
EXECUTE_POPUP_HEIGHT,
EXECUTE_POPUP_WIDTH,
SIGN_MESSAGE_POPUP_HEIGHT,
SIGN_MESSAGE_POPUP_WIDTH,
} from "../helpers/popupSizes"
import { setPopupOptions, type AppRouter } from "../helpers/trpc"

class UnimplementedSigner implements SignerInterface {
async getPubKey(): Promise<string> {
Expand Down Expand Up @@ -50,11 +50,11 @@ export class MessageAccount extends Account implements AccountInterface {
super(provider, address, new UnimplementedSigner())
}

execute: StarknetMethods["execute"] = async (
calls,
abis,
transactionsDetail,
) => {
execute = async (
calls: Parameters<StarknetMethods["execute"]>[0],
abiOrDetails?: Parameters<StarknetMethods["execute"]>[1] | any[],
transactionDetails: Parameters<StarknetMethods["execute"]>[1] = {},
): ReturnType<StarknetMethods["execute"]> => {
try {
setPopupOptions({
width: EXECUTE_POPUP_WIDTH,
Expand All @@ -74,11 +74,12 @@ export class MessageAccount extends Account implements AccountInterface {
})
}

const txHash = await this.proxyLink.execute.mutate([
calls,
abis,
transactionsDetail,
])
const details =
abiOrDetails === undefined || Array.isArray(abiOrDetails)
? transactionDetails
: abiOrDetails

const txHash = await this.proxyLink.execute.mutate([calls, details])
return {
transaction_hash: txHash,
}
Expand All @@ -91,7 +92,7 @@ export class MessageAccount extends Account implements AccountInterface {
}

signMessage: StarknetMethods["signMessage"] = async (
typedData: typedData.TypedData,
typedData: TypedData,
): Promise<Signature> => {
try {
setPopupOptions({
Expand Down
17 changes: 10 additions & 7 deletions src/types/window.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const shortStringSchema = z
"The shortString should not be an integer string",
)

const bignumberishSchema = z.union([
export const BigNumberishSchema = z.union([
z
.string()
.regex(
Expand All @@ -38,9 +38,13 @@ const bignumberishSchema = z.union([
export const CallSchema = z.object({
contractAddress: z.string(),
entrypoint: z.string(),
calldata: z.array(bignumberishSchema).optional(),
calldata: z
.array(BigNumberishSchema.or(z.array(BigNumberishSchema)))
.optional(),
})

export const CallsArraySchema = z.array(CallSchema).nonempty()

export const typedDataSchema = z.object({
types: z.record(
z.array(
Expand Down Expand Up @@ -108,13 +112,12 @@ export const StarknetMethodArgumentsSchemas = {
}),
]),
execute: z.tuple([
z.array(CallSchema).nonempty().or(CallSchema),
z.array(z.any()).optional(),
CallsArraySchema.or(CallSchema),
z
.object({
nonce: bignumberishSchema.optional(),
maxFee: bignumberishSchema.optional(),
version: bignumberishSchema.optional(),
nonce: BigNumberishSchema.optional(),
maxFee: BigNumberishSchema.optional(),
version: BigNumberishSchema.optional(),
})
.optional(),
]),
Expand Down
Loading