New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@rhinestone/orchestrator-sdk

Package Overview
Dependencies
Maintainers
0
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@rhinestone/orchestrator-sdk - npm Package Compare versions

Comparing version 0.0.3 to 0.1.0

22

_cjs/common/hash.js

@@ -5,4 +5,4 @@ "use strict";

const viem_1 = require("viem");
const typehashTypes_1 = require("../constants/typehashTypes");
const ACROSS_TRANSFER_TYPEHASH = '0xee2056ef95579555475af3a751f04f29e041cedf8232901492fffb1808c7fd99';
const constants_1 = require("../constants");
const ACROSS_TRANSFER_TYPEHASH = '0x2c207ea4e14283d6620837628d3aa63486714ffdf9bd83436f971b1157f5d51a';
const EXECUTION_TYPEHASH = '0x37fb04e5593580b36bfacc47d8b1a4b9a2acb88a513bf153760f925a6723d4b5';

@@ -12,7 +12,7 @@ const SIGNED_EXECUTIONS_TYPEHASH = '0xe7ceef5557a675caf34313bd56c0d0952522a89ffc3efbe1ce6a9fca2257c0a3';

const TOKEN_TRANSFER_TYPEHASH = '0xef3136c9bbc8441e191dc61c253d9479f54ef95a64b36b8581d51a156f7512c4';
const SIGNED_INTENT_TYPEHASH = '0xd714a8401248b943a7db2c285bdacfa439f95fc2804282de474bea0194ee89e4';
const SIGNED_INTENT_WITH_AUCTION_FEE_TYPEHASH = '0x3fcc83bf31d227d374fb57ade6ccfa70ffde400e9b905cb3ab0c30c18a29fa64';
const SIGNED_INTENT_TYPEHASH = '0x9bafa23b0ee7874c656c66202e7ff9c0f6b794631cfff0a50b9bdd2041f1d4be';
const SIGNED_INTENT_WITH_AUCTION_FEE_TYPEHASH = '0xa0abe415300d58e370d7d8eb5507aa75764fb2d77d9d91ee92a3415ad1b22a37';
const SIGNED_USER_OP_TYPEHASH = '0x81264956c7c6625e9c85b65ea4d4eaeb56247ec77f1b277e3635a99ff98b11c2';
const hashOrchestratorBundle = (signedIntentDigest, auctionFee) => {
return (0, viem_1.keccak256)((0, viem_1.encodeAbiParameters)(typehashTypes_1.typehashTypes.SignedIntentWithAuctionFee, [
return (0, viem_1.keccak256)((0, viem_1.encodeAbiParameters)(constants_1.typehashTypes.SignedIntentWithAuctionFee, [
SIGNED_INTENT_WITH_AUCTION_FEE_TYPEHASH,

@@ -25,3 +25,3 @@ auctionFee,

const hashTokenTransfer = (tokenTransfer) => {
return (0, viem_1.keccak256)((0, viem_1.encodeAbiParameters)(typehashTypes_1.typehashTypes.TokenTransfer, [
return (0, viem_1.keccak256)((0, viem_1.encodeAbiParameters)(constants_1.typehashTypes.TokenTransfer, [
TOKEN_TRANSFER_TYPEHASH,

@@ -38,3 +38,3 @@ tokenTransfer.tokenAddress,

const hashSettlement = (settlement) => {
return (0, viem_1.keccak256)((0, viem_1.encodeAbiParameters)(typehashTypes_1.typehashTypes.Settlement, [
return (0, viem_1.keccak256)((0, viem_1.encodeAbiParameters)(constants_1.typehashTypes.Settlement, [
SETTLEMENT_TYPEHASH,

@@ -51,3 +51,3 @@ settlement.orchestrator,

const hashAcrossTransfer = (acrossTransfer) => {
return (0, viem_1.keccak256)((0, viem_1.encodeAbiParameters)(typehashTypes_1.typehashTypes.AcrossTransfer, [
return (0, viem_1.keccak256)((0, viem_1.encodeAbiParameters)(constants_1.typehashTypes.AcrossTransfer, [
ACROSS_TRANSFER_TYPEHASH,

@@ -67,3 +67,3 @@ acrossTransfer.originModule,

const hashExecution = (execution) => {
return (0, viem_1.keccak256)((0, viem_1.encodeAbiParameters)(typehashTypes_1.typehashTypes.Execution, [
return (0, viem_1.keccak256)((0, viem_1.encodeAbiParameters)(constants_1.typehashTypes.Execution, [
EXECUTION_TYPEHASH,

@@ -77,3 +77,3 @@ execution.target,

const hashSignedExecutions = (signedExecutions) => {
return (0, viem_1.keccak256)((0, viem_1.encodeAbiParameters)(typehashTypes_1.typehashTypes.SignedExecutions, [
return (0, viem_1.keccak256)((0, viem_1.encodeAbiParameters)(constants_1.typehashTypes.SignedExecutions, [
SIGNED_EXECUTIONS_TYPEHASH,

@@ -90,3 +90,3 @@ (0, exports.hashExecutionArray)(signedExecutions.executions),

const hashPackedUserOperation = (packedUserOperation) => {
return (0, viem_1.keccak256)((0, viem_1.encodeAbiParameters)(typehashTypes_1.typehashTypes.PackedUserOperation, [
return (0, viem_1.keccak256)((0, viem_1.encodeAbiParameters)(constants_1.typehashTypes.PackedUserOperation, [
SIGNED_USER_OP_TYPEHASH,

@@ -93,0 +93,0 @@ packedUserOperation.sender,

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.signOrderBundleWithOwnableValidator = signOrderBundleWithOwnableValidator;
const module_sdk_1 = require("@rhinestone/module-sdk");
exports.getOrderBundleHash = getOrderBundleHash;
exports.getSignedOrderBundle = getSignedOrderBundle;
const viem_1 = require("viem");
const accounts_1 = require("viem/accounts");
const constants_1 = require("../constants");
const utils_1 = require("../utils");
async function signOrderBundleWithOwnableValidator(orderBundle, privateKey) {
const hash = (0, viem_1.hashTypedData)({
async function getOrderBundleHash(orderBundle) {
return (0, viem_1.hashTypedData)({
domain: (0, utils_1.getOrderDomain)(),

@@ -16,13 +15,4 @@ types: constants_1.smartContractTypes,

});
const account = (0, accounts_1.privateKeyToAccount)(privateKey);
const signature = await account.signMessage({
message: {
raw: hash,
},
});
const ownableValidatorSig = (0, module_sdk_1.getOwnableValidatorSignature)({
signatures: [signature],
});
const encodedSignature = (module_sdk_1.OWNABLE_VALIDATOR_ADDRESS +
ownableValidatorSig.slice(2));
}
async function getSignedOrderBundle(orderBundle, orderBundleSignature) {
return {

@@ -32,6 +22,6 @@ settlement: orderBundle.settlement,

...transfer,
userSignature: encodedSignature,
userSignature: orderBundleSignature,
})),
targetChainExecutions: orderBundle.targetChainExecutions,
targetExecutionSignature: encodedSignature,
targetExecutionSignature: orderBundleSignature,
userOp: orderBundle.userOp,

@@ -38,0 +28,0 @@ };

@@ -13,4 +13,4 @@ "use strict";

const hook = '0xF7913a68dD7bFF74f0828Ac9d879C6195B370EB8';
const originModule = '0xBdb703d933Fac61b3Cf3909Cb2C82C5e4DAEFf1D';
const targetModule = '0x6961515e13B3b2B09b4B7333B1860ee8DBE98921';
const originModule = '0xD3C6B5539E0d70F58160Cd023DB16853847Ec61E';
const targetModule = '0x3cEb8931374cB8F2e300325Af27F44312719B4BB';
const spokepool = '0x7C941271191E0c9A01E360BAE660D21568fc6ca0';

@@ -17,0 +17,0 @@ const weth = '0x47D41c334497f06ab42e60C4036c506D924DDc9c';

@@ -7,3 +7,2 @@ "use strict";

exports.Orchestrator = void 0;
const signer_1 = require("./common/signer");
const utils_1 = require("./utils");

@@ -104,22 +103,2 @@ const axios_1 = __importDefault(require("axios"));

}
async postMetaIntentWithOwnableValidator(metaIntent, userId, privateKey) {
try {
const { orderBundle, injectedExecutions } = await this.getOrderPath(metaIntent, userId);
const signedOrderBundle = await (0, signer_1.signOrderBundleWithOwnableValidator)(orderBundle, privateKey);
const response = await axios_1.default.post(`${this.serverUrl}/users/${userId}/bundles`, {
signedOrderBundle: signedOrderBundle,
}, {
headers: {
'x-api-key': this.apiKey,
},
});
return response.data.bundleId;
}
catch (error) {
if (error instanceof Error) {
console.log(error);
}
}
throw new Error('Failed to post order bundle');
}
async getBundleStatus(userId, bundleId) {

@@ -126,0 +105,0 @@ try {

import { encodeAbiParameters, encodePacked, keccak256, } from 'viem';
import { typehashTypes } from '../constants/typehashTypes';
const ACROSS_TRANSFER_TYPEHASH = '0xee2056ef95579555475af3a751f04f29e041cedf8232901492fffb1808c7fd99';
import { typehashTypes } from '../constants';
const ACROSS_TRANSFER_TYPEHASH = '0x2c207ea4e14283d6620837628d3aa63486714ffdf9bd83436f971b1157f5d51a';
const EXECUTION_TYPEHASH = '0x37fb04e5593580b36bfacc47d8b1a4b9a2acb88a513bf153760f925a6723d4b5';

@@ -8,4 +8,4 @@ const SIGNED_EXECUTIONS_TYPEHASH = '0xe7ceef5557a675caf34313bd56c0d0952522a89ffc3efbe1ce6a9fca2257c0a3';

const TOKEN_TRANSFER_TYPEHASH = '0xef3136c9bbc8441e191dc61c253d9479f54ef95a64b36b8581d51a156f7512c4';
const SIGNED_INTENT_TYPEHASH = '0xd714a8401248b943a7db2c285bdacfa439f95fc2804282de474bea0194ee89e4';
const SIGNED_INTENT_WITH_AUCTION_FEE_TYPEHASH = '0x3fcc83bf31d227d374fb57ade6ccfa70ffde400e9b905cb3ab0c30c18a29fa64';
const SIGNED_INTENT_TYPEHASH = '0x9bafa23b0ee7874c656c66202e7ff9c0f6b794631cfff0a50b9bdd2041f1d4be';
const SIGNED_INTENT_WITH_AUCTION_FEE_TYPEHASH = '0xa0abe415300d58e370d7d8eb5507aa75764fb2d77d9d91ee92a3415ad1b22a37';
const SIGNED_USER_OP_TYPEHASH = '0x81264956c7c6625e9c85b65ea4d4eaeb56247ec77f1b277e3635a99ff98b11c2';

@@ -12,0 +12,0 @@ export const hashOrchestratorBundle = (signedIntentDigest, auctionFee) => {

@@ -1,8 +0,6 @@

import { getOwnableValidatorSignature, OWNABLE_VALIDATOR_ADDRESS, } from '@rhinestone/module-sdk';
import { hashTypedData } from 'viem';
import { privateKeyToAccount } from 'viem/accounts';
import { smartContractTypes } from '../constants';
import { getOrderDomain } from '../utils';
export async function signOrderBundleWithOwnableValidator(orderBundle, privateKey) {
const hash = hashTypedData({
export async function getOrderBundleHash(orderBundle) {
return hashTypedData({
domain: getOrderDomain(),

@@ -13,14 +11,4 @@ types: smartContractTypes,

});
const account = privateKeyToAccount(privateKey);
// Add the prefix for ownable validator sig
const signature = await account.signMessage({
message: {
raw: hash,
},
});
const ownableValidatorSig = getOwnableValidatorSignature({
signatures: [signature],
});
const encodedSignature = (OWNABLE_VALIDATOR_ADDRESS +
ownableValidatorSig.slice(2));
}
export async function getSignedOrderBundle(orderBundle, orderBundleSignature) {
return {

@@ -30,6 +18,6 @@ settlement: orderBundle.settlement,

...transfer,
userSignature: encodedSignature,
userSignature: orderBundleSignature,
})),
targetChainExecutions: orderBundle.targetChainExecutions,
targetExecutionSignature: encodedSignature,
targetExecutionSignature: orderBundleSignature,
userOp: orderBundle.userOp,

@@ -36,0 +24,0 @@ };

@@ -5,4 +5,4 @@ import { arbitrum, arbitrumSepolia, base, baseSepolia, optimism, optimismSepolia, sepolia, } from 'viem/chains';

const hook = '0xF7913a68dD7bFF74f0828Ac9d879C6195B370EB8';
const originModule = '0xBdb703d933Fac61b3Cf3909Cb2C82C5e4DAEFf1D';
const targetModule = '0x6961515e13B3b2B09b4B7333B1860ee8DBE98921';
const originModule = '0xD3C6B5539E0d70F58160Cd023DB16853847Ec61E';
const targetModule = '0x3cEb8931374cB8F2e300325Af27F44312719B4BB';
const spokepool = '0x7C941271191E0c9A01E360BAE660D21568fc6ca0';

@@ -9,0 +9,0 @@ const weth = '0x47D41c334497f06ab42e60C4036c506D924DDc9c';

@@ -1,5 +0,3 @@

import { signOrderBundleWithOwnableValidator } from './common/signer';
import { convertBigIntFields } from './utils';
import axios from 'axios';
// TODO: Export more helpful constants like the contract addresses, Spokepool addresses, etc.
// TODO: Add strict typing to the return values of the endpoints.

@@ -99,22 +97,2 @@ export class Orchestrator {

}
async postMetaIntentWithOwnableValidator(metaIntent, userId, privateKey) {
try {
const { orderBundle, injectedExecutions } = await this.getOrderPath(metaIntent, userId);
const signedOrderBundle = await signOrderBundleWithOwnableValidator(orderBundle, privateKey);
const response = await axios.post(`${this.serverUrl}/users/${userId}/bundles`, {
signedOrderBundle: signedOrderBundle,
}, {
headers: {
'x-api-key': this.apiKey,
},
});
return response.data.bundleId;
}
catch (error) {
if (error instanceof Error) {
console.log(error);
}
}
throw new Error('Failed to post order bundle');
}
async getBundleStatus(userId, bundleId) {

@@ -121,0 +99,0 @@ try {

import { Hex } from 'viem';
import { SignedIntent, SignedOrderBundle } from '../types';
export declare function signOrderBundleWithOwnableValidator(orderBundle: SignedIntent, privateKey: Hex): Promise<SignedOrderBundle>;
export declare function getOrderBundleHash(orderBundle: SignedIntent): Promise<Hex>;
export declare function getSignedOrderBundle(orderBundle: SignedIntent, orderBundleSignature: Hex): Promise<SignedOrderBundle>;
//# sourceMappingURL=signer.d.ts.map

@@ -1,2 +0,2 @@

import { Address, Hex } from 'viem';
import { Address } from 'viem';
import { BundleIdStatus, Execution, MetaIntent, SignedIntent, SignedOrderBundle } from './types';

@@ -18,3 +18,2 @@ export declare class Orchestrator {

postSignedOrderBundle(signedOrderBundle: SignedOrderBundle, userId: string): Promise<string>;
postMetaIntentWithOwnableValidator(metaIntent: MetaIntent, userId: string, privateKey: Hex): Promise<string>;
getBundleStatus(userId: string, bundleId: string): Promise<BundleIdStatus>;

@@ -21,0 +20,0 @@ getSolverClaimPayload(bundleId: string): Promise<any>;

@@ -18,6 +18,6 @@ import {

} from '../types'
import { typehashTypes } from '../constants/typehashTypes'
import { typehashTypes } from '../constants'
const ACROSS_TRANSFER_TYPEHASH =
'0xee2056ef95579555475af3a751f04f29e041cedf8232901492fffb1808c7fd99'
'0x2c207ea4e14283d6620837628d3aa63486714ffdf9bd83436f971b1157f5d51a'

@@ -37,6 +37,6 @@ const EXECUTION_TYPEHASH =

const SIGNED_INTENT_TYPEHASH =
'0xd714a8401248b943a7db2c285bdacfa439f95fc2804282de474bea0194ee89e4'
'0x9bafa23b0ee7874c656c66202e7ff9c0f6b794631cfff0a50b9bdd2041f1d4be'
const SIGNED_INTENT_WITH_AUCTION_FEE_TYPEHASH =
'0x3fcc83bf31d227d374fb57ade6ccfa70ffde400e9b905cb3ab0c30c18a29fa64'
'0xa0abe415300d58e370d7d8eb5507aa75764fb2d77d9d91ee92a3415ad1b22a37'

@@ -43,0 +43,0 @@ const SIGNED_USER_OP_TYPEHASH =

@@ -1,5 +0,1 @@

import {
getOwnableValidatorSignature,
OWNABLE_VALIDATOR_ADDRESS,
} from '@rhinestone/module-sdk'
import { hashTypedData, Hex } from 'viem'

@@ -11,8 +7,6 @@ import { privateKeyToAccount } from 'viem/accounts'

export async function signOrderBundleWithOwnableValidator(
export async function getOrderBundleHash(
orderBundle: SignedIntent,
privateKey: Hex,
): Promise<SignedOrderBundle> {
const hash = hashTypedData({
): Promise<Hex> {
return hashTypedData({
domain: getOrderDomain(),

@@ -23,19 +17,8 @@ types: smartContractTypes,

})
}
const account = privateKeyToAccount(privateKey)
// Add the prefix for ownable validator sig
const signature = await account.signMessage({
message: {
raw: hash,
},
})
const ownableValidatorSig = getOwnableValidatorSignature({
signatures: [signature],
})
const encodedSignature = (OWNABLE_VALIDATOR_ADDRESS +
ownableValidatorSig.slice(2)) as Hex
export async function getSignedOrderBundle(
orderBundle: SignedIntent,
orderBundleSignature: Hex,
): Promise<SignedOrderBundle> {
return {

@@ -45,8 +28,8 @@ settlement: orderBundle.settlement,

...transfer,
userSignature: encodedSignature,
userSignature: orderBundleSignature,
})),
targetChainExecutions: orderBundle.targetChainExecutions,
targetExecutionSignature: encodedSignature,
targetExecutionSignature: orderBundleSignature,
userOp: orderBundle.userOp,
}
}

@@ -20,4 +20,4 @@ import { Address } from 'viem'

const hook: Address = '0xF7913a68dD7bFF74f0828Ac9d879C6195B370EB8'
const originModule: Address = '0xBdb703d933Fac61b3Cf3909Cb2C82C5e4DAEFf1D'
const targetModule: Address = '0x6961515e13B3b2B09b4B7333B1860ee8DBE98921'
const originModule: Address = '0xD3C6B5539E0d70F58160Cd023DB16853847Ec61E'
const targetModule: Address = '0x3cEb8931374cB8F2e300325Af27F44312719B4BB'
const spokepool: Address = '0x7C941271191E0c9A01E360BAE660D21568fc6ca0'

@@ -24,0 +24,0 @@ const weth: Address = '0x47D41c334497f06ab42e60C4036c506D924DDc9c'

import { Address, Hex } from 'viem'
import { signOrderBundleWithOwnableValidator } from './common/signer'
import {

@@ -13,3 +12,2 @@ BundleIdStatus,

// TODO: Export more helpful constants like the contract addresses, Spokepool addresses, etc.
// TODO: Add strict typing to the return values of the endpoints.

@@ -143,36 +141,2 @@

async postMetaIntentWithOwnableValidator(
metaIntent: MetaIntent,
userId: string,
privateKey: Hex,
): Promise<string> {
try {
const { orderBundle, injectedExecutions } = await this.getOrderPath(
metaIntent,
userId,
)
const signedOrderBundle = await signOrderBundleWithOwnableValidator(
orderBundle,
privateKey,
)
const response = await axios.post(
`${this.serverUrl}/users/${userId}/bundles`,
{
signedOrderBundle: signedOrderBundle,
},
{
headers: {
'x-api-key': this.apiKey,
},
},
)
return response.data.bundleId
} catch (error) {
if (error instanceof Error) {
console.log(error)
}
}
throw new Error('Failed to post order bundle')
}
async getBundleStatus(

@@ -179,0 +143,0 @@ userId: string,

{
"name": "@rhinestone/orchestrator-sdk",
"version": "0.0.3",
"version": "0.1.0",
"description": "A TypeScript library for using the Rhinestone Orchestrator",

@@ -23,4 +23,3 @@ "author": {

"peerDependencies": {
"viem": "^2.17.8",
"@rhinestone/module-sdk": "^0.1.29"
"viem": "^2.17.8"
},

@@ -27,0 +26,0 @@ "homepage": "https://docs.rhinestone.wtf/orchestrator-sdk",

@@ -42,15 +42,15 @@ # Orchestrator SDK

```bash
npm install viem @rhinestone/module-sdk @rhinestone/orchestrator-sdk
npm install viem @rhinestone/orchestrator-sdk
```
```bash
pnpm install viem @rhinestone/module-sdk @rhinestone/orchestrator-sdk
pnpm install viem @rhinestone/orchestrator-sdk
```
```bash
yarn add viem @rhinestone/module-sdk @rhinestone/orchestrator-sdk
yarn add viem @rhinestone/orchestrator-sdk
```
```bash
bun install viem @rhinestone/module-sdk @rhinestone/orchestrator-sdk
bun install viem @rhinestone/orchestrator-sdk
```

@@ -57,0 +57,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc