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

Attempt MultiSign #143

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft

Attempt MultiSign #143

wants to merge 3 commits into from

Conversation

bh2smith
Copy link
Collaborator

@bh2smith bh2smith commented Nov 6, 2024

This thing is complaining about requestMulti. I have tried everything it suggests, but it won't accept.

Seems like disagreement with near-api-js and near wallet selector... not sure. The types have certainly changed since I last looked.

To try:

npx tsx examples/send-eth.ts
Error with Borsch (Resolved)
/Users/bh2smith/Projects/mintbase/evm/near-ca/node_modules/borsh/lib/cjs/serialize.js:117
        throw new Error("Enum key (".concat(valueKey, ") not found in enum schema: ").concat(JSON.stringify(schema), " at ").concat(this.fieldPath.join('.')));
              ^

Error: Enum key (enum) not found in enum schema: {"enum":[{"struct":{"createAccount":{"struct":{}}}},{"struct":{"deployContract":{"struct":{"code":{"array":{"type":"u8"}}}}}},{"struct":{"functionCall":{"struct":{"methodName":"string","args":{"array":{"type":"u8"}},"gas":"u64","deposit":"u128"}}}},{"struct":{"transfer":{"struct":{"deposit":"u128"}}}},{"struct":{"stake":{"struct":{"stake":"u128","publicKey":{"enum":[{"struct":{"ed25519Key":{"struct":{"data":{"array":{"type":"u8","len":32}}}}}},{"struct":{"secp256k1Key":{"struct":{"data":{"array":{"type":"u8","len":64}}}}}}]}}}}},{"struct":{"addKey":{"struct":{"publicKey":{"enum":[{"struct":{"ed25519Key":{"struct":{"data":{"array":{"type":"u8","len":32}}}}}},{"struct":{"secp256k1Key":{"struct":{"data":{"array":{"type":"u8","len":64}}}}}}]},"accessKey":{"struct":{"nonce":"u64","permission":{"enum":[{"struct":{"functionCall":{"struct":{"allowance":{"option":"u128"},"receiverId":"string","methodNames":{"array":{"type":"string"}}}}}},{"struct":{"fullAccess":{"struct":{}}}}]}}}}}}},{"struct":{"deleteKey":{"struct":{"publicKey":{"enum":[{"struct":{"ed25519Key":{"struct":{"data":{"array":{"type":"u8","len":32}}}}}},{"struct":{"secp256k1Key":{"struct":{"data":{"array":{"type":"u8","len":64}}}}}}]}}}}},{"struct":{"deleteAccount":{"struct":{"beneficiaryId":"string"}}}},{"struct":{"signedDelegate":{"struct":{"delegateAction":{"struct":{"senderId":"string","receiverId":"string","actions":{"array":{"type":{"enum":[{"struct":{"createAccount":{"struct":{}}}},{"struct":{"deployContract":{"struct":{"code":{"array":{"type":"u8"}}}}}},{"struct":{"functionCall":{"struct":{"methodName":"string","args":{"array":{"type":"u8"}},"gas":"u64","deposit":"u128"}}}},{"struct":{"transfer":{"struct":{"deposit":"u128"}}}},{"struct":{"stake":{"struct":{"stake":"u128","publicKey":{"enum":[{"struct":{"ed25519Key":{"struct":{"data":{"array":{"type":"u8","len":32}}}}}},{"struct":{"secp256k1Key":{"struct":{"data":{"array":{"type":"u8","len":64}}}}}}]}}}}},{"struct":{"addKey":{"struct":{"publicKey":{"enum":[{"struct":{"ed25519Key":{"struct":{"data":{"array":{"type":"u8","len":32}}}}}},{"struct":{"secp256k1Key":{"struct":{"data":{"array":{"type":"u8","len":64}}}}}}]},"accessKey":{"struct":{"nonce":"u64","permission":{"enum":[{"struct":{"functionCall":{"struct":{"allowance":{"option":"u128"},"receiverId":"string","methodNames":{"array":{"type":"string"}}}}}},{"struct":{"fullAccess":{"struct":{}}}}]}}}}}}},{"struct":{"deleteKey":{"struct":{"publicKey":{"enum":[{"struct":{"ed25519Key":{"struct":{"data":{"array":{"type":"u8","len":32}}}}}},{"struct":{"secp256k1Key":{"struct":{"data":{"array":{"type":"u8","len":64}}}}}}]}}}}},{"struct":{"deleteAccount":{"struct":{"beneficiaryId":"string"}}}}]}}},"nonce":"u64","maxBlockHeight":"u64","publicKey":{"enum":[{"struct":{"ed25519Key":{"struct":{"data":{"array":{"type":"u8","len":32}}}}}},{"struct":{"secp256k1Key":{"struct":{"data":{"array":{"type":"u8","len":64}}}}}}]}}},"signature":{"enum":[{"struct":{"ed25519Signature":{"struct":{"data":{"array":{"type":"u8","len":64}}}}}},{"struct":{"secp256k1Signature":{"struct":{"data":{"array":{"type":"u8","len":65}}}}}}]}}}}}]} at value.actions
    at BorshSerializer.encode_enum (/Users/bh2smith/Projects/mintbase/evm/near-ca/node_modules/borsh/lib/cjs/serialize.js:117:15)
    at BorshSerializer.encode_value (/Users/bh2smith/Projects/mintbase/evm/near-ca/node_modules/borsh/lib/cjs/serialize.js:53:29)
    at BorshSerializer.encode_arraylike (/Users/bh2smith/Projects/mintbase/evm/near-ca/node_modules/borsh/lib/cjs/serialize.js:136:18)
    at BorshSerializer.encode_array (/Users/bh2smith/Projects/mintbase/evm/near-ca/node_modules/borsh/lib/cjs/serialize.js:121:25)
    at BorshSerializer.encode_value (/Users/bh2smith/Projects/mintbase/evm/near-ca/node_modules/borsh/lib/cjs/serialize.js:55:29)
    at BorshSerializer.encode_struct (/Users/bh2smith/Projects/mintbase/evm/near-ca/node_modules/borsh/lib/cjs/serialize.js:180:18)
    at BorshSerializer.encode_value (/Users/bh2smith/Projects/mintbase/evm/near-ca/node_modules/borsh/lib/cjs/serialize.js:61:29)
    at BorshSerializer.encode (/Users/bh2smith/Projects/mintbase/evm/near-ca/node_modules/borsh/lib/cjs/serialize.js:37:14)
    at serialize (/Users/bh2smith/Projects/mintbase/evm/near-ca/node_modules/borsh/lib/cjs/index.js:35:23)
    at encodeTransaction (/Users/bh2smith/Projects/mintbase/evm/near-ca/node_modules/@near-js/transactions/lib/commonjs/schema.cjs:34:34)

Trying to mimic the type declared in @near-js/transactions:

/**
 * Contains a list of the valid transaction Actions available with this API
 * @see {@link https://nomicon.io/RuntimeSpec/Actions.html | Actions Spec}
 */
export declare class Action extends Enum {
    enum: string;
    createAccount?: CreateAccount;
    deployContract?: DeployContract;
    functionCall?: FunctionCall;
    transfer?: Transfer;
    stake?: Stake;
    addKey?: AddKey;
    deleteKey?: DeleteKey;
    deleteAccount?: DeleteAccount;
    signedDelegate?: SignedDelegate;
    constructor(props: any);
}
//# sourceMappingURL=actions.d.ts.map

now the problem is max gas limit exceeded.

However, the contract authors will soon implement this natively on the contract!

near/mpc#880

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant