Skip to content

Commit

Permalink
Merge branch 'main' into fix
Browse files Browse the repository at this point in the history
  • Loading branch information
moldy530 authored Jan 7, 2025
2 parents 40760b7 + dbf4db9 commit 0f31c19
Show file tree
Hide file tree
Showing 47 changed files with 9,767 additions and 150 deletions.
13 changes: 13 additions & 0 deletions .github/workflows/on-pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,19 @@ jobs:
fetch-depth: "0"
submodules: "recursive"

- name: free disk space
run: |
sudo swapoff -a
sudo rm -f /swapfile
sudo apt clean
images=$(docker image ls -aq)
if [ -n "$images" ]; then
docker rmi $images
else
echo "No images to remove."
fi
df -h
- name: Setup
uses: ./.github/actions/setup

Expand Down
2 changes: 1 addition & 1 deletion .vitest/src/instances.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export const local060Instance = defineInstance({

export const local070Instance = defineInstance({
chain: localhost,
forkBlockNumber: 6381303,
forkBlockNumber: 7303015,
forkUrl:
process.env.VITEST_SEPOLIA_FORK_URL ??
"https://ethereum-sepolia-rpc.publicnode.com",
Expand Down
2 changes: 1 addition & 1 deletion CODEOWNERS
Original file line number Diff line number Diff line change
@@ -1 +1 @@
* @moldy530 @rthomare @dancoombs @mokok123 @avasisht23 @dphilipson @linnall
* @moldy530 @rthomare @dancoombs @mokok123 @dphilipson @linnall @adamegyed @howydev @zer0dot @jaypaik @blu-j
5 changes: 3 additions & 2 deletions aa-sdk/core/src/account/smartContractAccount.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import {
getContract,
hexToBytes,
trim,
type Address,
type Chain,
type CustomSource,
Expand Down Expand Up @@ -483,7 +482,9 @@ export async function toSmartContractAccount(
);
}

return trim(storage);
// The storage slot contains a full bytes32, but we want only the last 20 bytes.
// So, slice off the leading `0x` and the first 12 bytes (24 characters), leaving the last 20 bytes, then prefix with `0x`.
return `0x${storage.slice(26)}`;
};

if (entryPoint.version !== "0.6.0" && entryPoint.version !== "0.7.0") {
Expand Down
50 changes: 50 additions & 0 deletions aa-sdk/core/src/errors/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,53 @@ export class ChainNotFoundError extends BaseError {
super("No chain supplied to the client");
}
}

/**
* Error class denoting that the provided entity id is invalid because it's too large.
*/
export class InvalidEntityIdError extends BaseError {
override name = "InvalidEntityIdError";

/**
* Initializes a new instance of the error message with a default message indicating that the entity id is invalid because it's too large.
*
* @param {number} entityId the invalid entityId used
*/
constructor(entityId: number) {
super(
`Entity ID used is ${entityId}, but must be less than or equal to uint32.max`
);
}
}

/**
* Error class denoting that the nonce key is invalid because its too large.
*/
export class InvalidNonceKeyError extends BaseError {
override name = "InvalidNonceKeyError";

/**
* Initializes a new instance of the error message with a default message indicating that the nonce key is invalid.
*
* @param {bigint} nonceKey the invalid nonceKey used
*/
constructor(nonceKey: bigint) {
super(
`Nonce key is ${nonceKey} but has to be less than or equal to 2**152`
);
}
}

/**
* Error class denoting that the provided entity id is invalid because it's overriding the native entity id.
*/
export class EntityIdOverrideError extends BaseError {
override name = "EntityIdOverrideError";

/**
* Initializes a new instance of the error message with a default message indicating that the nonce key is invalid.
*/
constructor() {
super(`EntityId of 0 is reserved for the owner and cannot be used`);
}
}
3 changes: 3 additions & 0 deletions aa-sdk/core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ export {
ChainNotFoundError,
IncompatibleClientError,
InvalidRpcUrlError,
InvalidEntityIdError,
InvalidNonceKeyError,
EntityIdOverrideError,
} from "./errors/client.js";
export {
EntryPointNotFoundError,
Expand Down
17 changes: 9 additions & 8 deletions account-kit/rn-signer/example/src/screens/otp-auth.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,24 @@ import {

import Config from "react-native-config";
import { RNAlchemySigner } from "@account-kit/react-native-signer";
export default function MagicLinkAuthScreen() {

const signer = RNAlchemySigner({
client: { connection: { apiKey: Config.API_KEY! } },
});

export default function OTPAuthScreen() {
const [email, setEmail] = useState<string>("");
const [user, setUser] = useState<User | null>(null);

const signer = RNAlchemySigner({
client: { connection: { apiKey: Config.API_KEY! } },
});

const [awaitingOtp, setAwaitingOtp] = useState<boolean>(false);

const [otpCode, setOtpCode] = useState<string>("");

const handleUserAuth = ({ otpCode }: { otpCode: string }) => {
const handleUserAuth = ({ code }: { code: string }) => {
setAwaitingOtp(false);
signer
.authenticate({
otpCode: otpCode,
otpCode: code,
type: "otp",
})
.then((res) => {
Expand Down Expand Up @@ -55,7 +56,7 @@ export default function MagicLinkAuthScreen() {
/>
<TouchableOpacity
style={styles.button}
onPress={() => handleUserAuth({ otpCode })}
onPress={() => handleUserAuth({ code: otpCode })}
>
<Text style={styles.buttonText}>Sign in</Text>
</TouchableOpacity>
Expand Down
5 changes: 5 additions & 0 deletions account-kit/smart-contracts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@
"import": "./dist/esm/plugindefs/index.js",
"default": "./dist/esm/plugindefs/index.js"
},
"./experimental": {
"types": "./dist/types/src/ma-v2/index.d.ts",
"import": "./dist/esm/src/ma-v2/index.js",
"default": "./dist/esm/src/ma-v2/index.js"
},
"./package.json": "./package.json"
},
"scripts": {
Expand Down
Loading

0 comments on commit 0f31c19

Please sign in to comment.