near-api-js 7.0.4 → 7.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,7 +4,7 @@ import type { RpcTransactionResponse } from '../rpc/types.gen.js';
4
4
  import { type SignedMessage, type Signer } from '../signers/index.js';
5
5
  import type { SignDelegateActionReturn } from '../signers/signer.js';
6
6
  import type { FungibleToken, NativeToken } from '../tokens/index.js';
7
- import { type Action, type DelegateAction, type SignedTransaction } from '../transactions/index.js';
7
+ import { type Action, type DelegateAction, type SignedDelegate, type SignedTransaction } from '../transactions/index.js';
8
8
  import type { SerializedReturnValue, TxExecutionStatus } from '../types/index.js';
9
9
  export declare const DEFAULT_WAIT_STATUS: TxExecutionStatus;
10
10
  export interface AccountState {
@@ -307,6 +307,13 @@ export declare class Account {
307
307
  * @returns The available balance of the account in units (e.g. yoctoNEAR).
308
308
  */
309
309
  getBalance(token?: NativeToken | FungibleToken): Promise<bigint>;
310
+ /**
311
+ * Relay a meta-transaction signed by a different account
312
+ *
313
+ * @param signedDelegate The signed delegate action to relay
314
+ * @returns The transaction response from the relayed meta-transaction
315
+ */
316
+ relayMetaTransaction(signedDelegate: SignedDelegate): Promise<RpcTransactionResponse>;
310
317
  /**
311
318
  * Transfers a token to the specified receiver.
312
319
  *
@@ -488,6 +488,18 @@ export class Account {
488
488
  async getBalance(token = NEAR) {
489
489
  return token.getBalance(this);
490
490
  }
491
+ /**
492
+ * Relay a meta-transaction signed by a different account
493
+ *
494
+ * @param signedDelegate The signed delegate action to relay
495
+ * @returns The transaction response from the relayed meta-transaction
496
+ */
497
+ async relayMetaTransaction(signedDelegate) {
498
+ return this.signAndSendTransaction({
499
+ receiverId: signedDelegate.delegateAction.senderId,
500
+ actions: [actions.signedDelegate(signedDelegate)],
501
+ });
502
+ }
491
503
  /**
492
504
  * Transfers a token to the specified receiver.
493
505
  *
package/lib/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  export * from './accounts/index.js';
2
2
  export type { CurveType, KeyPairString, Signature as CryptoSignature, } from './crypto/index.js';
3
- export { KeyPair, KeyPairEd25519, KeyPairSecp256k1, KeyType, PublicKey, } from './crypto/index.js';
3
+ export { KeyPair, KeyPairEd25519, KeyPairSecp256k1, KeyType, keyToImplicitAddress, PublicKey, } from './crypto/index.js';
4
4
  export * from './providers/index.js';
5
5
  export * from './signers/index.js';
6
6
  export * from './transactions/index.js';
package/lib/index.js CHANGED
@@ -8,7 +8,7 @@ export * from './accounts/index.js';
8
8
  // ============================================================================
9
9
  // Cryptography
10
10
  // ============================================================================
11
- export { KeyPair, KeyPairEd25519, KeyPairSecp256k1, KeyType, PublicKey, } from './crypto/index.js';
11
+ export { KeyPair, KeyPairEd25519, KeyPairSecp256k1, KeyType, keyToImplicitAddress, PublicKey, } from './crypto/index.js';
12
12
  // ============================================================================
13
13
  // Providers
14
14
  // ============================================================================
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "near-api-js",
3
3
  "description": "JavaScript library to interact with NEAR Protocol via RPC API",
4
- "version": "7.0.4",
4
+ "version": "7.1.0",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+https://github.com/near/near-api-js.git"