Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
@casual-simulation/aux-common
Advanced tools
A library that contains common operations needed to modify and understand AUX files.
$ npm install @casual-simulation/aux-common
import {
createBot,
createCalculationContext,
calculateFormulaValue,
} from '@casual-simulation/aux-common';
const file1 = createBot('test1', {
quantity: 10,
});
const file2 = createBot('test2', {
quantity: 5,
});
const file3 = createBot('test3', {
quantity: 5,
});
const context = createCalculationContext([file1, file2, file3]);
const formula = '=math.sum(getBotTagValues("#quantity"))';
const result = calculateFormulaValue(context, formula);
console.log(result);
// Outputs:
// 20
import {
createBot,
createCalculationContext,
calculateFormulaEvents,
} from '@casual-simulation/aux-common';
const state = {
test1: createBot('test1', {
quantity: 10,
}),
test2: createBot('test2', {
quantity: 5,
}),
test3: createBot('test3', {
quantity: 5,
}),
};
const formula = `
let total = math.sum(getBotTagValues("#quantity"));
player.toast("The total is " + total);
`;
const events = calculateFormulaEvents(state, formula);
for (let event of events) {
if (event.type === 'local') {
if (event.name === 'show_toast') {
console.log('[Toast]', event.message);
}
}
}
// Outputs:
// [Toast] The total is 5
V3.3.13
Added ai.chat.allowedModels
feature to enforce model usage limits, restricting access to specific models based on configuration.
Added shared documents.
Shared documents utilize insts to be able to share data without using bots and tags.
Additionally, shared documents can be loaded and unloaded at will.
The following functions have been added:
os.getSharedDocument(name)
- Gets a document that is stored in the current inst.os.getSharedDocument(recordName, inst, name)
- Gets a document that is stored in the specified inst.os.getLocalDocument(name)
- Gets a document that is stored on this device.os.getMemoryDocument()
- Gets a document that is stored in memory and cleared upon refresh.Usage:
// Get a document stored in this inst named "test"
const doc = await os.getSharedDocument('test');
// maps work like the Map type (see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map)
const inventory = doc.getMap<number>('inventory');
inventory.set('spoons', 2);
inventory.set('forks', 3);
os.log('Number of spoons: ' + inventory.get('spoons'));
// arrays work like regular JavaScript arrays:
const shoppingList = doc.getArray<string>('shoppingList');
shoppingList.push('cereal', 'milk', 'eggs');
os.log('Shopping list:', inventory.toArray());
// Text is a special type that makes it easy to work with long strings
const blogPost = doc.getText('blogPost');
blogPost.insert(0, 'Hello, world!');
os.log('Blog Post:\n', blogPost.toString());
os.joinRoom()
.FAQs
Common library for AUX projects
The npm package @casual-simulation/aux-common receives a total of 74 weekly downloads. As such, @casual-simulation/aux-common popularity was classified as not popular.
We found that @casual-simulation/aux-common demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.