You can do following to allow passing blob into contract without a lot of overhead:
export function setContractToDeploy(): void {
env.input(0);
util.read_register(0);
// ...
}
const std = @import("std"); | |
// NOTE: In smart contract context don't really have to free memory before execution ends | |
var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator); | |
var allocator = arena.allocator(); | |
// Import host functions provided by NEAR runtime. | |
// See https://github.com/near/near-sdk-rs/blob/78c16447486285fd952765ef3e727e16d6c8c867/near-sdk/src/environment/env.rs#L117 | |
extern fn input(register_id: u64) void; | |
extern fn read_register(register_id: u64, ptr: u64) void; |
import "allocator/arena"; | |
// TODO: Why cannot import from index? | |
// import { BSONEncoder, BSONDecoder } from "../../../assemblyscript-bson/assembly"; | |
import { BSONEncoder } from "../../../assemblyscript-bson/assembly/encoder"; | |
import { BSONDecoder } from "../../../assemblyscript-bson/assembly/decoder"; | |
declare function sayHello(): void; | |
export class FooBar { | |
foo: i32 = 0; |
select | |
format_timestamp('%m/%d/%Y %H:%M:%S', timestamp_millis(div(block_timestamp, 1000000))) as `Date`, | |
parse_bignumeric(json_value(args, '$.deposit')) / POW(cast(10 as bignumeric), 24) as `Sent Quantity`, | |
'NEAR' as `Sent Currency` | |
, receipt_predecessor_account_id | |
, receipt_receiver_account_id | |
from `bigquery-public-data.crypto_near_mainnet_us.receipt_actions` | |
where receipt_predecessor_account_id in | |
( | |
'vlad.near', |
// Tokenize the JSON string by splitting on `{`, `}`, `[`, and `]`, unless the character is inside a string | |
char* token = strtok(jsonCopy, "{}[],"); | |
bool inString = false; | |
int depth = 0; | |
while (token != NULL) { | |
if (!inString && depth == 0 && strcmp(token, path) == 0) { | |
// The requested path was found, so return the next token as the value | |
token = strtok(NULL, "{}[],"); | |
slice_t value = { | |
.len = strlen(token), |
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions | |
{ | |
// Some other stuff here ... | |
CGFloat scale = 4.71f/5.82f; | |
CGAffineTransform scaleTransform = CGAffineTransformMakeScale(scale, scale); | |
self.window.transform = CGAffineTransformConcat(scaleTransform, self.window.transform); | |
self.window.clipsToBounds = YES; | |
[self statusBarChanged:nil]; |
select | |
to_timestamp(receipt_included_in_block_timestamp / 1000000000) as timestamp, | |
(args->>'deposit')::numeric / (10 ^ 24) as deposit, | |
receipt_predecessor_account_id | |
from action_receipt_actions | |
where receipt_receiver_account_id = 'root.near' | |
and receipt_predecessor_account_id != 'system' |
sqlite3 = require('sqlite3') | |
db = new sqlite3.Database('db/testnet-database.sqlite') | |
db.all(`select name from sqlite_master where type='table'`, console.log) | |
db.all(`select * from transactions where actions like '%deploy%' limit 10`, console.log) | |
db.all(`select count(*) from transactions where actions like '%deploy%' limit 10`, console.log) |
import org.codehaus.groovy.grails.plugins.codecs.Base64Codec | |
class PlistUtility { | |
static parseXmlPlistText(String text) { | |
def xml = new XmlParser().parseText(text) | |
assert xml.name() == "plist" | |
def parseNode | |
parseNode = { node -> |
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<title>js-libp2p parcel.js browser example</title> | |
</head> | |
<body> |
You can do following to allow passing blob into contract without a lot of overhead:
export function setContractToDeploy(): void {
env.input(0);
util.read_register(0);
// ...
}